Skip to content

Commit 18effef

Browse files
Merge branch 'master' into affineeq-refine
2 parents 6bd7861 + b68df11 commit 18effef

File tree

96 files changed

+7788
-3968
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+7788
-3968
lines changed

conf/svcomp-ghost.json

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
{
2+
"ana": {
3+
"sv-comp": {
4+
"enabled": true,
5+
"functions": true
6+
},
7+
"int": {
8+
"def_exc": true,
9+
"enums": false,
10+
"interval": true
11+
},
12+
"float": {
13+
"interval": true,
14+
"evaluate_math_functions": true
15+
},
16+
"activated": [
17+
"base",
18+
"threadid",
19+
"threadflag",
20+
"threadreturn",
21+
"mallocWrapper",
22+
"mutexEvents",
23+
"mutex",
24+
"access",
25+
"race",
26+
"escape",
27+
"expRelation",
28+
"mhp",
29+
"assert",
30+
"var_eq",
31+
"symb_locks",
32+
"region",
33+
"thread",
34+
"threadJoins",
35+
"abortUnless",
36+
"mutexGhosts",
37+
"pthreadMutexType"
38+
],
39+
"path_sens": [
40+
"mutex",
41+
"malloc_null",
42+
"uninit",
43+
"expsplit",
44+
"activeSetjmp",
45+
"memLeak",
46+
"threadflag"
47+
],
48+
"context": {
49+
"widen": false
50+
},
51+
"base": {
52+
"arrays": {
53+
"domain": "partitioned"
54+
},
55+
"invariant": {
56+
"local": false,
57+
"global": true
58+
}
59+
},
60+
"relation": {
61+
"invariant": {
62+
"local": false,
63+
"global": true,
64+
"one-var": false
65+
}
66+
},
67+
"apron": {
68+
"invariant": {
69+
"diff-box": true
70+
}
71+
},
72+
"var_eq": {
73+
"invariant": {
74+
"enabled": false
75+
}
76+
},
77+
"race": {
78+
"free": false,
79+
"call": false
80+
},
81+
"autotune": {
82+
"enabled": true,
83+
"activated": [
84+
"singleThreaded",
85+
"mallocWrappers",
86+
"noRecursiveIntervals",
87+
"enums",
88+
"congruence",
89+
"octagon",
90+
"wideningThresholds",
91+
"loopUnrollHeuristic",
92+
"memsafetySpecification",
93+
"noOverflows",
94+
"termination",
95+
"tmpSpecialAnalysis"
96+
]
97+
}
98+
},
99+
"exp": {
100+
"region-offsets": true
101+
},
102+
"solver": "td3",
103+
"sem": {
104+
"unknown_function": {
105+
"spawn": false
106+
},
107+
"int": {
108+
"signed_overflow": "assume_none"
109+
},
110+
"null-pointer": {
111+
"dereference": "assume_none"
112+
}
113+
},
114+
"witness": {
115+
"graphml": {
116+
"enabled": false
117+
},
118+
"yaml": {
119+
"enabled": true,
120+
"format-version": "2.1",
121+
"entry-types": [
122+
"flow_insensitive_invariant",
123+
"ghost_instrumentation"
124+
]
125+
},
126+
"invariant": {
127+
"loop-head": true,
128+
"after-lock": true,
129+
"other": true,
130+
"accessed": false,
131+
"exact": true,
132+
"all-locals": false,
133+
"flow_insensitive-as": "invariant_set-location_invariant"
134+
}
135+
},
136+
"pre": {
137+
"enabled": false
138+
}
139+
}

docs/artifact-descriptions/vmcai25.md

Lines changed: 298 additions & 0 deletions
Large diffs are not rendered by default.

goblint.opam

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ dev-repo: "git+https://github.com/goblint/analyzer.git"
9696
# on `dune build` goblint.opam will be generated from goblint.opam.template and dune-project
9797
# also remember to generate/adjust goblint.opam.locked!
9898
available: os-family != "bsd" & os-distribution != "alpine" & (arch != "arm64" | os = "macos")
99-
# pin-depends: [
100-
# published goblint-cil 2.0.5 is currently up-to-date, so no pin needed
101-
# [ "goblint-cil.2.0.5" "git+https://github.com/goblint/cil.git#c79208b21ea61d7b72eae29a18c1ddeda4795dfd" ]
99+
pin-depends: [
100+
# published goblint-cil 2.0.5 is currently up-to-date, but pinned for reproducibility
101+
[ "goblint-cil.2.0.5" "git+https://github.com/goblint/cil.git#c79208b21ea61d7b72eae29a18c1ddeda4795dfd" ]
102102
# pinned for stability (https://github.com/goblint/analyzer/issues/1520), remove after new camlidl release
103-
# [ "camlidl.1.12" "git+https://github.com/xavierleroy/camlidl.git#1c1e87e3f56c2c6b3226dd0af3510ef414b462d0" ]
103+
[ "camlidl.1.12" "git+https://github.com/xavierleroy/camlidl.git#1c1e87e3f56c2c6b3226dd0af3510ef414b462d0" ]
104104
# pinned for stability (https://github.com/goblint/analyzer/issues/1520), remove after new apron release
105-
# [ "apron.v0.9.15" "git+https://github.com/antoinemine/apron.git#418a217c7a70dae3f422678f3aaba38ae374d91a" ]
106-
# ]
105+
[ "apron.v0.9.15" "git+https://github.com/antoinemine/apron.git#418a217c7a70dae3f422678f3aaba38ae374d91a" ]
106+
]
107107
depexts: [
108108
["libgraph-easy-perl"] {os-distribution = "ubuntu" & with-test}
109109
]

goblint.opam.locked

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,20 @@ conflicts: [
137137
post-messages: [
138138
"Do not benchmark Goblint on OCaml 5 (https://goblint.readthedocs.io/en/latest/user-guide/benchmarking/)." {ocaml:version >= "5.0.0"}
139139
]
140+
pin-depends: [
141+
[
142+
"goblint-cil.2.0.5"
143+
"git+https://github.com/goblint/cil.git#c79208b21ea61d7b72eae29a18c1ddeda4795dfd"
144+
]
145+
[
146+
"camlidl.1.12"
147+
"git+https://github.com/xavierleroy/camlidl.git#1c1e87e3f56c2c6b3226dd0af3510ef414b462d0"
148+
]
149+
[
150+
"apron.v0.9.15"
151+
"git+https://github.com/antoinemine/apron.git#418a217c7a70dae3f422678f3aaba38ae374d91a"
152+
]
153+
]
140154
depexts: ["libgraph-easy-perl"] {os-distribution = "ubuntu" & with-test}
141155
description: """\
142156
Goblint is a sound static analysis framework for C programs using abstract interpretation.

goblint.opam.template

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# on `dune build` goblint.opam will be generated from goblint.opam.template and dune-project
22
# also remember to generate/adjust goblint.opam.locked!
33
available: os-family != "bsd" & os-distribution != "alpine" & (arch != "arm64" | os = "macos")
4-
# pin-depends: [
5-
# published goblint-cil 2.0.5 is currently up-to-date, so no pin needed
6-
# [ "goblint-cil.2.0.5" "git+https://github.com/goblint/cil.git#c79208b21ea61d7b72eae29a18c1ddeda4795dfd" ]
4+
pin-depends: [
5+
# published goblint-cil 2.0.5 is currently up-to-date, but pinned for reproducibility
6+
[ "goblint-cil.2.0.5" "git+https://github.com/goblint/cil.git#c79208b21ea61d7b72eae29a18c1ddeda4795dfd" ]
77
# pinned for stability (https://github.com/goblint/analyzer/issues/1520), remove after new camlidl release
8-
# [ "camlidl.1.12" "git+https://github.com/xavierleroy/camlidl.git#1c1e87e3f56c2c6b3226dd0af3510ef414b462d0" ]
8+
[ "camlidl.1.12" "git+https://github.com/xavierleroy/camlidl.git#1c1e87e3f56c2c6b3226dd0af3510ef414b462d0" ]
99
# pinned for stability (https://github.com/goblint/analyzer/issues/1520), remove after new apron release
10-
# [ "apron.v0.9.15" "git+https://github.com/antoinemine/apron.git#418a217c7a70dae3f422678f3aaba38ae374d91a" ]
11-
# ]
10+
[ "apron.v0.9.15" "git+https://github.com/antoinemine/apron.git#418a217c7a70dae3f422678f3aaba38ae374d91a" ]
11+
]
1212
depexts: [
1313
["libgraph-easy-perl"] {os-distribution = "ubuntu" & with-test}
1414
]

gobview

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ nav:
4141
- "🇸 SAS '21": artifact-descriptions/sas21.md
4242
- "🇪 ESOP '23": artifact-descriptions/esop23.md
4343
- "🇻 VMCAI '24": artifact-descriptions/vmcai24.md
44+
- "🇻 VMCAI '25": artifact-descriptions/vmcai25.md

scripts/goblint-lib-modules.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@
4848

4949
"MessageCategory", # included in Messages
5050
"PreValueDomain", # included in ValueDomain
51+
"IntervalDomain", # included in IntDomain
52+
"IntervalSetDomain", # included in IntDomain
53+
"DefExcDomain", # included in IntDomain
54+
"EnumsDomain", # included in IntDomain
55+
"CongruenceDomain", # included in IntDomain
56+
"IntDomTuple", # included in IntDomain
57+
"WitnessGhostVar", # included in WitnessGhost
5158

5259
"ConfigVersion",
5360
"ConfigProfile",

src/analyses/apron/relationAnalysis.apron.ml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,15 @@ struct
634634
)
635635
|> Enum.fold (fun acc x -> Invariant.(acc && of_exp x)) Invariant.none
636636

637+
let query_invariant_global ctx g =
638+
if GobConfig.get_bool "ana.relation.invariant.global" && ctx.ask (GhostVarAvailable Multithreaded) then (
639+
let var = WitnessGhost.to_varinfo Multithreaded in
640+
let inv = Priv.invariant_global (Analyses.ask_of_ctx ctx) ctx.global g in
641+
Invariant.(of_exp (UnOp (LNot, Lval (GoblintCil.var var), GoblintCil.intType)) || inv) [@coverage off] (* bisect_ppx cannot handle redefined (||) *)
642+
)
643+
else
644+
Invariant.none
645+
637646
let query ctx (type a) (q: a Queries.t): a Queries.result =
638647
let open Queries in
639648
let st = ctx.local in
@@ -655,6 +664,9 @@ struct
655664
let vf' x = vf (Obj.repr x) in
656665
Priv.iter_sys_vars ctx.global vq vf'
657666
| Queries.Invariant context -> query_invariant ctx context
667+
| Queries.InvariantGlobal g ->
668+
let g: V.t = Obj.obj g in
669+
query_invariant_global ctx g
658670
| _ -> Result.top q
659671

660672

src/analyses/apron/relationPriv.apron.ml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ module type S =
4646
val thread_return: Q.ask -> (V.t -> G.t) -> (V.t -> G.t -> unit) -> ThreadIdDomain.Thread.t -> relation_components_t -> relation_components_t
4747
val iter_sys_vars: (V.t -> G.t) -> VarQuery.t -> V.t VarQuery.f -> unit (** [Queries.IterSysVars] for apron. *)
4848

49+
val invariant_global: Q.ask -> (V.t -> G.t) -> V.t -> Invariant.t
50+
(** Returns flow-insensitive invariant for global unknown. *)
51+
4952
val invariant_vars: Q.ask -> (V.t -> G.t) -> relation_components_t -> varinfo list
5053
(** Returns global variables which are privatized. *)
5154

@@ -137,6 +140,7 @@ struct
137140
{rel = RD.top (); priv = startstate ()}
138141

139142
let iter_sys_vars getg vq vf = ()
143+
let invariant_global ask getg g = Invariant.none
140144
let invariant_vars ask getg st = []
141145

142146
let init () = ()
@@ -424,6 +428,7 @@ struct
424428
{rel = getg (); priv = startstate ()}
425429

426430
let iter_sys_vars getg vq vf = () (* TODO: or report singleton global for any Global query? *)
431+
let invariant_global ask getg g = Invariant.none
427432
let invariant_vars ask getg st = protected_vars ask (* TODO: is this right? *)
428433

429434
let finalize () = ()
@@ -708,6 +713,41 @@ struct
708713

709714
let init () = ()
710715
let finalize () = ()
716+
717+
let invariant_global (ask: Q.ask) (getg: V.t -> G.t): V.t -> Invariant.t = function
718+
| `Left m' -> (* mutex *)
719+
let atomic = LockDomain.MustLock.equal m' (LockDomain.MustLock.of_var LibraryFunctions.verifier_atomic_var) in
720+
if atomic || ask.f (GhostVarAvailable (Locked m')) then (
721+
(* filters like query_invariant *)
722+
let one_var = GobConfig.get_bool "ana.relation.invariant.one-var" in
723+
let exact = GobConfig.get_bool "witness.invariant.exact" in
724+
725+
let rel = keep_only_protected_globals ask m' (get_m_with_mutex_inits ask getg m') in (* Could be more precise if mutex_inits invariant is added by disjunction instead of joining abstract values. *)
726+
let inv =
727+
RD.invariant rel
728+
|> List.enum
729+
|> Enum.filter_map (fun (lincons1: Apron.Lincons1.t) ->
730+
(* filter one-vars and exact *)
731+
(* TODO: exact filtering doesn't really work with octagon because it returns two SUPEQ constraints instead *)
732+
if (one_var || GobApron.Lincons1.num_vars lincons1 >= 2) && (exact || Apron.Lincons1.get_typ lincons1 <> EQ) then
733+
RD.cil_exp_of_lincons1 lincons1
734+
|> Option.filter (fun exp -> not (InvariantCil.exp_contains_tmp exp))
735+
else
736+
None
737+
)
738+
|> Enum.fold (fun acc x -> Invariant.(acc && of_exp x)) Invariant.none
739+
in
740+
if atomic then
741+
inv
742+
else (
743+
let var = WitnessGhost.to_varinfo (Locked m') in
744+
Invariant.(of_exp (Lval (GoblintCil.var var)) || inv) [@coverage off] (* bisect_ppx cannot handle redefined (||) *)
745+
)
746+
)
747+
else
748+
Invariant.none
749+
| g -> (* global *)
750+
Invariant.none (* Could output unprotected one-variable (so non-relational) invariants, but probably not very useful. [BasePriv] does those anyway. *)
711751
end
712752

713753
(** May written variables. *)
@@ -1275,6 +1315,8 @@ struct
12751315
| _ -> ()
12761316

12771317
let finalize () = ()
1318+
1319+
let invariant_global ask getg g = Invariant.none
12781320
end
12791321

12801322
module TracingPriv = functor (Priv: S) -> functor (RD: RelationDomain.RD) ->

0 commit comments

Comments
 (0)