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

CodeQL database and QL library incompatibility #19

Closed
SimuPhysics opened this issue Jul 21, 2022 · 4 comments
Closed

CodeQL database and QL library incompatibility #19

SimuPhysics opened this issue Jul 21, 2022 · 4 comments

Comments

@SimuPhysics
Copy link

SimuPhysics commented Jul 21, 2022

I want to do Static Tools Logo Test for a camera driver as a step for Windows Hardware Compatibility Program Certification process.
Following the instruction here: https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/static-tools-and-codeql
I cloned this repository repository.
C:\codeql-home\>git clone https://github.com/microsoft/Windows-Driver-Developer-Supplemental-Tools.git --recursive -b WHCP_21H2
Then I downloaded codeql-win64.zip v2.10.1, and unzipped, and ran this command

c:\codeql-home\codeql\codeql.cmd database create -l=cpp -s=[my driver address]\ -c "msbuild /t:rebuild "[my driver address]\myDriver.sln" /p:configuration="Release" /p:platform="x64" /p:UseSharedCompilation=false" "C:\codeql-home\databases\myDriver" -j 0

Then analyzed it

c:\codeql-home\codeql\codeql.cmd database analyze "C:\codeql-home\databases\myDriver" windows_driver_mustfix.qls --format=sarifv2.1.0 --output=C:\codeql-home\databases\mydriverecho1.sarif -j 0

Then I got this message

Running queries.
Compiling query plan for c:\codeql-home\Windows-Driver-Developer-Supplemental-Tools\codeql\codeql-queries\cpp\ql\src\Likely Bugs\Arithmetic\BadAdditionOverflowCheck.ql.
Compiling upgrade for c:\codeql-home\Windows-Driver-Developer-Supplemental-Tools\codeql\codeql-queries\cpp\ql\src\Likely Bugs\Arithmetic\BadAdditionOverflowCheck.ql
A fatal error occurred: The CodeQL database at databases\VirtualCamera
is not compatible with the QL library Windows-Driver-Developer-Supplemental-Tools\codeql\codeql-queries\cpp\ql\src\Likely Bugs\Arithmetic\BadAdditionOverflowCheck.ql uses.
The database may be too new for the QL libraries the query is using; try upgrading them.
Alternatively, running 'codeql database upgrade databases\VirtualCamera' with an appropriate --search-path option might help.

Then I noticed that the compatible version for codeql-win64.zip v2.6.3. So I deleted everything, and did all previous steps using correct version. I checked the version and it is correct

C:\codeql-home\codeql>codeql version
CodeQL command-line toolchain release 2.6.3.
Copyright (C) 2019-2021 GitHub, Inc.
Unpacked in: C:\codeql-home\codeql
   Analysis results depend critically on separately distributed query and
   extractor modules. To list modules that are visible to the toolchain,
   use 'codeql resolve qlpacks' and 'codeql resolve languages'.

but I get the same error again. I updated the database, and it didn't help

c:\codeql-home\codeql\codeql.cmd database upgrade C:\codeql-home\databases\myDriver
Despite the description in the repository readme file, it seems this code is not compatible with codeql-win64.zip v2.6.3, or sends incorrect error message

@SimuPhysics
Copy link
Author

I asked a colleague to do the steps on his pc, and he installed codeql-win64.zip v2.6.3 from the beginning, and he also got the same error.

@NateD-MSFT
Copy link
Contributor

Thanks for reaching out.

It looks like you were using the WHCP_21H2 branch, which uses version 2.4.6 of the CLI, per that branch's README.md. We are working to update the documentation to be more explicit that old release branches may use older versions of the CLI.

Can you please try again with the 2.4.6 CLI and let us know if that resolves the issue?

@SimuPhysics
Copy link
Author

Thank you, yeah that worked. You'r right, I should have checked the branch readme.

@NateD-MSFT
Copy link
Contributor

No worries - you aren't the first person to hit this error, and we're working to make our documentation more clear on this subject.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants