Skip to content

Rust: Add support for defining barriers and barrier guards using models-as-data#21475

Open
owen-mc wants to merge 14 commits intogithub:mainfrom
owen-mc:rust/mad-barriers
Open

Rust: Add support for defining barriers and barrier guards using models-as-data#21475
owen-mc wants to merge 14 commits intogithub:mainfrom
owen-mc:rust/mad-barriers

Conversation

@owen-mc
Copy link
Contributor

@owen-mc owen-mc commented Mar 15, 2026

No description provided.

@github-actions github-actions bot added Rust Pull requests that update Rust code DataFlow Library labels Mar 15, 2026
* `branch` is either `true` or `false`, indicating which branch of the guard
* is protecting the parameter.
*/
extensible predicate barrierGuardModel(
@hvitved
Copy link
Contributor

hvitved commented Mar 16, 2026

I have opened owen-mc#6 against this branch.

@owen-mc owen-mc force-pushed the rust/mad-barriers branch from 4af95da to 56d459a Compare March 19, 2026 16:41
@hvitved
Copy link
Contributor

hvitved commented Mar 20, 2026

Fix for barrier guards: owen-mc#7

@owen-mc owen-mc force-pushed the rust/mad-barriers branch from 9b1e73e to bde9378 Compare March 20, 2026 11:13
@owen-mc owen-mc marked this pull request as ready for review March 20, 2026 14:23
@owen-mc owen-mc requested review from a team as code owners March 20, 2026 14:23
Copilot AI review requested due to automatic review settings March 20, 2026 14:23
@owen-mc
Copy link
Contributor Author

owen-mc commented Mar 20, 2026

Rerun has been triggered.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Rust dataflow support for defining flow barriers and barrier guards via models-as-data, wiring them through the shared flow summary infrastructure and exposing a small Rust-facing API plus tests.

Changes:

  • Introduces shared and Rust-specific flow-summary support for barrier and barrier-guard elements/specs.
  • Adds Rust models-as-data extensibles (barrierModel, barrierGuardModel) and a public FlowBarrier library API to consume them.
  • Updates Rust library tests to exercise barrier and barrier-guard behavior using an .ext.yml MaD extension.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
shared/dataflow/codeql/dataflow/internal/FlowSummaryImpl.qll Adds barrier/barrier-guard element/spec plumbing to shared flow-summary implementation.
rust/ql/test/library-tests/dataflow/barrier/main.rs Extends the Rust test program with barrier and barrier-guard scenarios.
rust/ql/test/library-tests/dataflow/barrier/inline-flow.ql Updates inline flow test configuration to use the new barrier API.
rust/ql/test/library-tests/dataflow/barrier/inline-flow.ext.yml Adds MaD extension rows for a barrier and a barrier guard used by the test.
rust/ql/test/library-tests/dataflow/barrier/inline-flow.expected Updates expected results for the inline flow test.
rust/ql/lib/codeql/rust/dataflow/internal/empty.model.yml Ensures barrier/barrier-guard extensibles have at least one definition (empty) in the pack.
rust/ql/lib/codeql/rust/dataflow/internal/SsaImpl.qll Adds internal support for parameterized barrier guards.
rust/ql/lib/codeql/rust/dataflow/internal/Node.qll Fixes typos in source/sink node documentation comments.
rust/ql/lib/codeql/rust/dataflow/internal/ModelsAsData.qll Defines MaD extensible predicates and model pretty-printing for barriers and barrier guards.
rust/ql/lib/codeql/rust/dataflow/internal/FlowSummaryImpl.qll Adjusts Rust flow-summary integration to support barrier node extraction details.
rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll Wires barriers/barrier-guards into Rust dataflow via barrier nodes and guard checks.
rust/ql/lib/codeql/rust/dataflow/FlowBarrier.qll Adds a public Rust library entry point for barriers and barrier guards (and barrierNode).

Comment on lines +115 to +118
* the value referred to by `input` is assumed to lead to a parameter of a call
* (possibly `self`), and the call is guarding the parameter.
* `branch` is either `true` or `false`, indicating which branch of the guard
* is protecting the parameter.
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The barrierGuardModel doc comment has a couple issues: the sentence at line 115 starts with a lowercase "the", and branch is documented as boolean (true/false) even though the predicate parameter is a string. Please adjust the wording to be grammatically consistent and clarify the expected string values (for example, literal strings "true"/"false").

Suggested change
* the value referred to by `input` is assumed to lead to a parameter of a call
* (possibly `self`), and the call is guarding the parameter.
* `branch` is either `true` or `false`, indicating which branch of the guard
* is protecting the parameter.
* The value referred to by `input` is assumed to lead to a parameter of a call
* (possibly `self`), and the call is guarding the parameter.
* `branch` is either `"true"` or `"false"` (as a string literal), indicating which
* branch of the guard is protecting the parameter.

Copilot uses AI. Check for mistakes.
@owen-mc owen-mc added the no-change-note-required This PR does not need a change note label Mar 20, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@owen-mc
Copy link
Contributor Author

owen-mc commented Mar 20, 2026

Rerun has been triggered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DataFlow Library no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants