File tree Expand file tree Collapse file tree 4 files changed +12
-7
lines changed
Filter options
test/rules/ownedpointervaluestoredinunrelatedsmartpointer Expand file tree Collapse file tree 4 files changed +12
-7
lines changed
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ import codingstandards.cpp.Concurrency
19
19
from LockProtectedControlFlowNode n
20
20
where
21
21
not isExcluded ( n , ConcurrencyPackage:: doNotSpeculativelyLockALockedNonRecursiveMutexQuery ( ) ) and
22
- // problematic nodes are ones where a lock is active and there is an attempt to
23
- // call a speculative locking function
22
+ // problematic nodes are ones where a lock is active and there is an attempt
23
+ // to call a speculative locking function
24
24
n .( MutexFunctionCall ) .isSpeculativeLock ( ) and
25
25
not n .( MutexFunctionCall ) .isRecursive ( ) and
26
26
n .getAProtectingLock ( ) = n .( MutexFunctionCall ) .getLock ( )
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ import codingstandards.cpp.Concurrency
19
19
from LockProtectedControlFlowNode n
20
20
where
21
21
not isExcluded ( n , ConcurrencyPackage:: lockedALockedNonRecursiveMutexAuditQuery ( ) ) and
22
- // problematic nodes are ones where a lock is active and there is an attempt to
23
- // call a speculative locking function
22
+ // problematic nodes are ones where a lock is active and there is an attempt
23
+ // to call a speculative locking function
24
24
n .( MutexFunctionCall ) .isSpeculativeLock ( ) and
25
25
not n .( MutexFunctionCall ) .isRecursive ( )
26
26
select n , "(Audit) Attempt to speculatively lock a non-recursive mutex while it is $@." ,
Original file line number Diff line number Diff line change @@ -399,9 +399,14 @@ class LockProtectedControlFlowNode extends ThreadedCFN {
399
399
not exists ( ControlFlowNode unlock |
400
400
// it's an unlock
401
401
unlock = getAThreadContextAwarePredecessor ( lock , this ) and
402
- unlock .( MutexFunctionCall ) .isUnlock ( )
402
+ unlock .( MutexFunctionCall ) .isUnlock ( ) and
403
403
// note that we don't check that it's the same lock -- this is left
404
404
// to the caller to enforce this condition.
405
+ // Because of the way that `getAThreadContextAwarePredecessor` works, it is possible
406
+ // for operations PAST it to be technically part of the predecessors.
407
+ // Thus, we need to make sure that this node is a
408
+ // successor of the unlock in the CFG
409
+ getAThreadContextAwareSuccessor ( unlock ) = this
405
410
) and
406
411
( lock instanceof MutexFunctionCall implies not this .( MutexFunctionCall ) .isUnlock ( ) )
407
412
)
Original file line number Diff line number Diff line change 51
51
| test.cpp:17:27:17:28 | v1 | file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:3757:34:3757:36 | __p |
52
52
| test.cpp:17:27:17:28 | v1 | test.cpp:17:27:17:28 | ref arg v1 |
53
53
| test.cpp:19:6:19:7 | v1 | test.cpp:3:14:3:15 | v1 |
54
- nodes
54
+ nodes
55
55
| file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:2469:31:2469:33 | __p | semmle.label | __p |
56
56
| file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:2469:31:2469:33 | __p | semmle.label | __p |
57
57
| file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:3611:30:3611:32 | __p | semmle.label | __p |
92
92
| test.cpp:17:27:17:28 | v1 | semmle.label | v1 |
93
93
| test.cpp:17:27:17:28 | v1 | semmle.label | v1 |
94
94
| test.cpp:19:6:19:7 | v1 | semmle.label | v1 |
95
- subpaths
95
+ subpaths
96
96
| file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:4065:28:4065:30 | __p | file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:2469:31:2469:33 | __p | file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:2469:31:2469:33 | __p | file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:4065:28:4065:30 | ref arg __p |
97
97
| file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:4068:30:4068:32 | __p | file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:3611:30:3611:32 | __p | file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:3611:30:3611:32 | __p | file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:4068:30:4068:32 | ref arg __p |
98
98
| test.cpp:5:27:5:28 | v1 | file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:3757:34:3757:36 | __p | file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:4063:7:4063:17 | constructor init of field __ptr_ [post-this] [__ptr_] | test.cpp:5:27:5:29 | call to shared_ptr [__ptr_] |
You can’t perform that action at this time.
0 commit comments