Title: C++: Fix conflation in barrier guards by MathiasVP · Pull Request #21171 · github/codeql · GitHub
Open Graph Title: C++: Fix conflation in barrier guards by MathiasVP · Pull Request #21171 · github/codeql
X Title: C++: Fix conflation in barrier guards by MathiasVP · Pull Request #21171 · github/codeql
Description: While working on MaD support for barriers/barrier guards for C/C++ I discovered a bug related to indirect barrier guards. This PR fixes that bug at the cost of: Exposing a predicate that was private in the shared Guards library, and Losing a small bit of smartness in barrier guards related to stuff like: if(x == y && clean(x)) { sink(y); // okay because `clean` is a barrier and `x == y` } The problem is that (as @aschackmull also discovered when we were porting C++ to the shared SSA library's dataflow integration layer) we cannot relate an SsaDefinition to an Instruction without an indirection index. So on something like: void foo(int* p) { if (validate_indirection(p)) { sink(*p); } } When guardChecksInstr says that p is a barrier guard with indirection 1 guardChecksDef finds the associated Ssa definition for p (and not its indirection, *p, since guardReadsSsaVar doesn't have access to the indirection index) and places a barrier on &p, p, and *p instead of just *p like it was intended. I can imagine better fixes for this. In particular: Thread an additional language-supplied data column through the guards library and make it available for getARead. C/C++ instantiates the shared Guards library with AstNode = (Instruction, int) instead of AstNode = Instruction like we do currently. This should be totally doable (albeit with another breaking change to the barrier guards library for C/C++ 😭) @aschackmull do you have any thoughts on this? In the first commit I switch dataflow to use Type instead of DataFlowType. This may look scary, but DataFlowType is just Type with an empty toString (see here). This was necessary to create the testcase I wanted.
Open Graph Description: While working on MaD support for barriers/barrier guards for C/C++ I discovered a bug related to indirect barrier guards. This PR fixes that bug at the cost of: Exposing a predicate that was priva...
X Description: While working on MaD support for barriers/barrier guards for C/C++ I discovered a bug related to indirect barrier guards. This PR fixes that bug at the cost of: Exposing a predicate that was priva...
Opengraph URL: https://github.com/github/codeql/pull/21171
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:65e6cd48-292c-0a00-af3a-e26b95bcbbde |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DDCC:343EA:8ADABF:BE33E1:696E7FA6 |
| html-safe-nonce | 554464d77e364aec90e31b63ac00c23ab4c4ecd68e7720d50d3324c60c97364c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERENDOjM0M0VBOjhBREFCRjpCRTMzRTE6Njk2RTdGQTYiLCJ2aXNpdG9yX2lkIjoiODc5NTUyNjcyMzk0ODkzNzEyNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 05157e4a438c6ea93519a75776df4779511e6813fbb6ceeb0b05281e2ab1d3b0 |
| hovercard-subject-tag | pull_request:3177026921 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/github/codeql/pull/21171/files |
| twitter:image | https://avatars.githubusercontent.com/u/4527323?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/4527323?s=400&v=4 |
| og:image:alt | While working on MaD support for barriers/barrier guards for C/C++ I discovered a bug related to indirect barrier guards. This PR fixes that bug at the cost of: Exposing a predicate that was priva... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | fdad15fd2ad43212aa8b8be5f2c2725550f8374ceeeb154a999ad9145b43f3f7 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/github/codeql git https://github.com/github/codeql.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 143040428 |
| octolytics-dimension-repository_nwo | github/codeql |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 143040428 |
| octolytics-dimension-repository_network_root_nwo | github/codeql |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 27b23bc056eb973d350fc95afc848757edb9e7a9 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width