Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

CON56-CPP QCC Fixes #312

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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import codingstandards.cpp.Concurrency
from LockProtectedControlFlowNode n
where
not isExcluded(n, ConcurrencyPackage::doNotSpeculativelyLockALockedNonRecursiveMutexQuery()) and
// problematic nodes are ones where a lock is active and there is an attempt to
// call a speculative locking function
// problematic nodes are ones where a lock is active and there is an attempt
// to call a speculative locking function
n.(MutexFunctionCall).isSpeculativeLock() and
not n.(MutexFunctionCall).isRecursive() and
n.getAProtectingLock() = n.(MutexFunctionCall).getLock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import codingstandards.cpp.Concurrency
from LockProtectedControlFlowNode n
where
not isExcluded(n, ConcurrencyPackage::lockedALockedNonRecursiveMutexAuditQuery()) and
// problematic nodes are ones where a lock is active and there is an attempt to
// call a speculative locking function
// problematic nodes are ones where a lock is active and there is an attempt
// to call a speculative locking function
n.(MutexFunctionCall).isSpeculativeLock() and
not n.(MutexFunctionCall).isRecursive()
select n, "(Audit) Attempt to speculatively lock a non-recursive mutex while it is $@.",
Expand Down
7 changes: 6 additions & 1 deletion 7 cpp/common/src/codingstandards/cpp/Concurrency.qll
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,14 @@ class LockProtectedControlFlowNode extends ThreadedCFN {
not exists(ControlFlowNode unlock |
// it's an unlock
unlock = getAThreadContextAwarePredecessor(lock, this) and
unlock.(MutexFunctionCall).isUnlock()
unlock.(MutexFunctionCall).isUnlock() and
// note that we don't check that it's the same lock -- this is left
// to the caller to enforce this condition.
// Because of the way that `getAThreadContextAwarePredecessor` works, it is possible
// for operations PAST it to be technically part of the predecessors.
// Thus, we need to make sure that this node is a
// successor of the unlock in the CFG
getAThreadContextAwareSuccessor(unlock) = this
) and
(lock instanceof MutexFunctionCall implies not this.(MutexFunctionCall).isUnlock())
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ edges
| test.cpp:17:27:17:28 | v1 | file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:3757:34:3757:36 | __p |
| test.cpp:17:27:17:28 | v1 | test.cpp:17:27:17:28 | ref arg v1 |
| test.cpp:19:6:19:7 | v1 | test.cpp:3:14:3:15 | v1 |
nodes
nodes
| file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:2469:31:2469:33 | __p | semmle.label | __p |
| file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:2469:31:2469:33 | __p | semmle.label | __p |
| file:///opt/qcc/qnx-sdp/target/qnx7/usr/include/c++/v1/memory:3611:30:3611:32 | __p | semmle.label | __p |
Expand Down Expand Up @@ -92,7 +92,7 @@ edges
| test.cpp:17:27:17:28 | v1 | semmle.label | v1 |
| test.cpp:17:27:17:28 | v1 | semmle.label | v1 |
| test.cpp:19:6:19:7 | v1 | semmle.label | v1 |
subpaths
subpaths
| 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 |
| 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 |
| 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_] |
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.