Skip to content

Commit d754d76

Browse files
committed
Add direct Klever concurrency specials
1 parent 1d78c45 commit d754d76

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/analyses/libraryFunctions.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ let classify' fn exps =
2424
`Unknown fn
2525
in
2626
match fn with
27-
| "pthread_create" ->
27+
| "pthread_create"
28+
| "pthread_create_N" -> (* Klever *)
2829
begin match exps with
2930
| [id;_;fn;x] -> `ThreadCreate (id, fn, x)
3031
| _ -> strange_arguments ()
@@ -72,6 +73,7 @@ let classify' fn exps =
7273
| "pthread_rwlock_wrlock" | "GetResource" | "_raw_spin_lock"
7374
| "_raw_spin_lock_flags" | "_raw_spin_lock_irqsave" | "_raw_spin_lock_irq" | "_raw_spin_lock_bh"
7475
| "spin_lock_irqsave" | "spin_lock"
76+
| "ldv_mutex_model_lock" | "ldv_spin_model_lock" (* Klever *)
7577
-> `Lock (get_bool "sem.lock.fail", true, true)
7678
| "pthread_mutex_lock" | "__pthread_mutex_lock"
7779
-> `Lock (get_bool "sem.lock.fail", true, false)
@@ -84,6 +86,7 @@ let classify' fn exps =
8486
| "mutex_unlock" | "ReleaseResource" | "_write_unlock" | "_read_unlock" | "_raw_spin_unlock_irqrestore"
8587
| "pthread_mutex_unlock" | "__pthread_mutex_unlock" | "spin_unlock_irqrestore" | "up_read" | "up_write"
8688
| "up"
89+
| "ldv_mutex_model_unlock" | "ldv_spin_model_unlock" (* Klever *)
8790
-> `Unlock
8891
| x -> `Unknown x
8992

src/analyses/mutexEventsAnalysis.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ struct
7777
let unlock remove_fn =
7878
match f.vname, arglist with
7979
| _, [arg]
80-
| ("spin_unlock_irqrestore" | "_raw_spin_unlock_irqrestore"), [arg; _] ->
80+
| ("spin_unlock_irqrestore" | "_raw_spin_unlock_irqrestore"), [arg; _]
81+
| "ldv_mutex_model_unlock", [arg; _] -> (* Klever *)
8182
List.iter (fun e ->
8283
ctx.split () [Events.Unlock (remove_fn e)]
8384
) (eval_exp_addr (Analyses.ask_of_ctx ctx) arg);
@@ -92,7 +93,8 @@ struct
9293
| `Lock (failing, rw, nonzero_return_when_aquired), _ ->
9394
begin match f.vname, arglist with
9495
| _, [arg]
95-
| "spin_lock_irqsave", [arg; _] ->
96+
| "spin_lock_irqsave", [arg; _]
97+
| "ldv_mutex_model_lock", [arg; _] -> (* Klever *)
9698
(*print_endline @@ "Mutex `Lock "^f.vname;*)
9799
lock ctx rw failing nonzero_return_when_aquired (Analyses.ask_of_ctx ctx) lv arg
98100
| _ -> failwith "lock has multiple arguments"

0 commit comments

Comments
 (0)