Skip to content

Commit 457bf48

Browse files
committed
Fix vojdani privatization unprotected invariant unsoundness on 56-witness/69-ghost-ptr-protection
1 parent dc678ab commit 457bf48

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/analyses/basePriv.ml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -834,12 +834,14 @@ struct
834834
if LockDomain.MustLockset.is_all locks then
835835
Invariant.none
836836
else (
837-
let read_global g = getg g in (* TODO: read top for others? or at least those which might not have all same protecting locks? *)
837+
(* Only read g as protected, everything else (e.g. pointed to variables) may be unprotected.
838+
See 56-witness/69-ghost-ptr-protection and https://github.com/goblint/analyzer/pull/1394#discussion_r1698136411. *)
839+
let read_global g' = if CilType.Varinfo.equal g' g then getg g' else VD.top () in (* TODO: Could be more precise for at least those which might not have all same protecting locks? *)
838840
let inv = ValueDomain.invariant_global read_global g in
839841
(* Very conservative about multiple protecting mutexes: invariant is not claimed when any of them is held.
840-
It should be possible to be more precise because writes only happen with all of them held,
841-
but conjunction is unsound when one of the mutexes is temporarily unlocked.
842-
Hypothetical read-protection is also somehow relevant. *)
842+
It should be possible to be more precise because writes only happen with all of them held,
843+
but conjunction is unsound when one of the mutexes is temporarily unlocked.
844+
Hypothetical read-protection is also somehow relevant. *)
843845
LockDomain.MustLockset.fold (fun m acc ->
844846
if LockDomain.MustLock.equal m (LockDomain.MustLock.of_var LibraryFunctions.verifier_atomic_var) then
845847
acc

0 commit comments

Comments
 (0)