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

Already on GitHub? Sign in to your account

CON56-CPP QCC Fixes #312

Merged
merged 7 commits into from
May 30, 2023
Merged

CON56-CPP QCC Fixes #312

merged 7 commits into from
May 30, 2023

Conversation

jsinglet
Copy link
Contributor

@jsinglet jsinglet commented May 26, 2023

Description

CON56-CPP: Fixes issues with compiler compatibility with QCC.
MEM56-CPP A20-8-1: Fix typo in expected file

Change request type

  • Release or process automation (GitHub workflows, internal scripts)
  • Internal documentation
  • External documentation
  • Query files (.ql, .qll, .qls or unit tests)
  • External scripts (analysis report or other code shipped as part of a release)

Rules with added or modified queries

  • No rules added
  • Queries have been added for the following rules:
    • rule number here
  • Queries have been modified for the following rules:
    • CON56-CPP

Release change checklist

A change note (development_handbook.md#change-notes) is required for any pull request which modifies:

  • The structure or layout of the release artifacts.
  • The evaluation performance (memory, execution time) of an existing query.
  • The results of an existing query in any circumstance.

If you are only adding new rule queries, a change note is not required.

Author: Is a change note required?

  • Yes
  • No

馃毃馃毃馃毃
Reviewer: Confirm that format of shared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.

  • Confirmed

Reviewer: Confirm that either a change note is not required or the change note is required and has been added.

  • Confirmed

Query development review checklist

For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:

Author

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

Reviewer

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

@jsinglet
Copy link
Contributor Author

/test-matrix

@github-actions
Copy link

馃 Beep Boop! Matrix Testing for this PR has been initiated. Please check back later for results.

馃挕 If you do not hear back from me please check my status! I will report even if this PR does not contain files eligible for matrix testing.

@jsinglet
Copy link
Contributor Author

馃 Beep Boop! gcc/c/X86_64 Matrix Testing for this PR has been completed but I didn't find anything to test!

@jsinglet
Copy link
Contributor Author

馃 Beep Boop! clang/cpp/X86_64 Matrix Testing for this PR has been completed. See below for the results!


COMPILE_PASS         : True
QUERY                : LockedALockedNonRecursiveMutexAudit
COMPILE_ERROR_OUTPUT : 
TEST_PASS            : False
PACKAGE              : Concurrency
RULE                 : CON56-CPP
TEST_DIFFERENCE      : --- expected
                       +++ actual
                       @@ -1,3 +1,2 @@
                       -| test.cpp:7:13:7:20 | call to try_lock | (Audit) Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:12:34:12:35 | call to lock_guard | already locked |
                        | test.cpp:7:13:7:20 | call to try_lock | (Audit) Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:59:5:59:8 | call to lock | already locked |
                        | test.cpp:7:13:7:20 | call to try_lock | (Audit) Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:64:5:64:8 | call to lock | already locked |
                       [1/1 comp 31.5s eval 2.3s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/cpp/cert/test/rules/CON56-CPP/LockedALockedNonRecursiveMutexAudit.qlref
                       
SUITE                : CERT-C++

COMPILE_PASS         : True
QUERY                : DoNotSpeculativelyLockALockedNonRecursiveMutex
COMPILE_ERROR_OUTPUT : 
TEST_PASS            : False
PACKAGE              : Concurrency
RULE                 : CON56-CPP
TEST_DIFFERENCE      : --- expected
                       +++ actual
                       @@ -1,3 +1,2 @@
                       -| test.cpp:7:13:7:20 | call to try_lock | Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:12:34:12:35 | call to lock_guard | already locked |
                        | test.cpp:7:13:7:20 | call to try_lock | Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:59:5:59:8 | call to lock | already locked |
                        | test.cpp:7:13:7:20 | call to try_lock | Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:64:5:64:8 | call to lock | already locked |
                       [1/1 comp 30.5s eval 3.5s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/cpp/cert/test/rules/CON56-CPP/DoNotSpeculativelyLockALockedNonRecursiveMutex.qlref
                       
SUITE                : CERT-C++


@jsinglet
Copy link
Contributor Author

馃 Beep Boop! clang/c/X86_64 Matrix Testing for this PR has been completed but I didn't find anything to test!

@jsinglet
Copy link
Contributor Author

馃 Beep Boop! gcc/cpp/X86_64 Matrix Testing for this PR has been completed. See below for the results!


TEST_DIFFERENCE      : --- expected
                       +++ actual
                       @@ -1,3 +1,2 @@
                       -| test.cpp:7:13:7:20 | call to try_lock | (Audit) Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:12:34:12:35 | call to lock_guard | already locked |
                        | test.cpp:7:13:7:20 | call to try_lock | (Audit) Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:59:5:59:8 | call to lock | already locked |
                        | test.cpp:7:13:7:20 | call to try_lock | (Audit) Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:64:5:64:8 | call to lock | already locked |
                       [1/1 comp 30.4s eval 2.3s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/cpp/cert/test/rules/CON56-CPP/LockedALockedNonRecursiveMutexAudit.qlref
                       
PACKAGE              : Concurrency
RULE                 : CON56-CPP
COMPILE_PASS         : True
SUITE                : CERT-C++
QUERY                : LockedALockedNonRecursiveMutexAudit
TEST_PASS            : False
COMPILE_ERROR_OUTPUT : 

TEST_DIFFERENCE      : --- expected
                       +++ actual
                       @@ -1,3 +1,2 @@
                       -| test.cpp:7:13:7:20 | call to try_lock | Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:12:34:12:35 | call to lock_guard | already locked |
                        | test.cpp:7:13:7:20 | call to try_lock | Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:59:5:59:8 | call to lock | already locked |
                        | test.cpp:7:13:7:20 | call to try_lock | Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:64:5:64:8 | call to lock | already locked |
                       [1/1 comp 29.8s eval 3.4s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/cpp/cert/test/rules/CON56-CPP/DoNotSpeculativelyLockALockedNonRecursiveMutex.qlref
                       
PACKAGE              : Concurrency
RULE                 : CON56-CPP
COMPILE_PASS         : True
SUITE                : CERT-C++
QUERY                : DoNotSpeculativelyLockALockedNonRecursiveMutex
TEST_PASS            : False
COMPILE_ERROR_OUTPUT : 


@jsinglet
Copy link
Contributor Author

馃 Beep Boop! qcc/cpp/AARCH64LE Matrix Testing for this PR has been completed. See below for the results!


COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : --- expected
                       +++ actual
                       @@ -1,3 +1,2 @@
                       -| test.cpp:7:13:7:20 | call to try_lock | (Audit) Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:12:34:12:35 | call to lock_guard | already locked |
                        | test.cpp:7:13:7:20 | call to try_lock | (Audit) Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:59:5:59:8 | call to lock | already locked |
                        | test.cpp:7:13:7:20 | call to try_lock | (Audit) Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:64:5:64:8 | call to lock | already locked |
                       [1/1 comp 30.9s eval 2.5s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/cpp/cert/test/rules/CON56-CPP/LockedALockedNonRecursiveMutexAudit.qlref
                       
PACKAGE              : Concurrency
TEST_PASS            : False
COMPILE_PASS         : True
QUERY                : LockedALockedNonRecursiveMutexAudit
RULE                 : CON56-CPP
SUITE                : CERT-C++

COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : --- expected
                       +++ actual
                       @@ -1,3 +1,2 @@
                       -| test.cpp:7:13:7:20 | call to try_lock | Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:12:34:12:35 | call to lock_guard | already locked |
                        | test.cpp:7:13:7:20 | call to try_lock | Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:59:5:59:8 | call to lock | already locked |
                        | test.cpp:7:13:7:20 | call to try_lock | Attempt to speculatively lock a non-recursive mutex while it is $@. | test.cpp:64:5:64:8 | call to lock | already locked |
                       [1/1 comp 30.3s eval 3.7s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/cpp/cert/test/rules/CON56-CPP/DoNotSpeculativelyLockALockedNonRecursiveMutex.qlref
                       
PACKAGE              : Concurrency
TEST_PASS            : False
COMPILE_PASS         : True
QUERY                : DoNotSpeculativelyLockALockedNonRecursiveMutex
RULE                 : CON56-CPP
SUITE                : CERT-C++


@jsinglet
Copy link
Contributor Author

馃 Beep Boop! qcc/c/AARCH64LE Matrix Testing for this PR has been completed but I didn't find anything to test!

@jsinglet
Copy link
Contributor Author

馃 Beep Boop! Matrix Testing for this PR has been completed. If no reports were posted it means this PR does not contain things that need matrix testing!

@jsinglet jsinglet requested a review from mbaluda May 26, 2023 23:29
@jsinglet
Copy link
Contributor Author

/test-matrix

@github-actions
Copy link

馃 Beep Boop! Matrix Testing for this PR has been initiated. Please check back later for results.

馃挕 If you do not hear back from me please check my status! I will report even if this PR does not contain files eligible for matrix testing.

@jsinglet
Copy link
Contributor Author

/test-matrix

@github-actions
Copy link

馃 Beep Boop! Matrix Testing for this PR has been initiated. Please check back later for results.

馃挕 If you do not hear back from me please check my status! I will report even if this PR does not contain files eligible for matrix testing.

@jsinglet
Copy link
Contributor Author

馃 Beep Boop! qcc/cpp/AARCH64LE Matrix Testing for this PR won't happen because it is outside of license window!

@jsinglet
Copy link
Contributor Author

馃 Beep Boop! clang/c/X86_64 Matrix Testing for this PR has been completed but I didn't find anything to test!

@jsinglet
Copy link
Contributor Author

馃 Beep Boop! gcc/cpp/X86_64 Matrix Testing for this PR has been completed. See below for the results!


COMPILE_PASS         : True
RULE                 : CON56-CPP
TEST_DIFFERENCE      : 
TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
QUERY                : DoNotSpeculativelyLockALockedNonRecursiveMutex
PACKAGE              : Concurrency
SUITE                : CERT-C++

COMPILE_PASS         : True
RULE                 : CON56-CPP
TEST_DIFFERENCE      : 
TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
QUERY                : LockedALockedNonRecursiveMutexAudit
PACKAGE              : Concurrency
SUITE                : CERT-C++


@jsinglet
Copy link
Contributor Author

馃 Beep Boop! qcc/cpp/AARCH64LE Matrix Testing for this PR won't happen because it is outside of license window!

@jsinglet
Copy link
Contributor Author

馃 Beep Boop! gcc/c/X86_64 Matrix Testing for this PR has been completed but I didn't find anything to test!

@jsinglet
Copy link
Contributor Author

馃 Beep Boop! qcc/c/AARCH64LE Matrix Testing for this PR won't happen because it is outside of license window!

@jsinglet
Copy link
Contributor Author

馃 Beep Boop! gcc/c/X86_64 Matrix Testing for this PR has been completed but I didn't find anything to test!

@jsinglet
Copy link
Contributor Author

馃 Beep Boop! qcc/c/AARCH64LE Matrix Testing for this PR won't happen because it is outside of license window!

@jsinglet
Copy link
Contributor Author

馃 Beep Boop! clang/cpp/X86_64 Matrix Testing for this PR has been completed. See below for the results!


COMPILE_PASS         : True
PACKAGE              : Concurrency
TEST_PASS            : True
RULE                 : CON56-CPP
TEST_DIFFERENCE      : 
COMPILE_ERROR_OUTPUT : 
SUITE                : CERT-C++
QUERY                : LockedALockedNonRecursiveMutexAudit

COMPILE_PASS         : True
PACKAGE              : Concurrency
TEST_PASS            : True
RULE                 : CON56-CPP
TEST_DIFFERENCE      : 
COMPILE_ERROR_OUTPUT : 
SUITE                : CERT-C++
QUERY                : DoNotSpeculativelyLockALockedNonRecursiveMutex


@jsinglet
Copy link
Contributor Author

馃 Beep Boop! clang/c/X86_64 Matrix Testing for this PR has been completed but I didn't find anything to test!

@jsinglet
Copy link
Contributor Author

馃 Beep Boop! Matrix Testing for this PR has been completed. If no reports were posted it means this PR does not contain things that need matrix testing!

@jsinglet
Copy link
Contributor Author

馃 Beep Boop! gcc/cpp/X86_64 Matrix Testing for this PR has been completed. See below for the results!


PACKAGE              : Concurrency
TEST_DIFFERENCE      : 
COMPILE_ERROR_OUTPUT : 
QUERY                : DoNotSpeculativelyLockALockedNonRecursiveMutex
TEST_PASS            : True
COMPILE_PASS         : True
SUITE                : CERT-C++
RULE                 : CON56-CPP

PACKAGE              : Concurrency
TEST_DIFFERENCE      : 
COMPILE_ERROR_OUTPUT : 
QUERY                : LockedALockedNonRecursiveMutexAudit
TEST_PASS            : True
COMPILE_PASS         : True
SUITE                : CERT-C++
RULE                 : CON56-CPP


@jsinglet
Copy link
Contributor Author

馃 Beep Boop! clang/cpp/X86_64 Matrix Testing for this PR has been completed. See below for the results!


TEST_DIFFERENCE      : 
QUERY                : DoNotSpeculativelyLockALockedNonRecursiveMutex
RULE                 : CON56-CPP
COMPILE_PASS         : True
TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
SUITE                : CERT-C++
PACKAGE              : Concurrency

TEST_DIFFERENCE      : 
QUERY                : LockedALockedNonRecursiveMutexAudit
RULE                 : CON56-CPP
COMPILE_PASS         : True
TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
SUITE                : CERT-C++
PACKAGE              : Concurrency


@jsinglet
Copy link
Contributor Author

馃 Beep Boop! Matrix Testing for this PR has been completed. If no reports were posted it means this PR does not contain things that need matrix testing!

Copy link
Contributor

@mbaluda mbaluda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!
Optionally, consider simplifying the comment

cpp/common/src/codingstandards/cpp/Concurrency.qll Outdated Show resolved Hide resolved
Co-authored-by: Mauro Baluda <mbaluda@github.com>
@jsinglet jsinglet enabled auto-merge May 30, 2023 13:19
@jsinglet jsinglet added this pull request to the merge queue May 30, 2023
Merged via the queue into main with commit dbba388 May 30, 2023
17 checks passed
@jsinglet jsinglet deleted the jsinglet/CON56-CPP-QCC branch May 30, 2023 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants