-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
Adapt basic block analysis for the Hexagon architecture. #2073
Conversation
Just a random idea which came to my mind. analysis.jmp.after.outofmap // Continue analysis if jump leaves mapped memory region.
analysis.jmp.after.reg // Continue analysis after a register jump.
analysis.jmp.after.cond // Continue analysis after a conditional jump.
analysis.jmp.after.outfcn // Continue analysis if jump leads out of function. It would allow the user to configure the analysis style best fitting to the platform being analysed. |
Regarding:
The idea is good, but this should be thoroughly tested with various combinations for main architectures. |
analysis.jmp.after
is set.analysis.jmp.after
is set.
After spending more time to adapt |
analysis.jmp.after
is set.
Please wait with merging. It needs more testing. |
38fbe7a
to
39ac2be
Compare
After doing some reversing with the current state of this PR I think it should be ready to merge. The result is fairly decent. |
bool is_x86 = is_arm ? false : analysis->cur->arch && !strncmp(analysis->cur->arch, "x86", 3); | ||
bool is_amd64 = is_x86 ? fcn->cc && !strcmp(fcn->cc, "amd64") : false; | ||
bool is_dalvik = is_x86 ? false : analysis->cur->arch && !strncmp(analysis->cur->arch, "dalvik", 6); | ||
bool is_hexagon = is_x86 ? false : analysis->cur->arch && !strncmp(analysis->cur->arch, "hexagon", 7); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these checks are kinda weird, i'm not sure about this, but maybe i would change this to a if-else-if-else statement.
Your checklist for this pull request
Detailed description
The
run_basic_block_analysis
function does not continue analysis if it encounters an register jump andanalysis.jmp.after=true
. This is not correct, sinceanalysis.jmp.after=true
explicitly states that the analysis should continue after a jump instruction.Now to the big problem.
All additions I made to the code are only executed if the analysis runs on the Hexagon architecture (see usage of
is_hexagon
flag). Because if it changes its analysis behavior for all architectures a lot (>60) tests fail.Test plan
Tests were added.
Only theanalysis.ijmp missing branch bug
failed. Could someone, who is more familiar than me with the x86_64 arch, please take a look at this one? I can't really tell whether it is good that it failed or not.Closing issues
kinda closes #2047 (Since for all other architectures than Hexagon the problem persists.)
closes #1796
closes rizinorg/rz-hexagon#36
Tiny additional feature added
Added
analysis.trap.after=false
config. Set totrue
, it will continue the analysis after a trap instruction.