-
Notifications
You must be signed in to change notification settings - Fork 0
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
Improved call resolution, testing and convert analyses to use IR iterator #204
Conversation
Hi Liam, can you have an initial run and let me know if the calls are resolved alright? I have tested the most common examples (IndirectCallsTests in the test folder) and they all pass @l-kent |
1885801
to
4632b95
Compare
I have put the loop issue in #213 so it can be investigated after the merge |
Adding the memory regions into the IR doesn't appear to work correctly at present. MemoryAssigns are not handled properly, with only the rhs being updated to use a new region - this should not happen (and #188 will prevent a MemoryAssign having a different Memory on the lhs and rhs). Identifying regions seems like oversimplifies things at present. In the test
0x11034 is the location of 32-bit global variable 'secret'. The region analysis collapses these accesses into a single region named 'abort', seemingly named after the pointer located at at 0x11018 that points to the external |
It's also necessary to update the initialised memory sections when splitting mem into separate regions, and this doesn't happen. |
What I would like to do is look at merging the commits up to 4632b95 now, and move the commits since then into a new branch since it's clear they're going to require much more work. Does this make sense as an approach? |
evaluateExpressionWithSSA really needs to be implemented for all Exprs, it's quite limited at the moment |
Whenever the analysis resolves an indirect call, it also seems to incorrectly 'resolve' the procedure's return statement as a call to whatever the indirect call that it has resolved is. |
Test cases that still fail to resolve indirect calls:
As always, jumptable3 and switch2 are not possible to resolve correctly due to BAP's limitations so I haven't listed them. I have not yet checked that all others are resolved correctly. |
I want to fix the bug where returns get incorrectly resolved as indirect calls, then I'm happy to merge up to 4632b95 |
Since all the commits here are also in the |
The bug with returns being resolved incorrectly as indirect calls can be easily fixed by just not trying to resolve calls to R30, but it indicates a broader problem with the points-to analysis over-approximating stack accesses that it should be able to differentiate between. The following is from the indirect_call/clang test. I've annotated it with the values for relevant variables given by the points-to analysis result at relevant points.
According to the analysis, stack_13 contains a pointer to 'greet', stack_24's contents is empty/unknown, and stack_6 contains the value 0bv32. The analysis can't distinguish between accesses to stack_13 and stack_24, even though there shouldn't be any ambiguity. The analysis only resolves the indirect call to greet correctly at 000003b6 because it doesn't know what stack_24 points to and ignores it as a result. I also expect that the region contents not taking the assignment point into account could pose problems in the future. Memory values can be reassigned, so a program that writes different values to the same location at multiple points would likely significantly break the analysis. |
This reverts commit 4632b95.
e878a76
to
0092537
Compare
Currently passing all cases mentioned by Liam in #196 and #43 as well