Repository navigation
Aliasing checks: Tree Borrows monitor and its Verus proof - #5120
Draft
feliperodri wants to merge 1 commit into
Draft
feliperodri wants to merge 1 commit into
feliperodri wants to merge 1 commit into
Conversation
First step of the aliasing checks proposed in RFC model-checking#5111. The monitor is the set of functions that apply Tree Borrows' rules at the one byte the checks track: tags with their ancestors and permissions as bit masks, accesses, reborrows, protectors, deallocation, exposure, function returns and the loop-head abstraction for loop contracts. Nothing calls it yet; the instrumentation that does comes next. The Verus crate in library/kani_core/verus includes the same file and proves that each function refines Tree Borrows' rules on an abstract tree, as Miri implements them, and preserves the monitor's well-formedness invariant (163 verified, no assume, admit or external_body). A new workflow runs the proof with a pinned Verus release when these files change.
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
2 open issues
What changed in this PR
Adds the Tree Borrows “aliasing monitor” transition core to kani_core, alongside a Verus specification/proof that the implementation refines that spec, plus CI wiring to run the proof on relevant changes.
Changes:
- Introduces
kani_aliasing_monitor!implementation (state + transition functions) inlibrary/kani_core/src/aliasing_monitor.rs. - Adds a large Verus spec/proof harness (
library/kani_core/verus/aliasing_monitor.rs) and documentation (library/kani_core/verus/README.md). - Adds a GitHub Actions workflow to download a pinned Verus release and run the proof on changes.
| File | Description |
|---|---|
| library/kani_core/verus/aliasing_monitor.rs | New Verus spec + proofs, includes and verifies the monitor implementation. |
| library/kani_core/verus/README.md | Documents how to run the proof and what is/ isn’t proved. |
| library/kani_core/src/lib.rs | Compiles in the new aliasing monitor module. |
| library/kani_core/src/aliasing_monitor.rs | Adds the monitor implementation and Verus-only contracts/proof hooks. |
| .github/workflows/verus.yml | Adds CI job to run the Verus proof when monitor/proof changes. |
Review effort: Lite
| - 'library/kani_core/src/aliasing_monitor.rs' | ||
| - 'library/kani_core/verus/**' | ||
| - '.github/workflows/verus.yml' | ||
| merge_group: |
Comment on lines
+36
to
+39
| run: | | ||
| curl -sSfL -o verus.zip \ | ||
| "https://github.com/verus-lang/verus/releases/download/release/${VERUS_VERSION}/verus-${VERUS_VERSION}-x86-linux.zip" | ||
| unzip -q verus.zip -d "$HOME/verus" |
Copilot stopped reviewing on behalf of
feliperodri due to an error
November 5, 2026 21:24
feliperodri
marked this pull request as draft
November 7, 2026 22:38
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

First PR of the series that RFC #5111 proposes for aliasing checks (
-Z aliasing-checks). It adds the monitor, the functions that apply Tree Borrows' rules at the one memory byte the checks track, and a Verus proof that they implement those rules. Nothing calls the monitor yet: the next PR adds the MIR instrumentation that does.Why on its own: the monitor is where the subtle rules are (conflicted Reserved, protectors, interior mutability, wildcard accesses), and it has no dependency on a CBMC release, unlike the instrumentation. It is easier to check against Miri's rules here than inside the compiler pass.
What to look at:
library/kani_core/verus/aliasing_monitor.rs(local_step,foreign_step,retag_node,wild_access,return_spec, ...). It is the trusted part: the proof shows that the code implements it, not that it is Tree Borrows. Each rule cites the Miri code it transcribes (tree_borrows/perms.rs,tree.rs). The next PR checks it a second way, by running Miri's own borrow tests under both tools.library/kani_core/src/aliasing_monitor.rs: up to 64 tags, each with its ancestors and permission as bit masks.Risk: none for users. The macro isn't expanded anywhere yet; the only change to the build is
mod aliasing_monitor;inkani_core.Where I'd like input:
Testing:
verification results:: 163 verified, 0 errors. The proof uses noassume,admitorexternal_body.cargo build-dev,cargo clippy -p kani_core -- -D warningsandkani-fmt --checkpass. TheIntrinsicstests of thekanisuite (177) pass; the full regression suite has not been run on this branch.