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

Add IrqlSetTooHigh, IrqlSetTooLow queries + update IRQL library #88

Merged
merged 66 commits into from
Oct 27, 2023

Conversation

NateD-MSFT
Copy link
Contributor

@NateD-MSFT NateD-MSFT commented Oct 25, 2023

This PR adds the following queries:

  • IrqlSetTooHigh
  • IrqlSetTooLow

To support this, we expand the Irql.qll library (including making use of interprocedural analysis for functions that save/restore the IRQL). We also update the existing IrqlNotSaved and IrqlNotUsed checks to use the new data-flow analysis, which requires some tweaking to the queries but results in fewer false positives in our unit tests.

Note that because we previously squash merged the IRQL work this was based off of into development, early commits in this PR are redundant. bb06b89 onwards are relevant to this PR.

Checklist for Pull Requests

  • 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.

NateD-MSFT and others added 30 commits March 20, 2023 17:46
Update cpp-all to 0.9.2, cpp-queries to 0.7.4
Signed-off-by: NateD-MSFT <[email protected]>
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.
NateD-MSFT and others added 21 commits October 19, 2023 16:33
Also refactor IrqlSetTooLow to match
Also refactor IrqlSetTooLow to match
…_snippet.c

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

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

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

Co-authored-by: NateD-MSFT <[email protected]>
Signed-off-by: Jacob Ronstadt <[email protected]>
Add tests for IrqlSetTooLow and IrqlSetTooHigh
Removes a false positive in our unit tests.
@NateD-MSFT
Copy link
Contributor Author

NateD-MSFT commented Oct 25, 2023

@JakobL-MSFT FYI. This does not yet contain the KeSetEvent-related query. This is getting all our existing IRQL-related checks+work into development with the intent of then building KeSetEvent off of that.

@jacob-ronstadt The commits after be14ce4 are the work I've done since merging in your branch. You can see the diff by checking the commit-to-commit diff here.

@NateD-MSFT NateD-MSFT merged commit 984e2ad into development Oct 27, 2023
2 checks passed
@NateD-MSFT NateD-MSFT deleted the nated-msft/c28124-c28150 branch October 27, 2023 18:36
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