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

Error on must-relocking of non-recursive mutex #1628

Merged
merged 4 commits into from
Nov 29, 2024
Merged
Changes from 1 commit
Commits
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
11 changes: 7 additions & 4 deletions src/analyses/mutexAnalysis.ml
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,17 @@ struct

let add ctx ((addr, rw): AddrRW.t): D.t =
match addr with
| Addr mv ->
| Addr ((v, o) as mv) ->
let (s, m) = ctx.local in
let s' = MustLocksetRW.add_mval_rw (mv, rw) s in
let m' =
if MutexTypeAnalysis.must_be_recursive ctx mv then
MustMultiplicity.increment mv m
else
match ctx.ask (Queries.MutexType (v, Offset.Unit.of_offs o)) with
| `Lifted Recursive -> MustMultiplicity.increment mv m
| `Lifted NonRec ->
if MustLocksetRW.mem_mval mv s then
M.error ~category:M.Category.Behavior.Undefined.double_locking "Acquiring a non-recursive mutex that is already held";
m
| `Bot | `Top -> m
in
(s', m')
| NullPtr ->
Expand Down
Loading