Code Monkey home page Code Monkey logo

windows-driver-developer-supplemental-tools's Introduction

Windows Driver Developer Supplemental Tools

This repository contains open-source components for supplemental use in developing device drivers for Windows, as well as driver specific CodeQL query suites used for the Windows Hardware Compatibility Program. The quickstart below will get you set up to build your database and analyze your driver using CodeQL. For the full documentation, troubleshooting, and more details about the Static Tools Logo test within the WHCP Program, please visit CodeQL and the Static Tools Logo Test.

For General Use

CodeQL CLI version microsoft/windows-drivers qlpack version codeql/cpp-queries version Associated Repo Branch
2.15.4 latest latest main

For Windows Hardware Compatibility Program Use

Windows Hardware Compatibility Program Release Version Matrix

Release CodeQL CLI version microsoft/windows-drivers qlpack version codeql/cpp-queries version Associated Repo Branch
Windows Server 2022 2.4.6 or 2.15.4 1.0.13 (If using codeql 2.15.4) 0.9.0 (If using codeql 2.15.4) WHCP_21H2
Windows 11 2.4.6 or 2.15.4 1.0.13 (If using codeql 2.15.4) 0.9.0 (If using codeql 2.15.4) WHCP_21H2
Windows 11, version 22H2 2.6.3 or 2.15.4 1.0.13 (If using codeql 2.15.4) 0.9.0 (If using codeql 2.15.4) WHCP_22H2
Windows 11, version 23H2 2.6.3 or 2.15.4 1.0.13 (If using codeql 2.15.4) 0.9.0 (If using codeql 2.15.4) WHCP_22H2
Windows 11, version 24H2 2.15.4 1.1.0 0.9.0 WHCP_24H2

Quickstart

  1. Create a directory where you can place the CodeQL CLI and the queries you want to use:

    D:\> mkdir codeql-home
    
  2. Download the CodeQL CLI zip by selecting the asset associated with your OS and architecture (codeql-win64.zip, codeql-linux64.zip, etc.), then extract it to the directory you created in the previous step.

    NOTE Visual Studio 17.8 broke compatibility with the older versions of CodeQL used in the WHCP_21H2 and WHCP_22H2 branches. CodeQL CLI version 2.15.4 has been validated for use with WHCP 21H2 and WHCP 22H2 when using Visual Studio 17.8 or greater.

    For the WHCP Program, use the CodeQL CLI version in accordance with the table above and Windows release you are certifying for: version 2.4.6, version 2.6.3, or version 2.15.4.

    For general use, use CodeQL CLI version 2.15.4 and the latest version of the microsoft/windows-driver qlpack.

  3. Verify CodeQL is installed correctly by checking the version:

    D:\codeql-home\codeql>codeql --version
    CodeQL command-line toolchain release 2.15.4.
    Copyright (C) 2019-2023 GitHub, Inc.
    Unpacked in: D:\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'.
    
  4. Install CodeQL Packages

    For WHCP_21H2 and WHCP_22H2 branches:

    1. If using Visual Studio 2022 17.8 or greater with WHCP_21H2 or WHCP_22H2 and CodeQL CLI version 2.15.4:

      Follow the steps for "ALL OTHER BRANCHES." Make sure to remove the CodeQL submodule if you still have an old version of the repo cloned. CodeQL might try to use the queries in the submodule by default which will cause errors because of mismatched versions.

    2. If using Visual Studio version 17.7 or below AND either WHCP_21H2 or WHCP_22H2 AND CodeQL VLI version 2.4.6 or 2.6.3:

      Follow special instructions for WHCP_21H2 and WHCP_22H2 using VS17.7 at the end of this readme

    For ALL OTHER BRANCHES:

    Note: It is no longer necessary to clone the Windows-Driver-Developer-Supplemental-Tools repo to use the queries for certification.

    Download the correct version of the CodeQL packs from the Windows Hardware Compatibility Program Release Version Matrix:

    codeql pack download microsoft/windows-drivers@<version>
    
    codeql pack download codeql/cpp-queries@<version>
    

    CodeQL will install the packs to the default directory C:\Users\<current user>\.codeql\packages\microsoft\windows-drivers\<downloaded version>\. Do not change this directory or move the installed pack.

    For examples, if using WHCP_24H2, run the following command to download query the microsoft/windows-drivers pack:

    codeql pack download microsoft/[email protected]
    
  5. Build your CodeQL database:

    D:\codeql-home\codeql>codeql database create <path to new database> --language=cpp --source-root=<driver parent directory> --command=<build command or path to build file>
    

    Single driver example: codeql database create D:\DriverDatabase --language=cpp --source-root=D:\Drivers\SingleDriver --command="msbuild /t:rebuild D:\Drivers\SingleDriver\SingleDriver.sln"

    Multiple drivers example: codeql database create D:\SampleDriversDatabase --language=cpp --source-root=D:\AllMyDrivers\SampleDrivers --command=D:\AllMyDrivers\SampleDrivers\BuildAllSampleDrivers.cmd

    (Parameters: path for your new database, language, driver source directory, build command.)

  6. Analyze your CodeQL database:

    CodeQL's analysis output is provided in the form of a SARIF log file. For a human readable format, drop the SARIF file into SARIF Viewer Website. (If there are violations, they will show up. If not, the page will not update.)

    CodeQL query suites are provided in the suites directory and contain the sets of all recommended and mustfix queries. The desired query suite file should be downloaded/copied locally.

    1. Create a local copy of the desired query suite file:

      • windows_driver_mustfix.qls
      • windows_driver_recommended.qls
    2. To analyze a CodeQL database run the following command:

    codeql database analyze --download <path to database> <path to query suite .qls file> --format=sarifv2.1.0 --output=<outputname>.sarif
    

    NOTE The "--download" flag tells CodeQL to download dependencies before running the queries.

    Specific versions, queries, or suites can be specified using the format codeql database analyze <database> <scope>/<pack>@x.x.x:<path>. For futher information, see the CodeQL documentation.

    Example: codeql database analyze --download D:\DriverDatabase suites/windows_driver_recommended.qls --format=sarifv2.1.0 --output=D:\DriverAnalysis1.sarif

    (Parameters: path to new database, query pack, format, output sarif file)

  7. For WHCP Users Only: Prepare to Create a Driver Verification Log (DVL):

    Before you can create a DVL, you must copy your SARIF log file to the parent directory of your driver project. You can also modify your output location in the codeql database analyze step in order to skip this additional step. Once you have finished this step, please refer to the continued instructions at CodeQL and the Static Tools Logo Test, Driver Verification Log DVL Consumption of SARIF Output.

    D:\codeql-home\codeql>copy <path to SARIF output file> <path to driver directory>
    

    Example: D:\codeql-home\codeql> copy D:\DriverAnalysis1.sarif D:\Drivers\SingleDriver

Navigation

Windows drivers queries are in the src/drivers directory.

Non-driver Microsoft-specific queries provided by Microsoft are in the src/microsoft directory.

Query suites are located in the suites directory and contain the Must-Fix and Recommended-Fix suites used by the WHCP Program.

Contributing

This project welcomes contributions, feedback, and suggestions!

We are in the process of setting up pull request checks, but to ensure our requirements are met, please ensure the following are complete with your pull request:

  1. Pull request description contains a concise summary of what changes are being introduced.
  2. Only one query or query group are introduced per pull request.
  3. If there are changes to an existing query, increase its version (found in the comments at the top of the query file '@version').
  4. Run all unit tests.
  5. Run codeql database create and codeql database analyze successfully on a valid driver before merging.
  6. Add a .qhelp file for any new queries or update the existing one if there is new functionality for the end user.

Note

All "Must-Fix" suite queries must have been run on the Windows Drivers Samples, and any bugs found as a result must be filed prior to being merged into the suite.

Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Special instructions for WHCP_21H2 and WHCP_22H2 using VS17.7 or below

These instructions only apply when using both Visual Studio 17.7 or below along with CodeQL 2.6.3 or 2.4.6

  1. Install CodeQL version as indicated in above steps.

  2. Clone and install the Windows Driver Developer Supplemental Tools repository which contains the CodeQL queries specific for drivers:

    git clone https://github.com/microsoft/Windows-Driver-Developer-Supplemental-Tools.git --recurse-submodules
    
     Now you should have:
    
     D:/codeql-home
         |--- codeql
         |--- Windows-Driver-Developer-Supplemental-Tools
    
  3. Analyze your CodeQL database

    codeql database analyze <path to database> --format=sarifv2.1.0 --output=<"path to output file".sarif> <path to query/suite to run>
    

    Example: codeql database analyze D:\DriverDatabase --format=sarifv2.1.0 --output=D:\DriverAnalysis1.sarif D:\codeql-home\Windows-driver-developer-supplemental-tools\src\suites\windows_driver_mustfix.qls

    (Parameters: path to new database, format, output sarif file, path to CodeQL query or query suite to use in analysis.)

    Note: Be sure to check the path to the suite or query you want to run, not every branch has the same file structure.

windows-driver-developer-supplemental-tools's People

Contributors

finchnest avatar hmakholm avatar jacob-ronstadt avatar lauragonzalezzz avatar microsoftopensource avatar nated-msft avatar raulgarciamsft avatar rozmansi avatar scaramushe avatar t-abtamene avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

windows-driver-developer-supplemental-tools's Issues

StaticToolsLogo test : DVL file format incorrect, using branch WHPC 21H2

I am doing StaticToolsLogo Test, using CodeQL CLI v2.4.6 and Windows-Driver-Developer-Supplemental-Tools (branch WHPC 21H2).
After put log file into C:\DVL*.DVL.XML, I got test error information :
DVL test failed:
DVL file format incorrect(
*.x64.Semmle.Summary).

Is it because my HLK version is too old to recognize the DVL file format?
Which branch should i use, to pass StaticToolsLogo test in HLK (VHLK) for Windows 10, version 2004 ?


My HLK enviroment is:
HLK version:Virtual HLK (VHLK) for Windows 10, version 2004
driver works on :Windows 10, version 21H2

My develop enviroment is:
VS2022
Windows 11, version 22H2 WDK(10.0.22621.382)
Windows 11, version 22H2 SDK(10.1.22621.755)

Suppression library needs to account for special cases

The suppression library still needs to account for the following special cases:

#pragma prefast(suppress : 28720)
    strcpy(dst, src); // Need to respect all suppressions that are on consecutive lines
#pragma prefast(suppress : 28720 28719)
    strcpy(dst, src); // Need to respect all suppressions that are listed on a single line
#pragma prefast(disable : 28719)
    strcpy(dst, src); // Need to respect disable suppressions outside of pragma push/pops

"database may be too new" error

I am trying to run these queries for an HLK submission. I have tried CodeQL versions 2.6.3 (the one mentioned on this repo) and 2.9.3 (the latest available) and both successfully create a database using this command:

codeql.cmd database create -l=cpp -s="" -c "msbuild /p:Configuration=Release /p:Platform=x64 /t:rebuild /p:PostBuildEventUseInBuild=false " "" -j 0

But then when I run the second step to do the analysis I get an error

codeql.cmd database analyze "" "\Windows-Driver-Developer-Supplemental-Tools\codeql\codeql-queries\cpp\ql\src\Likely Bugs" --format=sarifv2.1.0 --output= -j 0 --rerun
Running queries.
Compiling query plan for \Windows-Driver-Developer-Supplemental-Tools\codeql\codeql-queries\cpp\ql\src\Likely Bugs\AmbiguouslySignedBitField.ql.
Compiling upgrade for \Windows-Driver-Developer-Supplemental-Tools\codeql\codeql-queries\cpp\ql\src\Likely Bugs\AmbiguouslySignedBitField.ql
A fatal error occurred: The CodeQL database at \databases\foo
is not compatible with the QL library \Windows-Driver-Developer-Supplemental-Tools\codeql\codeql-queries\cpp\ql\src\Likely Bugs\AmbiguouslySignedBitField.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\foo' with an appropriate --search-path option might help.

I tried the suggested database upgrade command but it reported already up to date. I've never used codeql before so I'm not sure how to move forward on this but I have an urgent timeline on getting this HLK package submitted.

The Readme provides a misguiding information regarding the required CLI version

When reading the Readme for the 1st time (and 2nd and 3rd :) ), it seems that the required CLI version is 2.6.3 but it fails with the release branch (WHCP_21H2) .
Looking around the web, it seems that the correct version is in the WHCP_21H2 readme file - 2.4.6
This was mentioned in #19 but it still persists and wastes time so it'd be nice to fix it :)

PaddingByteInformationDisclosure reports false pasitive

In order to satisfy cpp/windows/wdk/deprecated-api we replaced
ExAllocatePoolWithTag by ExAllocatePoolZero and declared macro POOL_ZERO_DOWN_LEVEL_SUPPORT for compilation as code must run downlevel.

However memory is zeroed during allocation now we see false positive
Warning SM02320: Memory allocation of [MyStruct](1) includes uninitialized padding bytes.

Here is example of code

typedef enum { Unknown = 0, Known = 1, Other = 2 } MyStructType;
struct MyStruct { MyStructType type; UINT64 id; };
MyStruct* testReturn()
{
	MyStruct* myBadStackStruct = (MyStruct*)ExAllocatePoolZero(NonPagedPool, sizeof(MyStruct), 'MSFT');
	return myBadStackStruct;
}

Install pack using codeql 2.4.6

Accorrding to docs if you are using Windows Server 2022 it is better to use codeql 2.4.6
but in the stage number 5 which refer to install the pack it fails because codeql before v2.6.0 doesn't support pack installing

Randomly happens com.semmle.util.exception.CatastrophicError: End of file found while looking for '.pop' with a C++ project

The symptom is pretty much the same with github/codeql#9929 but the issue does not happen 100% of the time.

CodeQL CLI version: 2.6.3
CodeQL queries version: lgtm/1.29.0
Windows Driver Developer Supplemental Tools version: WHCP_22H2

Finalizing database at C:\Users\user\workspace\ipu-cam-drv-ice-master\camerasw\bins\Release.x64\CodeQL\Database.
ipu_device_ff_properties_impl.h.4f534201.trap (pg_187_control_init.c.86ad7c77_0.trap.tar.br) for 2 link targets, 1605: java.io.IOException: Brotli stream decoding failed
org.brotli.dec.BrotliInputStream.read(BrotliInputStream.java:151)
org.apache.commons.compress.archivers.tar.TarArchiveInputStream.read(TarArchiveInputStream.java:608)
java.base/java.io.FilterInputStream.read(Unknown Source)
com.semmle.inmemory.trap.TrapInputStream.read(TrapInputStream.java:61)
com.semmle.inmemory.trap.TrapScanner.fill(TrapScanner.java:507)
com.semmle.inmemory.trap.TrapScanner.ensureNext(TrapScanner.java:484)
com.semmle.inmemory.trap.TrapScanner.identOrLabelRest(TrapScanner.java:171)
com.semmle.inmemory.trap.TrapScanner.nextToken(TrapScanner.java:123)
com.semmle.inmemory.trap.TRAPReader.scanTuplesAndLabels(TRAPReader.java:491)
com.semmle.inmemory.trap.TRAPReader.importTuples(TRAPReader.java:423)
com.semmle.inmemory.trap.ImportTasksProcessor.process(ImportTasksProcessor.java:191)
com.semmle.inmemory.trap.ImportTasksProcessor.lambda$null$1(ImportTasksProcessor.java:151)
com.semmle.util.concurrent.FutureUtils.lambda$null$8(FutureUtils.java:136)
java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.base/java.lang.Thread.run(Unknown Source)

 ... caused by:

org.brotli.dec.BrotliRuntimeException: Invalid backward reference
org.brotli.dec.Decode.decompress(Decode.java:887)
org.brotli.dec.BrotliInputStream.read(BrotliInputStream.java:145)
org.apache.commons.compress.archivers.tar.TarArchiveInputStream.read(TarArchiveInputStream.java:608)
java.base/java.io.FilterInputStream.read(Unknown Source)
com.semmle.inmemory.trap.TrapInputStream.read(TrapInputStream.java:61)
com.semmle.inmemory.trap.TrapScanner.fill(TrapScanner.java:507)
com.semmle.inmemory.trap.TrapScanner.ensureNext(TrapScanner.java:484)
com.semmle.inmemory.trap.TrapScanner.identOrLabelRest(TrapScanner.java:171)
com.semmle.inmemory.trap.TrapScanner.nextToken(TrapScanner.java:123)
com.semmle.inmemory.trap.TRAPReader.scanTuplesAndLabels(TRAPReader.java:491)
com.semmle.inmemory.trap.TRAPReader.importTuples(TRAPReader.java:423)
com.semmle.inmemory.trap.ImportTasksProcessor.process(ImportTasksProcessor.java:191)
com.semmle.inmemory.trap.ImportTasksProcessor.lambda$null$1(ImportTasksProcessor.java:151)
com.semmle.util.concurrent.FutureUtils.lambda$null$8(FutureUtils.java:136)
java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.base/java.lang.Thread.run(Unknown Source)
program_psa_out_s2v_dma_control_init.c.e495e4e7.trap (program_psa_out_s2v_dma_control_init.c.e495e4e7_0.trap.tar.br) for 2 link targets, 3669: java.io.IOException: Brotli stream decoding failed
org.brotli.dec.BrotliInputStream.read(BrotliInputStream.java:151)
org.apache.commons.compress.archivers.tar.TarArchiveInputStream.read(TarArchiveInputStream.java:608)
java.base/java.io.FilterInputStream.read(Unknown Source)
com.semmle.inmemory.trap.TrapInputStream.read(TrapInputStream.java:61)
com.semmle.inmemory.trap.TrapScanner.fill(TrapScanner.java:507)
com.semmle.inmemory.trap.TrapScanner.ensureNext(TrapScanner.java:484)
com.semmle.inmemory.trap.TrapScanner.stringBody(TrapScanner.java:191)
com.semmle.inmemory.trap.TrapScanner.string(TrapScanner.java:224)
com.semmle.inmemory.trap.TrapScanner.nextToken(TrapScanner.java:119)
com.semmle.inmemory.trap.TRAPReader.scanLabelValue(TRAPReader.java:790)
com.semmle.inmemory.trap.TRAPReader.scanTuplesAndLabels(TRAPReader.java:503)
com.semmle.inmemory.trap.TRAPReader.importTuples(TRAPReader.java:423)
com.semmle.inmemory.trap.ImportTasksProcessor.process(ImportTasksProcessor.java:191)
com.semmle.inmemory.trap.ImportTasksProcessor.lambda$null$1(ImportTasksProcessor.java:151)
com.semmle.util.concurrent.FutureUtils.lambda$null$8(FutureUtils.java:136)
java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.base/java.lang.Thread.run(Unknown Source)

 ... caused by:

org.brotli.dec.BrotliRuntimeException: Corrupted padding bits
org.brotli.dec.BitReader.jumpToByteBoundary(BitReader.java:178)
org.brotli.dec.Decode.decompress(Decode.java:1004)
org.brotli.dec.BrotliInputStream.read(BrotliInputStream.java:145)
org.apache.commons.compress.archivers.tar.TarArchiveInputStream.read(TarArchiveInputStream.java:608)
java.base/java.io.FilterInputStream.read(Unknown Source)
com.semmle.inmemory.trap.TrapInputStream.read(TrapInputStream.java:61)
com.semmle.inmemory.trap.TrapScanner.fill(TrapScanner.java:507)
com.semmle.inmemory.trap.TrapScanner.ensureNext(TrapScanner.java:484)
com.semmle.inmemory.trap.TrapScanner.stringBody(TrapScanner.java:191)
com.semmle.inmemory.trap.TrapScanner.string(TrapScanner.java:224)
com.semmle.inmemory.trap.TrapScanner.nextToken(TrapScanner.java:119)
com.semmle.inmemory.trap.TRAPReader.scanLabelValue(TRAPReader.java:790)
com.semmle.inmemory.trap.TRAPReader.scanTuplesAndLabels(TRAPReader.java:503)
com.semmle.inmemory.trap.TRAPReader.importTuples(TRAPReader.java:423)
com.semmle.inmemory.trap.ImportTasksProcessor.process(ImportTasksProcessor.java:191)
com.semmle.inmemory.trap.ImportTasksProcessor.lambda$null$1(ImportTasksProcessor.java:151)
com.semmle.util.concurrent.FutureUtils.lambda$null$8(FutureUtils.java:136)
java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.base/java.lang.Thread.run(Unknown Source)
Oops! A fatal internal error occurred.
com.semmle.util.exception.CatastrophicError: End of file found while looking for '.pop'.
	at com.semmle.inmemory.trap.TRAPReader.importTuples(TRAPReader.java:435)
	at com.semmle.inmemory.trap.ImportTasksProcessor.process(ImportTasksProcessor.java:191)
	at com.semmle.inmemory.trap.ImportTasksProcessor.lambda$null$1(ImportTasksProcessor.java:151)
	at com.semmle.util.concurrent.FutureUtils.lambda$null$8(FutureUtils.java:136)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

github/codeql#11586

CodeQL database and QL library incompatibility

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

Referenced pack not found

I was following the quickstart section of the readme and at step 7 (analyzing the codeQL database), I get the following failure.

$ ./codeql database analyze ../DriverDatabase --format=sarifv2.1.0 --output=../DriverAnalysis1.sarif ../Windows-Driver-Developer-Supplemental-Tools/src/suites/windows_driver_mustfix.qls
Running queries.
ERROR: Referenced pack 'codeql/cpp-all' not found. (C:\Users\Eyad\.codeql\packages\codeql\cpp-queries\0.2.0\qlpack.yml:1,1-1)
ERROR: Referenced pack 'codeql/suite-helpers' not found. (C:\Users\Eyad\.codeql\packages\codeql\cpp-queries\0.2.0\qlpack.yml:1,1-1)
A fatal error occurred: Could not resolve library path for C:\Users\Eyad\.codeql\packages\codeql\cpp-queries\0.2.0

Up until that steps, every step was successful. I checked for the existence of codeql/cpp-all and codeql/suite-helpers myself and they do in fact exist at C:\Users\Eyad\.codeql\packages\codeql\, which has cpp-all, cpp-queries and suite-helpers in it (and nothing else).

I use the v2.6.3 binaries.

Any ideas?

EDIT: Update: I tried redoing the entire quickstart guide but using the binaries corresponding to latest / main and it worked fine. What gives?

Add driver suppression query to standard query sets

To make it easier for developers to suppress false positives or noisy results, we should add our DriverAlertSuppression.ql query to all our query suites. Thus it will automatically run and detect suppressions when someone runs our suites.

Note that suppressions do not have an impact on the DVL generated for the Static Tools Logo test; at this time they are purely for convenience and to help triage results.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.