Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decodeOneOperand() called with unknown addressing method 18 #66

Closed
jdetter opened this issue May 31, 2016 · 4 comments
Closed

decodeOneOperand() called with unknown addressing method 18 #66

jdetter opened this issue May 31, 2016 · 4 comments
Assignees
Labels

Comments

@jdetter
Copy link
Contributor

jdetter commented May 31, 2016

Via dyninst api mailing list:

Calling getProcedures() on the default module of a stripped PIE results in an assertion failure at common/src/arc-x86.C:7993. It seems that the heuristic gap parser is trying to decode the assembly as x86_32 instead of x86_64 (I may be wrong though). Exact stack trace is attached.

This is triggered by simply opening the binary, getting the default module, then calling getProcedure.

Sample offending program is /usr/bin/ssh on Ubuntu 16.04 x86_64.

test: /dyninst/common/src/arch-x86.C:7993: NS_x86::ia32_instruction& NS_x86::ia32_decode(unsigned int, const unsigned char*, NS_x86::ia32_instruction&): Assertion `0' failed.

#0  0x00007ffff6279418 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff627b01a in __GI_abort () at abort.c:89
#2  0x00007ffff6271bd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x7ffff6c5c396 "0", 
    file=file@entry=0x7ffff6c61f10 "/dyninst/common/src/arch-x86.C", line=line@entry=7993, 
    function=function@entry=0x7ffff6c61b80 <NS_x86::ia32_decode(unsigned int, unsigned char const*, NS_x86::ia32_instruction&)::__PRETTY_FUNCTION__> "NS_x86::ia32_instruction& NS_x86::ia32_decode(unsigned int, const unsigned char*, NS_x86::ia32_instruction&)") at assert.c:92
#3  0x00007ffff6271c82 in __GI___assert_fail (assertion=assertion@entry=0x7ffff6c5c396 "0", 
    file=file@entry=0x7ffff6c61f10 "/dyninst/common/src/arch-x86.C", line=line@entry=7993, 
    function=function@entry=0x7ffff6c61b80 <NS_x86::ia32_decode(unsigned int, unsigned char const*, NS_x86::ia32_instruction&)::__PRETTY_FUNCTION__> "NS_x86::ia32_instruction& NS_x86::ia32_decode(unsigned int, const unsigned char*, NS_x86::ia32_instruction&)") at assert.c:101
#4  0x00007ffff6c09c5a in NS_x86::ia32_decode (capa=capa@entry=1, addr=<optimized out>, instruct=...) at /dyninst/common/src/arch-x86.C:7993
#5  0x00007ffff763e826 in Dyninst::InstructionAPI::InstructionDecoder_x86::doIA32Decode (this=0x67dd60, b=...)
    at /dyninst/instructionAPI/src/InstructionDecoder-x86.C:1292
#6  0x00007ffff763f179 in Dyninst::InstructionAPI::InstructionDecoder_x86::decodeOpcode (this=<optimized out>, b=...)
    at /dyninst/instructionAPI/src/InstructionDecoder-x86.C:1352
#7  0x00007ffff7740a8a in Dyninst::InstructionAPI::InstructionDecoderImpl::decode (this=0x67dd60, b=...)
    at /dyninst/instructionAPI/src/InstructionDecoderImpl.C:56
#8  0x00007ffff763db7d in Dyninst::InstructionAPI::InstructionDecoder_x86::decode (this=<optimized out>, b=...)
    at /dyninst/instructionAPI/src/InstructionDecoder-x86.C:1406
#9  0x00007ffff763d966 in Dyninst::InstructionAPI::InstructionDecoder::decode (this=this@entry=0x7fffffffd650)
    at /dyninst/instructionAPI/src/InstructionDecoder.C:65
#10 0x00007ffff7a3b0da in hd::ProbabilityCalculator::decodeInstruction (this=this@entry=0x7fffffffd860, data=..., addr=addr@entry=151394)
    at /dyninst/parseAPI/src/ProbabilisticParser.C:493
#11 0x00007ffff7a3bdb2 in hd::ProbabilityCalculator::calcForwardWeights (this=0x7fffffffd860, cur=0, addr=151394, tree=0x7fffffffd868, valid=@0x7fffffffd78f: true)
    at /dyninst/parseAPI/src/ProbabilisticParser.C:416
#12 0x00007ffff7a3c0cb in hd::ProbabilityCalculator::calcProbByMatchingIdioms (this=this@entry=0x7fffffffd860, addr=addr@entry=151394)
    at /dyninst/parseAPI/src/ProbabilisticParser.C:331
#13 0x00007ffff79ceec0 in Dyninst::ParseAPI::Parser::probabilistic_gap_parsing (this=0x6d7780, cr=cr@entry=0x6a1f40)
    at /dyninst/parseAPI/src/Parser-speculative.C:361
#14 0x00007ffff79c3ce2 in Dyninst::ParseAPI::CodeObject::parseGaps (this=<optimized out>, cr=cr@entry=0x6a1f40, type=type@entry=Dyninst::ParseAPI::IdiomMatching)
    at /dyninst/parseAPI/src/CodeObject.C:188
#15 0x00007ffff6f93fbc in image::analyzeImage (this=this@entry=0x663cd0) at /dyninst/dyninstAPI/src/image.C:1201
#16 0x00007ffff6f940ab in image::analyzeIfNeeded (this=0x663cd0) at /dyninst/dyninstAPI/src/image.C:1165
#17 0x00007ffff6f95e37 in image::getAllFunctions (this=<optimized out>) at /dyninst/dyninstAPI/src/image.C:945
#18 pdmodule::getFunctions (this=0x677c80, funcs=std::vector of length 0, capacity 0) at /dyninst/dyninstAPI/src/image.C:1809
#19 0x00007ffff6faaec6 in mapped_module::getAllFunctions (this=0x7920d0) at /dyninst/dyninstAPI/src/mapped_module.C:48
#20 0x00007ffff6f331dd in BPatch_module::getProcedures (this=0x799750, funcs=std::vector of length 0, capacity 0, incUninstrumentable=false)
    at /dyninst/dyninstAPI/src/BPatch_module.C:350
#21 0x00007ffff6f333e7 in BPatch_module::getProcedures (this=0x799750, incUninstrumentable=incUninstrumentable@entry=false)
    at /dyninst/dyninstAPI/src/BPatch_module.C:331
#22 0x00000000004038a4 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>)

@jdetter jdetter self-assigned this May 31, 2016
@jdetter jdetter changed the title assert thrown in arch-x86.C Assert thrown in arch-x86.C May 31, 2016
@jdetter
Copy link
Contributor Author

jdetter commented May 31, 2016

I think Mohamed isn't using the latest master, this is most likely an old issue. Will reopen if this is an actual issue.

@jdetter jdetter closed this as completed May 31, 2016
@jdetter jdetter changed the title Assert thrown in arch-x86.C decodeOneOperand() called with unknown addressing method 18 May 31, 2016
@jdetter
Copy link
Contributor Author

jdetter commented May 31, 2016

Mohamed is running into this bug again on the master branch, however I am not able to reproduce this.

@jdetter jdetter reopened this May 31, 2016
@jdetter
Copy link
Contributor Author

jdetter commented May 31, 2016

am_T is missing from the switch in InstructionDecoder-x86.C. I'm not sure how it got removed but I should have a fix for this soon.

@jdetter
Copy link
Contributor Author

jdetter commented Jun 1, 2016

This has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants