Skip to content
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

Relational Mutex-Meet-Privatization making use of Thread IDs #379

Merged
merged 136 commits into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
1d6175f
first steps towards using tids in privatization
michael-schwarz Oct 7, 2021
7f899ad
Factor out common logic
michael-schwarz Oct 8, 2021
4ad0a0c
Progress
michael-schwarz Oct 8, 2021
c8667e3
Progress
michael-schwarz Oct 8, 2021
ce264dc
Progress
michael-schwarz Oct 8, 2021
b21e4d7
Progress
michael-schwarz Oct 8, 2021
1dc1f69
Progress
michael-schwarz Oct 8, 2021
ae4eb7b
Toy examples
michael-schwarz Oct 8, 2021
af42f41
fix spurious warning
michael-schwarz Oct 8, 2021
0305ee4
Add TODO example
michael-schwarz Oct 8, 2021
24833fd
add query to get set of unique created sucessors
michael-schwarz Oct 8, 2021
ab09a70
typo
michael-schwarz Oct 11, 2021
90c0a52
Add examples
michael-schwarz Oct 11, 2021
4a4f529
Remove Write-Centered Apron Privatization
michael-schwarz Oct 11, 2021
01d12c2
Ad dummy lmust tracking
michael-schwarz Oct 11, 2021
9a6ec3c
Limit propagation of mutex init values
michael-schwarz Oct 11, 2021
79b95eb
Remove unused alias
michael-schwarz Oct 11, 2021
cd7a8d2
Add thread must join analysis
michael-schwarz Oct 11, 2021
bf07f49
Add two examples
michael-schwarz Oct 11, 2021
1e37480
framework progress
michael-schwarz Oct 11, 2021
69488f6
Add either lattice
michael-schwarz Oct 11, 2021
a81b88e
Preperation for globals of different types
michael-schwarz Oct 11, 2021
ada0e33
Exploit mustJoin
michael-schwarz Oct 12, 2021
99ed7b3
typo
michael-schwarz Oct 12, 2021
eca5168
More examples
michael-schwarz Oct 12, 2021
ac19b7e
Undo changes to apronDomain.apron.ml
michael-schwarz Oct 12, 2021
e67b3b6
Nicer whitespace
michael-schwarz Oct 12, 2021
1c7dc40
Nicer whitespace
michael-schwarz Oct 12, 2021
c0a827d
Cleanup
michael-schwarz Oct 12, 2021
793ba4c
Add comment
michael-schwarz Oct 12, 2021
b5a13b6
Add problem
michael-schwarz Oct 12, 2021
9540f6f
Fix solver bug?
michael-schwarz Oct 12, 2021
119f01d
Add comment about fix
michael-schwarz Oct 13, 2021
ee0efe8
Experimental side-pp global widening strategy
michael-schwarz Oct 13, 2021
b5308a5
Remove apron & thread joins from default
michael-schwarz Oct 13, 2021
a551f59
Add problematic tests
michael-schwarz Oct 13, 2021
aba62b0
Add comments to confusing test
michael-schwarz Oct 13, 2021
e24da3f
restructure branched thread creation to work with path-sensitive flag…
michael-schwarz Oct 13, 2021
36551d3
Make life simpler at the price of having the threadflag analysis path…
michael-schwarz Oct 13, 2021
76c4135
Rm old todo
michael-schwarz Oct 13, 2021
24d3d4f
Merge branch 'master' into use_tids
michael-schwarz Oct 17, 2021
7d66e5c
Use IdentitySpec to avoid giving all transfer functions
michael-schwarz Oct 17, 2021
176aeca
Use Lift2 instead of custom solution
michael-schwarz Oct 17, 2021
df114db
Merge branch 'master' into use_tids
michael-schwarz Oct 25, 2021
0603798
Bye bye strengthening
michael-schwarz Oct 25, 2021
d122a86
Add problematic example due to widening :'(
michael-schwarz Oct 26, 2021
73af6fb
Add second Miné example
michael-schwarz Oct 26, 2021
cc490e4
Merge branch 'master' into use_tids
michael-schwarz Oct 27, 2021
e35b18c
typo
michael-schwarz Oct 27, 2021
cfa2ddd
Try to extract clustering interface from apron mutex-meet-tid
sim642 Oct 27, 2021
26a612a
Add 1-2 clusters to apron mutex-meet-tid
sim642 Oct 27, 2021
7134adc
Hacky TID stats
michael-schwarz Oct 27, 2021
1bc3249
Add traces-rel config
michael-schwarz Oct 27, 2021
f41f427
Fix Cluster12 cluster map domain ordering and keep_global
sim642 Oct 27, 2021
0b7cab1
Fix Cluster12 keep_only_protected_globals
sim642 Oct 27, 2021
ec1d1b3
Add W filtering to Cluster12 to prevent unnecessary publishing
sim642 Oct 27, 2021
f19a28d
Remove unnecessary GMutex functor from apron mutex-meet clustering
sim642 Oct 28, 2021
c8c73da
Clean up apron mutex-meet clustering
sim642 Oct 28, 2021
4df17f9
Refactor apron mutex-meet Cluster12
sim642 Oct 28, 2021
e1b6b74
Add relational traces example where 1-clusters are needed
sim642 Oct 28, 2021
c409c03
Add comments to apron mutex-meet clusterings
sim642 Oct 28, 2021
4399342
Add comment about top W in apron mutex-meet
sim642 Oct 28, 2021
4369532
Add TODO to disabled apron strengthening
sim642 Oct 28, 2021
520d77e
Move thread return check from ApronPriv to ApronAnalysis
sim642 Oct 28, 2021
55ba4a9
Use Locksets.Lock instead of varinfo for apron mutex-meet-tid L
sim642 Oct 28, 2021
45f53d9
Use Locksets.Lock instead of varinfo for apron mutex-meet-tid LMust
sim642 Oct 28, 2021
b974752
Remove duplicate CommonPerMutex functions
sim642 Oct 28, 2021
bc70956
Optimize apron mutex-meet-tid get_relevant_writes
sim642 Oct 28, 2021
9f7279a
Remove duplicate join in apron mutex-meet-tid lock
sim642 Oct 28, 2021
0a2663f
Use ThreadId.get_current in apron priv
sim642 Oct 28, 2021
93ad28f
Use is_top for thread set instead of exception
sim642 Oct 28, 2021
7a97337
Change apron mine14 tests to TODOs
sim642 Oct 28, 2021
ff27002
Merge branch 'use_tids' into traces-relational-cluster
sim642 Oct 28, 2021
4fd4101
Remove hardcoded exp.apron.privatization mutex-meet-tid from tests
sim642 Oct 28, 2021
3f873c1
Merge branch 'use_tids' into traces-relational-cluster
sim642 Oct 28, 2021
f05f868
Ignore L in apron mutex-meet-tid write_global
sim642 Oct 28, 2021
c17b9b4
Make apron mutex-meet-tid cluster sizes configurable
sim642 Oct 29, 2021
67abb3d
Fix apron mutex-meet-tid with maximum clusters
sim642 Oct 29, 2021
7a6f7d4
Fix issue with lock(m_g) not taking L m_g into account
michael-schwarz Oct 29, 2021
772c881
Extract constant visitor
michael-schwarz Oct 31, 2021
2457d60
Add threshhold widening
michael-schwarz Oct 31, 2021
73739e0
typos
michael-schwarz Oct 31, 2021
7c294eb
Rm comment duplication
michael-schwarz Oct 31, 2021
98b2cea
Cleanup TID printing
michael-schwarz Oct 31, 2021
23ea5c8
Rm forgotten output
michael-schwarz Oct 31, 2021
5d2fe6f
Merge branch 'use_tids' into traces-relational-cluster
sim642 Nov 1, 2021
df90c19
Fix apron mutex-meet-tid-cluster2 not having singleton clusters for u…
sim642 Nov 1, 2021
e8b0642
Move Widening thresholds into separate module
michael-schwarz Nov 1, 2021
deb608b
Properly use lazy
michael-schwarz Nov 1, 2021
fe0c413
Add comment that Clustering2 might no really work
michael-schwarz Nov 2, 2021
f5c72ee
Merge pull request #417 from goblint/traces-relational-cluster
michael-schwarz Nov 2, 2021
049760d
Fix docstring
michael-schwarz Nov 2, 2021
f3d3433
Merge pull request #421 from goblint/apron_threshhold
michael-schwarz Nov 2, 2021
bcdc344
Rename to remove duplicate test IDs
michael-schwarz Nov 2, 2021
a6dc92c
Fix apron mutex-meet-tid-cluster decreasing protecting locksets
sim642 Nov 2, 2021
1965bf4
Extract separat DownwardClosedCluster in apron priv
sim642 Nov 3, 2021
103ff2b
Fix TODOs in ApronPriv.DownwardClosedCluster
sim642 Nov 3, 2021
e7de85b
Merge pull request #424 from goblint/traces-relational-cluster-lockset
sim642 Nov 3, 2021
5372cfc
Fix indentation in ApronPriv.ArbitraryCluster
sim642 Nov 3, 2021
734041e
Add reorder_2 and sigma, adjusted for C
Nov 2, 2021
a2742f0
Add more Mukherjee tests
Nov 2, 2021
a4f4c74
Add more examples from Mukherjee
Nov 3, 2021
8faef76
Move benchmarks
michael-schwarz Nov 3, 2021
2c75336
Hack 3 character test numbers
michael-schwarz Nov 3, 2021
2c0070e
throw everything at mukherjee's benchmarks
michael-schwarz Nov 3, 2021
c7ea774
Move Mukherjee benchmarks into separate group
michael-schwarz Nov 4, 2021
9d00dd3
Add Mukherjee tests to workflows
michael-schwarz Nov 4, 2021
f5f2859
52/02 Remove assert that does not hold in the concrete
michael-schwarz Nov 4, 2021
c3cbcb2
52/14 dix calls to lock instead of unlock
michael-schwarz Nov 4, 2021
1e927e1
52/07 fix type
michael-schwarz Nov 4, 2021
7a45d98
Add TODOs where Mukherjee also does not succeed
michael-schwarz Nov 4, 2021
f36b715
52/17 UB
Nov 4, 2021
b16a8ae
53/03 add initialization for len
Nov 4, 2021
46b06c6
52/05 add initialization
Nov 4, 2021
5430c24
52/03 assume no-ov
michael-schwarz Nov 4, 2021
691be38
52/05 assume no ov
michael-schwarz Nov 4, 2021
128b1d8
Merge branch 'master' into use_tids
michael-schwarz Nov 8, 2021
4ff8070
Rm commented out code
michael-schwarz Nov 8, 2021
a3fb900
Merge remote-tracking branch 'origin/remove_unnecessary_AD' into use_…
michael-schwarz Nov 8, 2021
a8b361e
More descriptive names
michael-schwarz Nov 9, 2021
256e047
Remove unused global variables from mukherjee Stack tests
sim642 Nov 9, 2021
2edeb1b
Optimize apron DownwarnClosedCluster.lock by not calling is_bot
sim642 Nov 9, 2021
f2280a0
silence precComapre by default
michael-schwarz Nov 9, 2021
d3614dd
Merge branch 'master' into use_tids
michael-schwarz Nov 10, 2021
0e26dff
Fix dune file for PrecCompare tools
michael-schwarz Nov 11, 2021
10e70f9
Make name of no lcutsers more descriptive
michael-schwarz Nov 11, 2021
23dcf7c
Add logging for protection
michael-schwarz Nov 11, 2021
3de07c3
More detailed mutex stats
michael-schwarz Nov 11, 2021
eb252c3
Merge branch 'master' into use_tids
michael-schwarz Nov 14, 2021
ac76264
Remove outdated comment
michael-schwarz Nov 23, 2021
e0a509f
tests 52/*: Unify include of assert.ht
michael-schwarz Nov 23, 2021
e7223aa
Switch default apron privatization to mutex-meet
michael-schwarz Nov 23, 2021
e5d63c8
Make normal sides default, sides-pp only as an option
michael-schwarz Nov 24, 2021
84c4b48
fix typo
michael-schwarz Nov 24, 2021
57769c9
Remove conditional from apron regressions
michael-schwarz Nov 24, 2021
54f6ebe
rm TODO
michael-schwarz Nov 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/locked.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
- name: Test apron regression # skipped by default but CI has apron, so explicitly test group (which ignores skipping -- it's now a feature!)
run: ruby scripts/update_suite.rb group apron -s

- name: Test apron regression (Mukherjee et. al SAS '17 paper') # skipped by default but CI has apron, so explicitly test group (which ignores skipping -- it's now a feature!)
run: ruby scripts/update_suite.rb group apron-mukherjee -s

- name: Build domaintest
run: ./make.sh domaintest

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/unlocked.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ jobs:
if: ${{ matrix.apron }}
run: ruby scripts/update_suite.rb group apron -s

- name: Test apron regression (Mukherjee et. al SAS '17 paper') # skipped by default but CI has apron, so explicitly test group (which ignores skipping -- it's now a feature!)
if: ${{ matrix.apron }}
run: ruby scripts/update_suite.rb group apron-mukherjee -s

- name: Build domaintest
run: ./make.sh domaintest

Expand Down
57 changes: 57 additions & 0 deletions conf/traces-rel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"ana": {
"int": {
"def_exc": true,
"interval": false,
"enums": true
},
"exp": {

}
},
"sem": {
"unknown_function": {
"invalidate": {
"globals": false
},
"spawn": true
},
"builtin_unreachable": {
"dead_code": true
}
},
"exp": {
"privatization": "mutex-meet",
"priv-distr-init": false,
"malloc": {
"wrappers": [
"kmalloc",
"__kmalloc",
"usb_alloc_urb",
"__builtin_alloca",
"kzalloc",

"ldv_malloc",

"kzalloc_node",
"ldv_zalloc",
"kmalloc_array",
"kcalloc",

"ldv_xmalloc",
"ldv_xzalloc",
"ldv_calloc"
sim642 marked this conversation as resolved.
Show resolved Hide resolved
]
},
"solver" : {
"td3": {
"side_widen" : "sides-pp"
}
}
},
"dbg" : {
"print_tids" : true,
"print_wpoints" : true,
"print_protection": true
}
}
26 changes: 24 additions & 2 deletions src/analyses/apron/apronAnalysis.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module SpecFunctor (AD: ApronDomain.S2) (Priv: ApronPriv.S) : Analyses.MCPSpec =
struct
include Analyses.DefaultSpec


let name () = "apron"

module Priv = Priv(AD)
Expand Down Expand Up @@ -216,6 +215,7 @@ struct

let return ctx e f =
let st = ctx.local in
let ask = Analyses.ask_of_ctx ctx in
let new_apr =
if AD.type_tracked (Cilfacade.fundec_return_type f) then (
let apr' = AD.add_vars st.apr [V.return] in
Expand All @@ -235,8 +235,15 @@ struct
|> List.filter AD.varinfo_tracked
|> List.map V.local
in

AD.remove_vars_with new_apr local_vars;
{st with apr = new_apr}
let st' = {st with apr = new_apr} in
begin match ThreadId.get_current ask with
| `Lifted tid when ThreadReturn.is_current ask ->
Priv.thread_return ask ctx.global ctx.sideg tid st'
| _ ->
st'
end

let combine ctx r fe f args fc fun_st =
let st = ctx.local in
Expand Down Expand Up @@ -288,13 +295,28 @@ struct
unify_st

let special ctx r f args =
let ask = Analyses.ask_of_ctx ctx in
let invalidate_one st lv =
assign_to_global_wrapper ask ctx.global ctx.sideg st lv (fun st v ->
let apr' = AD.forget_vars st.apr [V.local v] in
assert_type_bounds apr' v (* re-establish type bounds after forget *)
)
in
let st = ctx.local in
match LibraryFunctions.classify f.vname args with
(* TODO: assert handling from https://github.com/goblint/analyzer/pull/278 *)
| `Assert expression -> st
| `Unknown "__goblint_check" -> st
| `Unknown "__goblint_commit" -> st
| `Unknown "__goblint_assert" -> st
| `ThreadJoin (id,retvar) ->
(* nothing to invalidate as only arguments that have their AddrOf taken may be invalidated *)
(
let st' = Priv.thread_join ask ctx.global id st in
match r with
| Some lv -> invalidate_one st' lv
| None -> st'
)
| _ ->
let ask = Analyses.ask_of_ctx ctx in
let invalidate_one st lv =
Expand Down
Loading