-
Notifications
You must be signed in to change notification settings - Fork 84
Refactor mutex analyses #662
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
Merged
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
427dfd2
Extract mutexEvents analysis from mutex
sim642 f7d1ec1
Add Lock2/Unlock2 events with write flag
sim642 dc878fc
Make mutex analysis depend on mutexEvents
sim642 4dfeca5
Emit special lock events from OSEK analysis
sim642 0b04e36
Use IdentitySpec for mutex analysis
sim642 cccb292
Simplify OSEK analysis fix by overridding M.special
sim642 2225a10
Simplify mutexEvents analysis unit local state
sim642 7a33635
Simplify mayLocks analysis using mutex events
sim642 930c908
Simplify deadlock analysis using mutex events
sim642 0e8a071
Fix typo in unlock event printing
sim642 1858dcd
Fix Unlock event emitted for both read and write lock
sim642 7c20644
Rename lock & unlock events
sim642 9fa7901
Remove write argument from Unlock event
sim642 555ac53
Remove lock/unlock multiple argument support
sim642 46d78bb
Add mutexEvents analysis dependency to mayLocks & deadlock
sim642 dbd6b3e
Test mutexEvents based deadlock with failing locks
sim642 41ec21d
Fix lock event not emitted with failing locks and no lhs
sim642 b3e905a
Replace name based blob check with IsMultiple query for lock
sim642 078c11c
Fix lock event not emitted for ambiguous pointers
sim642 bb9e600
Fix deadlock with unknown pointer
sim642 2db10a0
Fix must lockset unlock of unknown pointer
sim642 b3db97d
Fix deadlock ambiguous unlock pointer
sim642 16fc5bc
Fix maylocks & deadlock unknown unlock pointer
sim642 ed693a2
Fix maylocks & deadlock blob unlock pointer
sim642 5a0e33a
Remove commented out lockset code
sim642 a181629
Extract functor for may lockset analysis
sim642 422ebde
Extract functor for must lockset analysis
sim642 f9233cc
Comment lockset analysis cases
sim642 5829573
Replace unknown lock representation with Addr.UnknownPtr
sim642 d805791
Remove duplicate special lock definitions from mutex analysis
sim642 76b7ddc
Remove unused opens, add delegation comment
sim642 aec788e
Rename query CurrentLockset -> MustLockset
sim642 f5a7432
Move must lockset change check to mutex privatizations
sim642 531a831
Remove MustLock & MustUnlock events
sim642 a6777d9
Use event ctx for privatizations instead of octx
sim642 68cf1de
Merge branch 'master' into locks-refactor
sim642 5f6b574
Fix deadlock detection with unknown pointers
sim642 e37fa65
Add extra DEADLOCK annotations to added tests
sim642 d163dff
Fix event ctx in apron privatizations
sim642 31ec827
Add self deadlock test
sim642 9894c03
Add privatization warnings about unsound unknown mutex unlock
sim642 e93fc69
Deduplicate and fix conv_offset_inv
sim642 518b9e1
Update mutex analyses comments
sim642 575a94a
Add relocking check to apron mutex-meet variants as well
sim642 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| (** Basic lockset analyses. *) | ||
|
|
||
| open Prelude.Ana | ||
| open Analyses | ||
|
|
||
|
|
||
| module type DS = | ||
| sig | ||
| include Lattice.S | ||
| val empty: unit -> t | ||
| end | ||
|
|
||
| module Make (D: DS) = | ||
| struct | ||
| include Analyses.IdentitySpec | ||
| let name () = "lockset" | ||
|
|
||
| module D = D | ||
| module C = D | ||
|
|
||
| let startstate v = D.empty () | ||
| let threadenter ctx lval f args = [D.empty ()] | ||
| let exitstate v = D.empty () | ||
| end | ||
|
|
||
|
|
||
| module type MayArg = | ||
| sig | ||
| module D: DS | ||
| module G: Lattice.S | ||
| module V: Printable.S | ||
|
|
||
| val add: (D.t, G.t, D.t, V.t) ctx -> LockDomain.Lockset.Lock.t -> D.t | ||
| val remove: (D.t, G.t, D.t, V.t) ctx -> ValueDomain.Addr.t -> D.t | ||
| end | ||
|
|
||
| module MakeMay (Arg: MayArg) = | ||
| struct | ||
| include Make (Arg.D) | ||
| let name () = "mayLockset" | ||
|
|
||
| module G = Arg.G | ||
| module V = Arg.V | ||
|
|
||
| let event ctx e octx = | ||
| match e with | ||
| | Events.Lock l -> | ||
| Arg.add ctx l (* add all locks, including blob and unknown *) | ||
| | Events.Unlock UnknownPtr -> | ||
| ctx.local (* don't remove any locks, including unknown itself *) | ||
| | Events.Unlock Addr (v, _) when ctx.ask (IsMultiple v) -> | ||
| ctx.local (* don't remove non-unique lock *) | ||
| | Events.Unlock l -> | ||
| Arg.remove ctx l (* remove definite lock or none in parallel if ambiguous *) | ||
| | _ -> | ||
| ctx.local | ||
| end | ||
|
|
||
|
|
||
| module type MustArg = | ||
| sig | ||
| include MayArg | ||
| val remove_all: (D.t, _, D.t, _) ctx -> D.t | ||
| end | ||
|
|
||
| module MakeMust (Arg: MustArg) = | ||
| struct | ||
| include Make (Arg.D) | ||
| let name () = "mustLockset" | ||
|
|
||
| module G = Arg.G | ||
| module V = Arg.V | ||
|
|
||
| let event ctx e octx = | ||
| match e with | ||
| | Events.Lock (UnknownPtr, _) -> | ||
| ctx.local (* don't add unknown lock *) | ||
| | Events.Lock (Addr (v, _), _) when ctx.ask (IsMultiple v) -> | ||
| ctx.local (* don't add non-unique lock *) | ||
| | Events.Lock l -> | ||
| Arg.add ctx l (* add definite lock or none in parallel if ambiguous *) | ||
| | Events.Unlock UnknownPtr -> | ||
| Arg.remove_all ctx (* remove all locks *) | ||
| | Events.Unlock l -> | ||
| Arg.remove ctx l (* remove definite lock or all in parallel if ambiguous (blob lock is never added) *) | ||
| | _ -> | ||
| ctx.local | ||
| end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.