Skip to content

Commit 27973d2

Browse files
Merge pull request #529 from goblint/part-access-refactor
Generalize pairwise race detection
2 parents d054af3 + f2b1e5f commit 27973d2

File tree

16 files changed

+673
-557
lines changed

16 files changed

+673
-557
lines changed

src/analyses/accessAnalysis.ml

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct
1919

2020
module G =
2121
struct
22-
include Access.PM
22+
include Access.AS
2323

2424
let leq x y = !GU.postsolving || leq x y (* HACK: to pass verify*)
2525
end
@@ -34,37 +34,29 @@ struct
3434
vulnerable := 0;
3535
unsafe := 0
3636

37-
let side_access ctx ty lv_opt ls_opt (conf, mhp, w, loc, e, lp) =
38-
if !GU.should_warn then (
39-
let d =
40-
let open Access in
41-
PM.singleton ls_opt (
42-
AS.singleton (conf, mhp, w, loc, e, lp)
43-
)
44-
in
45-
ctx.sideg (lv_opt, ty) d
46-
)
47-
else
48-
ctx.sideg (lv_opt, ty) (G.bot ()) (* HACK: just to pass validation with MCP DomVariantLattice *)
37+
let side_access ctx ty lv_opt (conf, w, loc, e, a) =
38+
let d =
39+
if !GU.should_warn then
40+
Access.AS.singleton (conf, w, loc, e, a)
41+
else
42+
G.bot () (* HACK: just to pass validation with MCP DomVariantLattice *)
43+
in
44+
ctx.sideg (lv_opt, ty) d
4945

5046
let do_access (ctx: (D.t, G.t, C.t, V.t) ctx) (w:bool) (reach:bool) (conf:int) (e:exp) =
51-
let tid = ctx.ask CurrentThreadId in
52-
let created = ctx.ask CreatedThreads in
53-
let joined = ctx.ask MustJoinedThreads in
54-
let mhp:MHP.t = {tid=tid; created=created; must_joined=joined } in
5547
let open Queries in
56-
let part_access ctx (e:exp) (vo:varinfo option) (w: bool) =
48+
let part_access ctx (e:exp) (vo:varinfo option) (w: bool): MCPAccess.A.t =
5749
ctx.emit (Access {var_opt=vo; write=w});
5850
(*partitions & locks*)
59-
ctx.ask (PartAccess {exp=e; var_opt=vo; write=w})
51+
Obj.obj (ctx.ask (PartAccess {exp=e; var_opt=vo; write=w}))
6052
in
6153
let add_access conf vo oo =
62-
let (po,pd) = part_access ctx e vo w in
63-
Access.add (side_access ctx) e w conf mhp vo oo (po,pd);
54+
let a = part_access ctx e vo w in
55+
Access.add (side_access ctx) e w conf vo oo a;
6456
in
6557
let add_access_struct conf ci =
66-
let (po,pd) = part_access ctx e None w in
67-
Access.add_struct (side_access ctx) e w conf mhp (`Struct (ci,`NoOffset)) None (po,pd)
58+
let a = part_access ctx e None w in
59+
Access.add_struct (side_access ctx) e w conf (`Struct (ci,`NoOffset)) None a
6860
in
6961
let has_escaped g = ctx.ask (Queries.MayEscape g) in
7062
(* The following function adds accesses to the lval-set ls
@@ -213,9 +205,9 @@ struct
213205
| WarnGlobal g ->
214206
let g: V.t = Obj.obj g in
215207
(* ignore (Pretty.printf "WarnGlobal %a\n" CilType.Varinfo.pretty g); *)
216-
let pm = ctx.global g in
217-
Access.print_accesses g pm;
218-
Access.incr_summary safe vulnerable unsafe g pm
208+
let accs = ctx.global g in
209+
Access.print_accesses g accs;
210+
Access.incr_summary safe vulnerable unsafe g accs
219211
| _ -> Queries.Result.top q
220212

221213
let finalize () =

src/analyses/apron/apronAnalysis.apron.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ struct
278278
| _ -> false (* remove everything else (globals, global privs) *)
279279
)
280280
in
281-
let unify_apr = A.unify Man.mgr new_apr new_fun_apr in (* TODO: unify_with *)
281+
let unify_apr = ApronDomain.A.unify Man.mgr new_apr new_fun_apr in (* TODO: unify_with *)
282282
if M.tracing then M.tracel "combine" "apron unifying %a %a = %a\n" AD.pretty new_apr AD.pretty new_fun_apr AD.pretty unify_apr;
283283
let unify_st = {fun_st with apr = unify_apr} in
284284
if AD.type_tracked (Cilfacade.fundec_return_type f) then (

0 commit comments

Comments
 (0)