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

Update main with latest changes #109

Merged
merged 11 commits into from
Jan 25, 2024
Merged

Update main with latest changes #109

merged 11 commits into from
Jan 25, 2024

Conversation

jacob-ronstadt
Copy link
Contributor

Checklist for Pull Requests

Merge development branch into main

  • Description is filled out.
  • Only one query or related query group is in this pull request.
  • The version number on changed queries has been increased via the @version comment in the file header.
  • All unit tests have been run: (Test README.md).
  • Commands codeql database create and codeql database analyze have completed successfully.
  • A .qhelp file has been added for any new queries or updated if changes have been made to an existing query.

jacob-ronstadt and others added 10 commits December 1, 2023 13:39
* WIP. TODO fix duplicate results

* fix global tracking

* fix query to find instances where created variable not freed

* minor updates

* update other files for query

* updates for pull request changes. also needed to move the invlude of driver_snippet.c to be the first include in fail_driver1.c so that ntifs.h could be included in driver_snippet.c without errors

---------

Co-authored-by: NateD-MSFT <[email protected]>
* codeql port of code analysis rule C28127

* update query. add to unit test for query

* fix query

* fix query

* fix query

* Query improved. Update supporting files

* detect all issues in unit tests but detect false positives in internal driver tests

* less false positives

* query now passes unit tests and internal testing false positives are greatly reduced

* add expected sarif

* improve query to also check parameters match for given function pointer and function's expected function pointer argument. Disregard explicit casts

* update version. update results sarif and diff

* update qlhelp file

* update diff

* fix comments in driver_snippet.c. remove unused part of query
* WIP. TODO fix duplicate results

* fix global tracking

* fix query to find instances where created variable not freed

* minor updates

* update other files for query

* updates for pull request changes. also needed to move the invlude of driver_snippet.c to be the first include in fail_driver1.c so that ntifs.h could be included in driver_snippet.c without errors

* update build_create_analyze_test.cmd to use msbuild configuration to allow different project configurations for different tests. Revert fail_driver1.c to fix build issues caused by previous change

* remove previously added VS project configuration. Use preprocessor definition project property instead.

---------

Co-authored-by: NateD-MSFT <[email protected]>
* WIP: update test script to python

* improve script

* improve script. add multithreading

* add timer
* WIP: update test script to python

* improve script

* improve script. add multithreading

* add timer

* update script. add support for useNTIFS option

* update test script output and warn about multithreaded mode not being final

* bug fix

* update multithreading to limit number of threads so codeql doesnt run out of memory
* Initial work at IRQL-checking

* Significant extra IRQL work.

* In-progress work

* More puttering around with IRQL

* Update to CodeQL 2.14.4

Update cpp-all to 0.9.2, cpp-queries to 0.7.4

* Commit more IRQL code.  Needs cleanup.

* Some cleanup and minor fixes to entry IRQL evaluation.

* Replace old Irql high/low checks with new version and update library.

Still needs cleanup.

* Irql.qll cleanup

* Get rid of old prototype version of IrqlTooLow

* Update README.md

* Clean up file names

* Clean up queries.

* Update test script for IRQL queries.

* Update build-codeql.yaml

Signed-off-by: NateD-MSFT <[email protected]>

* Update ported_driver_ca_checks.qls

* Add IrqlSetTooHigh/IrqlSetTooLow queries.

* Bugfix for IrqlTooHigh/IrqlTooLow

The changes to Irql.qll needed for IrqlSetTooHigh, etc. means we are more likely to see IRQL evaluations that return -1.  Update queries to exclude those numbers.

* Fix test issues for several IRQL checks.

* WIP unit tests for IrqlSetTooHigh and IrqlSetTooLow queries

* WIP unit tests for IrqlSetTooHigh and IrqlSetTooLow queries

* WIP more tests and comments

* bug fixes

* WIP updates to tests

* WIP update tests

* remove bad tests. Fix run script to run all tests again. run script now cleans first automatically.

* update tests for IrqlSetTooHigh

* WIP IrqlSetTooLow tests

* Fix typo in Irql.qll

* irqlSetTooHigh tests remove calls to KeGetCurrentIRQL as they are not needed

* update IrqlSetTooLow tests

* update tests. line 90 should be a failling test but isnt

* fix IrqlLowerWithFunctionCall1 to call IrqlMinDispatchLowerIrql_fail1

* Revert"fix IrqlLowerWithFunctionCall1 to call IrqlMinDispatchLowerIrql_fail1"

This reverts commit fd9084b.

* fix IrqlLowerWithFunctionCall1 to call IrqlMinDispatchLowerIrql_fail1

* add WDF function class and structure class

* add kmdf callback functions

* syntax updates

* add comments

* Expand WdmDrivers.qll. Add missing WDM Callback Routine types and Role Type class

* WIP query to check role types

* queries for implicit and explicit role types

* move implicit role type query to library as a class

* update wdmdrivers.qll

* RoleTypeCorrectlyUsed query

* WIP

* update query

* WIP updating wdmdrivers.qll to better define role type functions

* update query message

* adding KMDF support for role types

* updates to role type query for kmdf and wdm

* move wdm role type query to wdm folder

* WIP library for NDIS

* WIP NDIS role type query

* WIP storport library

* WIP storport query

* add irql level to wdm role types

* create generic RoleTypes library to include wdm, kmdf, ndis, and storport

* generic role type query

* add function annotation role types. Add extra role types from wdfroletypes.h

* ignore c++ functions for now until codeql issue figured out

* update role type query to remove double results

* update role type query

* update sarif results, diff, and test script

* fix conflict in WdmDrivers.qll

* remove irql level from role type library due to conflict

* fix WdmDrivers.qll

* fix wdmdrivers.qll

* remove irql library from wdmdrivers.qll

* remove old/unused role type queries

* Update src/drivers/storport/libraries/StorportDrivers.qll

Co-authored-by: NateD-MSFT <[email protected]>
Signed-off-by: Jacob Ronstadt <[email protected]>

* Update src/drivers/storport/libraries/StorportDrivers.qll

Co-authored-by: NateD-MSFT <[email protected]>
Signed-off-by: Jacob Ronstadt <[email protected]>

* Update src/drivers/storport/libraries/StorportDrivers.qll

Co-authored-by: NateD-MSFT <[email protected]>
Signed-off-by: Jacob Ronstadt <[email protected]>

* Update src/drivers/storport/libraries/StorportDrivers.qll

Co-authored-by: NateD-MSFT <[email protected]>
Signed-off-by: Jacob Ronstadt <[email protected]>

* Update src/drivers/storport/libraries/StorportDrivers.qll

Co-authored-by: NateD-MSFT <[email protected]>
Signed-off-by: Jacob Ronstadt <[email protected]>

* fix issue causing problems with diffs

* changes for pull request

---------

Signed-off-by: NateD-MSFT <[email protected]>
Signed-off-by: Jacob Ronstadt <[email protected]>
Co-authored-by: NateD-MSFT <[email protected]>
* update codeql pack versions

* update readme with new codeql version
* script updates

* update build script with option to run queries on existing database. Add requirements.txt for installing dependencies

* remove need to clean.cmd and add --no_clean flag to script. add comments

* WIP adding excel output functionality

* WIP test external driver projects with queries

* WIP

* WIP adding query health report

* WIP adding query health report

* comments

* output test run results to excel file

* update unit test excel output

* bug fix

* add counter

* cleanup

* add existing database option to external drivers option

* add query health results file as example

* add compare script

* fix bug
* update recommended query suite to include RoleTypeCorrectlyUsed

* update readme and qlpack version

* update suite files to require specific versions of codeql/cpp-queries

* update readme. update ql pack to use recommended suite as default

* update readme. update qlpacks

* fix typos

* fix typo

* rename files to fix build job

* more filename updates

* update qlpack version and readme

* fix typo causing query not to run

* fix typo causing query not to run

* readme updates

* Update README.md

Co-authored-by: NateD-MSFT <[email protected]>
Signed-off-by: Jacob Ronstadt <[email protected]>

* Update README.md

Co-authored-by: NateD-MSFT <[email protected]>
Signed-off-by: Jacob Ronstadt <[email protected]>

* Update README.md

Co-authored-by: NateD-MSFT <[email protected]>
Signed-off-by: Jacob Ronstadt <[email protected]>

* Update README.md

Co-authored-by: NateD-MSFT <[email protected]>
Signed-off-by: Jacob Ronstadt <[email protected]>

* Update README.md

Co-authored-by: NateD-MSFT <[email protected]>
Signed-off-by: Jacob Ronstadt <[email protected]>

* Update README.md

Co-authored-by: NateD-MSFT <[email protected]>
Signed-off-by: Jacob Ronstadt <[email protected]>

* readme updates

* remove duplicate text

* Update README.md

Co-authored-by: NateD-MSFT <[email protected]>
Signed-off-by: Jacob Ronstadt <[email protected]>

---------

Signed-off-by: Jacob Ronstadt <[email protected]>
Co-authored-by: NateD-MSFT <[email protected]>
Copy link
Contributor

@NateD-MSFT NateD-MSFT left a comment

Choose a reason for hiding this comment

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

LGTM. Make sure to do a standard merge and not a squash.

@jacob-ronstadt jacob-ronstadt merged commit c3e0a1c into main Jan 25, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants