-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
fix stack alignment prevents stack analysis problem in decompiler #3023
base: master
Are you sure you want to change the base?
fix stack alignment prevents stack analysis problem in decompiler #3023
Conversation
This would be much easier to review if you remove the whitespace changes. |
f8a032d
to
ce880ff
Compare
This should be resolved. Hopefully one may use some tool like clang format to resolve the whitespace problem. It is really annoying BTW. |
Is this the intention for the rule to apply to every spacebase or just the stack? May you test and see if you get the expected behavior when the spacebase is ram? |
Do you have any suggestion about what the test program should look like?
Also, I did some thinking about this. However, if we consider the possibility of manual manipulation, it MIGHT break this rule. It would be fantastic if you could help me think of some test program. :) |
My main concern is what would happen if this rule gets applied to an architecture such as mips with What I had in mind for a test was to simply do something like call |
If you do something like You should actually use |
jobermayr/ghidra-staging@4c30773 to fix
|
This should fix issue #1345 . This happens because of the
and rsp, CONSTANT
instruction that aligns the stack. This prevents the stack from being analyzed because the decompiler relies on the constant propagation tillRSP + OFFSET
to understand local stack variables.This also happens when analyzing Rust which also uses the
and
instruction to do the stack alignment.Example before:

After:

Minimum example that reproduces the problem:
This patch works by ignoring the
and
instruction's effect on RSP (which is also explained in the comments).ALERT: I'm still new to this area, and do not fully understand what problem this patch could cause.
Suggestions are welcome to make this PR complete :)
(Also, this PR contains some of the indentation fixing of the mixing of space and tab indentation. If you think it is out of scope, I'm happy to resubmit without those fix. Although I may suggest a little fix is quite fine in this case. )