-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add CodeQL check to detect cause of issue #12014 #17352
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
base: master
Are you sure you want to change the base?
Conversation
This check is currently limited to checking mismatches that occur in the same stack frame. It does not detect across stack frames. Signed-off-by: Richard Yao <[email protected]>
This was caught when doing a manual check to see if openzfs#17352 needed to be improved to catch mismatches across stack frames of the kind that were first found in openzfs#17340. Signed-off-by: Richard Yao <[email protected]>
PRs like openzfs#17352 have no applicable checkbox, so let us add one. Signed-off-by: Richard Yao <[email protected]>
This was caught when doing a manual check to see if #17352 needed to be improved to catch mismatches across stack frames of the kind that were first found in #17340. Reviewed-by: George Amanakis <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #17353
PRs like #17352 have no applicable checkbox, so let us add one. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #17354
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 wonder if we could/should assert that flags passed to the both functions are the same. Or at least this specific flag.
We could make a different check for that. I will keep it in mind as something else to try to check after I have improved this. I am spending a few hours on this every few days, so I do not expect to have a revision of this for at least a week. That said, this API strikes me as being naturally error prone. Changing it to use a cookie approach like |
@ryao if you're still iterating on this can your mark it as a draft until you're ready. That said, I'm also fine with merging this functional, but less comprehensive, version until you come up with something better. |
This was caught when doing a manual check to see if openzfs#17352 needed to be improved to catch mismatches across stack frames of the kind that were first found in openzfs#17340. Reviewed-by: George Amanakis <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes openzfs#17353 (cherry picked from commit 83fa80a) (cherry picked from commit 07d815f)
This was caught when doing a manual check to see if openzfs#17352 needed to be improved to catch mismatches across stack frames of the kind that were first found in openzfs#17340. Reviewed-by: George Amanakis <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes openzfs#17353 (cherry picked from commit 83fa80a) (cherry picked from commit 07d815f2a06573514f51c8601aa60db6fe1a76ad)
This was caught when doing a manual check to see if openzfs#17352 needed to be improved to catch mismatches across stack frames of the kind that were first found in openzfs#17340. Reviewed-by: George Amanakis <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes openzfs#17353 (cherry picked from commit 83fa80a)
PRs like openzfs#17352 have no applicable checkbox, so let us add one. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes openzfs#17354 (cherry picked from commit 2e5e4bb)
This was caught when doing a manual check to see if openzfs#17352 needed to be improved to catch mismatches across stack frames of the kind that were first found in openzfs#17340. Reviewed-by: George Amanakis <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes openzfs#17353 (cherry picked from commit 83fa80a)
PRs like openzfs#17352 have no applicable checkbox, so let us add one. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes openzfs#17354 (cherry picked from commit 2e5e4bb)
This was caught when doing a manual check to see if #17352 needed to be improved to catch mismatches across stack frames of the kind that were first found in #17340. Reviewed-by: George Amanakis <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #17353 (cherry picked from commit 83fa80a) (cherry picked from commit 07d815f)
PRs like openzfs#17352 have no applicable checkbox, so let us add one. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes openzfs#17354
This was caught when doing a manual check to see if #17352 needed to be improved to catch mismatches across stack frames of the kind that were first found in #17340. Reviewed-by: George Amanakis <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #17353 (cherry picked from commit 83fa80a)
PRs like #17352 have no applicable checkbox, so let us add one. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #17354 (cherry picked from commit 2e5e4bb)
Motivation and Context
This is a simple check that would detect instances of the cause of issue #12014.
Description
This check is currently limited to checking mismatches that occur in the same stack frame. It does not detect across stack frames.
I had originally intended not to send this in favor of developing a more comprehensive check and sending the patch for that, but @behlendorf asked for it in #17340, so I am opening a PR with what I currently have. Note that I had made an initial attempt at making the more comprehensive check on the weekend, but I am not well versed in the CodeQL language, so it will take a while to implement.
How Has This Been Tested?
I verified it identified the issue on ryao/zfs.
Types of changes
Checklist:
Signed-off-by
.