-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Brodes/seh flow phase1 throwing models #18014
Open
bdrodes
wants to merge
22
commits into
github:main
Choose a base branch
from
microsoft:brodes/seh_flow_phase1_throwing_models
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+42
−17
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
de05aee
Adding model transition to using Throwing.qll.
bdrodes 4b83a45
Change log
bdrodes 1c7b5ae
Merge branch 'main' into brodes/seh_flow_phase1_throwing_models
bdrodes 792231c
Removing SEH default case for function calls as the logic to handle S…
bdrodes 1c874d3
Fixed usage raisesException
bdrodes 5bb765d
Merge branch 'main' into brodes/seh_flow_phase1_throwing_models
bdrodes 26d590a
Putting back deleted file, and deprecating instead. Deprecating mayTh…
bdrodes 63ddd81
Merge branch 'brodes/seh_flow_phase1_throwing_models' of https://gith…
bdrodes 0784776
bringing back mayThrowException to make it cleaner/easier for backwar…
bdrodes ae1ed38
Merge branch 'main' into brodes/seh_flow_phase1_throwing_models
bdrodes a69daa0
Missing change to 'mayThrowException' in StructuredExceptionHandling.qll
bdrodes 23485f1
Merge branch 'brodes/seh_flow_phase1_throwing_models' of https://gith…
bdrodes 4e77756
Changing terminology back to "throws" vs "rasis" for alwaysThrowsExce…
bdrodes 69df07e
Update cpp/ql/lib/change-notes/2024-11-18-throwing-functions.md
bdrodes 6aa7412
Merge branch 'main' into brodes/seh_flow_phase1_throwing_models
bdrodes 9b2590e
Updating PR per review comments. Moving more towards a simplified model.
bdrodes 4412691
Delaying deprecation of ThrowingFunction.
bdrodes 7059fc3
Adding intermediate solution towards deprecating ThrowingFunction
bdrodes 248f1c4
Updating change log
bdrodes 583651b
Missing NonCppThrowingFunction changes in Printf.qll
bdrodes 66cf736
printf formatting.
bdrodes 37365c7
Updating to NonCppThrowingFunction use in IncorrectALlocationErrorHan…
bdrodes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
category: deprecated | ||
--- | ||
* The `NonThrowing` class (`semmle.code.cpp.models.interfaces.NonThrowing`) has been deprecated. Please use the `NonCppThrowingFunction` class instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
cpp/ql/lib/semmle/code/cpp/models/implementations/StructuredExceptionHandling.qll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import semmle.code.cpp.models.interfaces.Throwing | ||
|
||
class WindowsDriverFunction extends ThrowingFunction { | ||
WindowsDriverFunction() { | ||
class WindowsDriverExceptionAnnotation extends AlwaysSehThrowingFunction { | ||
WindowsDriverExceptionAnnotation() { | ||
this.hasGlobalName(["RaiseException", "ExRaiseAccessViolation", "ExRaiseDatatypeMisalignment"]) | ||
} | ||
|
||
final override predicate mayThrowException(boolean unconditional) { unconditional = true } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cannot just delete files that are not in non-implementation or internal directories. These will need to go through a deprecation period. Could you discuss with @MathiasVP what the correct approach should be here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, we have a 1-ish year deprecation period for non-internal QL things. So we need to:
deprecated
NonThrowingFunction
should do something equivalent to what it did beforeAnd then it'll be deleted by someone in a PR a year from now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about that after I submitted, fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just do:
and write in the change note that (a) the class is deprecated, and (b) requires a new member to be implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or is that too dirty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can definitely do that, yes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do this, but I had avoided changes like this because any existing use of the old NonThrowingFunction would require the member predicate be defined, breaking any existing queries. I thought the point of deprecating vs deleting was to not completely break existing builds. If you are actually ok with that @jketema I'm ok with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose another option is to just make the deprecated version extend the new throwing function mechanic and set the exception type predicate to be any type (matching the prior intended behavior). I can do whatever, just please advise what is more acceptable to github standards.