-
Notifications
You must be signed in to change notification settings - Fork 1.7k
C++: IR data flow through global variables #8596
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
Conversation
45a29cb to
5b4a5cf
Compare
5b4a5cf to
680d4e8
Compare
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll
Fixed
Show fixed
Hide fixed
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll
Fixed
Show resolved
Hide resolved
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.
The dataflow changes LGTM! Before we merge this we should probably rebase main onto this PR now that #8912 is merged, and then run a DCA experiment.
d5016d9 to
d28c39c
Compare
|
@geoffw0 there's some new false positives in the CWE-611 tests, and I'm not sure whether they're an issue with this PR or just exposing a known issue with the CWE-611 query. Could you take a look at those? |
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.
Reviewed the changes in CPP security query test results only.
geoffw0
mentioned this pull request
|
The performance on |
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.
Two naive questions to start, just to further my understanding.
cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll
Outdated
Show resolved
Hide resolved
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.
Next batch of comments. I'm slowly working my way through this. Feel free to go ahead and fixing things even though I'm not yet done (whatever your preferred way of working is).
| @@ -98,6 +98,9 @@ thisArgumentIsNonPointer | |||
| | pmcallexpr.cpp:8:2:8:15 | Call: call to expression | Call instruction 'Call: call to expression' has a `this` argument operand that is not an address, in function '$@'. | array_delete.cpp:5:6:5:6 | void f() | void f() | | |||
| | pointer_to_member.cpp:23:5:23:54 | Call: call to expression | Call instruction 'Call: call to expression' has a `this` argument operand that is not an address, in function '$@'. | pointer_to_member.cpp:14:5:14:9 | int usePM(int PM::*) | int usePM(int PM::*) | | |||
| | pointer_to_member.cpp:24:5:24:49 | Call: call to expression | Call instruction 'Call: call to expression' has a `this` argument operand that is not an address, in function '$@'. | pointer_to_member.cpp:14:5:14:9 | int usePM(int PM::*) | int usePM(int PM::*) | | |||
| nonUniqueIRVariable | |||
| | misc.c:178:22:178:40 | VariableAddress: __PRETTY_FUNCTION__ | Variable address instruction 'VariableAddress: __PRETTY_FUNCTION__' has no associated variable, in function '$@'. | misc.c:177:6:177:14 | void magicvars() | void magicvars() | | |||
| | misc.c:179:27:179:34 | VariableAddress: __func__ | Variable address instruction 'VariableAddress: __func__' has no associated variable, in function '$@'. | misc.c:177:6:177:14 | void magicvars() | void magicvars() | | |||
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.
These variables are quite "special". Is this something we may need to file an issue for and look at later, or is this as expected?
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.
This probably is something we need to look at eventually. The consistency check is new, and I think these don't have to do with the rest of the PR.
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.
Agreed that this doesn't have anything to do with this PR.
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll
Outdated
Show resolved
Hide resolved
cpp/ql/lib/semmle/code/cpp/ir/implementation/IRConfiguration.qll
Outdated
Show resolved
Hide resolved
cpp/ql/lib/semmle/code/cpp/ir/implementation/IRConfiguration.qll
Outdated
Show resolved
Hide resolved
cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/IRVariable.qll
Outdated
Show resolved
Hide resolved
cpp/ql/lib/semmle/code/cpp/ir/implementation/internal/TIRVariable.qll
Outdated
Show resolved
Hide resolved
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll
Outdated
Show resolved
Hide resolved
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll
Outdated
Show resolved
Hide resolved
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll
Outdated
Show resolved
Hide resolved
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll
Outdated
Show resolved
Hide resolved
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.
Final batch of comments. I assumed that changes to the CWE test outputs are ok. Let me know if you want me to have a close look at those.
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll
Outdated
Show resolved
Hide resolved
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll
Outdated
Show resolved
Hide resolved
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll
Outdated
Show resolved
Hide resolved
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll
Outdated
Show resolved
Hide resolved
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll
Fixed
Show resolved
Hide resolved
|
Looking at the DCA experiment: did you look whether the alert changes made sense? |
|
@rdmarsh2 I think there's still the following to resolve:
|
a8b441d to
6dbaae6
Compare
|
There's also still: #8596 (comment) Is this something that needs to be looked at on the extractor side? |
|
The DCA alert changes made sense, yes. Responded to that last comment - I'm not sure if they need work on the extractor side or if they need special handling in IR generation. |
|
LGTM. I've kicked off a final DCA experiment, as we changed quite a few things related to (global) variables on the extractor side since this PR was opened. I'll approve once the experiment is done (unless we find some serious problem that is new compared to the previous DCA experiment, which probably isn't very likely). |
|
New DCA results are in:
|
So far:
If anyone wants to look at the remaining results feel free to do so. I'm pretty confident in the new results. Edit: According to people smarter than me the following might not actually be an issue. The OOM on Yes, that's a relation of size 1.126.884.102.485 😱 |
|
Looks like the OOM is on ExecTainted.ql - all other queries finish before the error. I'll take a deeper look at it. |
You might want to have a brief sync with Mathias about it. If you can't track it down I would suggest repeating the vim part of the DCA experiment with a lower |
|
I if see correctly, the re-run of DCA on vim was without the |


No description provided.