-
Notifications
You must be signed in to change notification settings - Fork 88
Fix: symbolic locksets use may-equality when invalidating on unlock #1987
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
2a00bca
50a66e0
81076a5
b430e2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -357,11 +357,13 @@ struct | |
| let no_casts = S.map Expcompare.stripCastsDeepForPtrArith (eq_set ask e) in | ||
| let addrs = S.filter (function AddrOf _ -> true | _ -> false) no_casts in | ||
| S.union addrs st | ||
| let remove ask e st = | ||
| (* TODO: Removing based on must-equality sets is not sound! *) | ||
| let no_casts = S.map Expcompare.stripCastsDeepForPtrArith (eq_set ask e) in | ||
| let addrs = S.filter (function AddrOf _ -> true | _ -> false) no_casts in | ||
| S.diff st addrs | ||
|
|
||
| let remove (ask: Queries.ask) e st = | ||
| let pt_e = ask.f (Queries.MayPointTo e) in | ||
| S.filter (fun l -> | ||
| let pt_l = ask.f (Queries.MayPointTo l) in | ||
| Queries.AD.is_bot (Queries.AD.meet pt_e pt_l) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like a roundabout form of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. For |
||
| ) st | ||
| let remove_var v st = S.filter (fun x -> not (Exp.contains_var v x)) st | ||
|
|
||
| let filter = S.filter | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder what the purpose of
stripCastsDeepForPtrArithwas because it's now removed fromremove.It's still in
addthough. I don't immediately know if this mismatch/removal can cause any problems.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stripCastsDeepForPtrArithinaddwas used to normalize expressions fromeq_setbefore syntactic comparison with lockset elements. Inremove, we now useMayPointTowhich evaluates expressions through the abstract domain and handles casts semantically, so the explicit cast-stripping is no longer needed. Added a comment in b430e2c explaining this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot: Why is is still used in
addthen?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
EqualSetquery (implemented invarEq.ml) wraps every returned expression inCastE (Internal, et, ...)(seevarEq.ml:548). SostripCastsDeepForPtrArithinaddis needed to peel those cast wrappers before theAddrOf _syntactic filter can recognize the lock addresses to store.In
remove, we useMayPointToinstead, which evaluates through the abstract value domain — casts are handled semantically there, so no explicit stripping is needed.