-
Notifications
You must be signed in to change notification settings - Fork 440
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
SVF seems to be incomplete when dealing with virtual calls. #1301
Comments
Would you be able to identify the problem in CHG or virtual call solving? |
I will try my best, but I don't know the andersen algorithm very well and may not be able to help. |
I also tested SVF-2.7's client SUPA and there are still misses, is it possible that this has something to do with the fact that my .bc is incomplete (not the .bc of the whole program)? |
Thanks for the update. Please confirm if this is the reason. |
Does andersen analysis analyze virtual function calls related to phi instructions? e.g.
The complete function is below:
|
I'm sorry to bother you again. In my example, the
|
Thanks for reporting. This looks to be a good test case. Could you upload (1) a minimum c program (try to cut it down a bit), (2) its bc file, and (3) CHG (the incomplete one as you pointed out) |
Make the test case as small as possible and would be good to have a single cpp file. |
Hi, I have uploaded (1) and (2) as you suggested, but for (3) I don't quite understand what it means. tips: The files I uploaded is compiled based on LLVM 10.0.1. |
it is the class hierarchy graph (CHG) using the option -dump-chg |
@JasonZhongZexin @xudon9 could you take a look at this C++ test case? |
better to use llvm-14.0 though it might not make a difference, worth having a try. |
This is the CHG. |
I've tried this on SVF 2.7 (which relies on LLVM 14) and do have the same problem. I will upload the LLVM 14 version of bc as soon as I can if I need to provide it. |
would be good to have the llvm-14 bc. |
Sorry for the late reply, but here is the compiled bc file for llvm 14. |
Okay, I will take a look at these test cases and follow up on this issue. |
Dear Developers. Lines 310 to 314 in 6f1bbc2
But turning this on affects the results of the andersen analysis (it will add more edges on top of the andersen analysis). ![]() This may require adding a handling logic to enable (degenerate to) the CHA method only for those callsites where andersen fails. The following file contains two call graphs, one generated with the -v-call-cha option added, and one generated without the -v-call-cha option. |
Once -v-call-cha is turned on, SVF will use CHA result to build call graph and solve indirect/virtuall calls, rather than using points-to analysis. Can you check whether the call graph is correct if -v-call-cha is turned on? |
I have checked the call graph and when both -v-call-cha and -ander options are added, svf adds two edges to the same candidate for the virtual call, one from andersen analysis and one from cha. |
Does it mean both call graphs are correct? |
Both call graphs are incorrect (one has duplicate edges and one is missing edges). For call graphs generated with both -ander and -v-call-cha turned on. This simply retains the results of both analyses (andersen and CHA). I think there should be some logic for both analyses, such as enabling the CHA results when the andersen algorithm fails to ensure that there are no false negatives in the results of the VIRTUAL CALL analysis. |
I'm using SVF version 2.1.
The omission occurs when I write SVF as a lib to get the callsite of all the virtual functions and their targets. As far as I know this should be complete.
My core code is as follows:
The output is shown in the following file: outs_2.txt
An example of what was missed:
its IR: copter_lib.zip
Its omitted Virtual function callsite:
The text was updated successfully, but these errors were encountered: