-
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
Region identification issues with array accesses #264
Comments
I'm not sure but I think this is likely to be related to the following sections of code: BASIL/src/main/scala/analysis/InterprocSteensgaardAnalysis.scala Lines 83 to 90 in 7849e72
BASIL/src/main/scala/analysis/UtilMethods.scala Lines 173 to 189 in 7849e72
In the Steensgaard analysis, if a MemoryLoad is encountered in the RHS of an assignment, it will treat the index of the load as what is being assigned to the LHS. This is incorrect and not sound. The current implementation means that the Steensgaard analysis does not differentiate between the following:
There are also obvious issues relating to the handling of BinaryExpr which is stated to be incorrect. |
This issue is related to VSA precisely when it tries to match the region "found" with the data from the relf file and this results in a partial match. The bug was that it takes the biggest size of both (the found region 4, and the partial match 8) which is not correct. I have addressed this in 4e63388 Once solution checked this issue can be closed |
Can you please place these fixes in their own branch, one that does not have other unrelated changes (such as the SASI VSA), and create a pull request for it? |
You've fixed most of the current issues but that has exposed another underlying issue with the VSA for some cases, including the following: For correct/initialisation/clang:BAP, the issue happens when GlobalRegionAnalysis reaches the line %0000035f in the second iteration (after the VSA). The relevant parts of the .bir are as follows:
The VSA has that R8 = 69696 (0x11040) at %0000035f, which is incorrect as that address has just been accessed in the previous line. The actual value of R8 at %0000035f is 1 since that is the value that the address 0x11040 is initialised to, but it would be sufficient here if the VSA just had that R8 = top at %0000035f. Currently the VSA gives the completely wrong value, which causes the GRA to create a region from 69696 + 3 (69699) which overrides the correct region at 69696 that we care about in the MMM. |
This issue has been addresses here: |
For the test correct/initialisation/clang:BAP, the analysis gives regions with incorrect size for accesses %00000367 and %00000359.
Here, the access at %00000367 is to the address 0x11044 (69700 in decimal). This is a 32-bit access or 4-byte access. The GRA gives this access the region data_11, which starts at 69700 and has a size of 8 bytes. This is an incorrect size - it should only be 4 bytes as this is the only time this address is accessed. These accesses are both accesses to an array global variable.
The 32-bit (4-byte) access at %00000359 is to the address 0x11040 (69696 in decimal). The GRA gives this access the region data_14, which starts at 69696 and has a size of 8 bytes. This is also an incorrect size - this is also the only time this address is accessed, so it should only have a size of 4 bytes. In addition, if both those sizes were correct, the regions should have been merged due to being overlapping.
For correct/initialisation/clang_pic:BAP, there are some region size issues similar to the previous example, but there is another error in the analysis as well.
This is the relevant parts of the .bir file:
The access at %0000036b is incorrectly given a region with a size of 8 instead of 4 (it only has a 32-bit access) - this is the same region size issue with array accesses.
The access at %00000379 is incorrectly given a region with size 8 and start address 0x10FCC (69580). It seems to have gotten this by doing 0x10000 + 0xFC8 + 4, but the fact that 0x10FC8 (69576) is loaded from memory and the result has 4 added to it has been missed. The correct address is 0x11044 (69700) as mem[0x10FC8] == 0x11040 (69696).
The text was updated successfully, but these errors were encountered: