-
Notifications
You must be signed in to change notification settings - Fork 435
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
Flow sensitive wpa misses alias of global pointer? #1449
Comments
It works for me for both analyses (-fspta and -ander). You could try the below code:
clang -S -c -emit-llvm ex.c -o ex.ll
|
Thanks for your reply! I'm able to reproduce this, and the resulting PAG is here: WPA says:
I can see that node 19 and node 20 is created as alias of I'm wondering why SVF needs this to work. Also, can I analyze this program without modifying its source code? |
Here is another finding: using FYI, I'm interested in which object
Even when I add |
If node 5 is a top-level pointer, it is fine to query its points-to using pts(5), but if it is an address taken object, you should query using a location id pts(5, loc).
|
I would suggest a simple way of always querying top-level pointers but not address-taken objects. You could do that when an object is loaded to a pointer so you could query that pointer. In fact, only top-level pointers/registers are used for aliases and queries in real code. |
Here node 5 is in the PAG above, and that does represent a top-level pointer, i.e.,
Sorry, I did not really get what "location id" is (I guess it's something like context?). As far as I know, performing wpa does not take context as argument when checking pts, since there is only one final result.
That is exactly what I did. However, using # manual breakpoint set after PTA is done
$ gdb --args wpa -stat=false -ander global-ptr.bc
(gdb) p _pta->getPts(5).count()
$1 = 1
# top level pointer points to stack variable
(gdb) p *_pta->getPts(5).begin()
$2 = 13
$ gdb --args wpa -stat=false -fspta global-ptr.bc
# top level variable points to nothing
(gdb) p _pta->getPts(5).count()
$1 = 0 I'm expecting Sorry if I've mixed things up in previous posts. I hope now the question is a little clearer. |
Node 5 can't be queried using pts(5) as it is an object which can be defined multiple times at different program points/locations. You could only use the below APIs to get their pts: |
Hi,
I'm having unexpected results when analyzing a complicated program, and the problem boils down to a seemingly simple issue. Consider this very simple program:
And the (related part of) PAG is also straightforward:
Andersen's analysis shows
*a
is an alias ofb
:while flow sensitive says no:
I'm having a hard time understanding this. Though we are doing whole program analysis,
a = &b
will eventually be executed, so flow sensitive analysis should not overlook it. I believe such behavior can only happen when feeding context prior toa = &b
, to DDA. Is this indeed unexpected behavior or I'm just mixing concepts up?Plus, is there a simple way to find all aliases of a value? Currently SVF has nice and clean interface to get pts and revPts of a value, but the only interface I find for alias checking is
alias(node1, node2)
, which is used to traverse all PAG nodes to find all aliases.The text was updated successfully, but these errors were encountered: