Skip to content

Commit

Permalink
Handle thread-unsafe function calls in raceAnalysis #723
Browse files Browse the repository at this point in the history
Co-authored-by: Simmo Saan <[email protected]>
  • Loading branch information
karoliineh and sim642 committed Jun 9, 2023
1 parent d58c1ca commit 874c186
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/analyses/raceAnalysis.ml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,19 @@ struct
| _ ->
ctx.local

let special ctx (lvalOpt: lval option) (f:varinfo) (arglist:exp list) : D.t =
(* perform shallow and deep invalidate according to Library descriptors *)
let desc = LibraryFunctions.find f in
if List.mem LibraryDesc.ThreadUnsafe desc.attrs then (
let e = Lval (Var f, NoOffset) in
let conf = 110 in
let loc = Option.get !Node.current_node in
let vo = Some f in
let a = Obj.obj (ctx.ask (PartAccess (Memory {exp=e; var_opt=vo; kind=Call}))) in
side_access ctx (`Type f.vtype) (Some (f, `NoOffset)) (conf, Call, loc, e, a);
);
ctx.local

let finalize () =
let total = !safe + !unsafe + !vulnerable in
if total > 0 then (
Expand Down

0 comments on commit 874c186

Please sign in to comment.