Skip to content

[kani] Ground validator proofs in Rust oracles - #3664

Open
joshlf wants to merge 1 commit into
G31fb58e3f6c48d287ce6208bb1b061e4from
G9a640f60dbaf8b9e24379dca9ac30494
Open

[kani] Ground validator proofs in Rust oracles#3664
joshlf wants to merge 1 commit into
G31fb58e3f6c48d287ce6208bb1b061e4from
G9a640f60dbaf8b9e24379dca9ac30494

Conversation

@joshlf

@joshlf joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member

Replace hand-reconstructed expectations with safe Rust and standard-library observations, take independent pre-call snapshots, and make closure captures explicit. Document normal-return frame, padding-validity, and transient-write limits next to the affected harness families.

The UTF-8 family now proves validator and public-borrow plumbing against core::str::from_utf8; it intentionally no longer claims an independent proof of the standard library’s UTF-8 classifier.

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.


Latest Update: v4 — Compare vs v3

📚 Full Patch History

Links show the diff between the row version and the column version.

Version v3 v2 v1 Base
v4 vs v3 vs v2 vs v1 vs Base
v3 vs v2 vs v1 vs Base
v2 vs v1 vs Base
v1 vs Base
⬇️ Download this PR

Branch

git fetch origin refs/heads/G9a640f60dbaf8b9e24379dca9ac30494 && git checkout -b pr-G9a640f60dbaf8b9e24379dca9ac30494 FETCH_HEAD

Checkout

git fetch origin refs/heads/G9a640f60dbaf8b9e24379dca9ac30494 && git checkout FETCH_HEAD

Cherry Pick

git fetch origin refs/heads/G9a640f60dbaf8b9e24379dca9ac30494 && git cherry-pick FETCH_HEAD

Pull

git pull origin refs/heads/G9a640f60dbaf8b9e24379dca9ac30494

Stacked PRs enabled by GHerrit.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-09-09T17:21:20.111539Z dbb798e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@google-cla

google-cla Bot commented Sep 9, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@joshlf

joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Reviewer guide: exact scope

This follow-up replaces hand-reconstructed expectations with pre-call safe Rust/std observations across validator, transmute-macro, and Unalign::update proofs. It uses independent snapshots, computes mutable-bool expectations before target calls, compares rejected pointer transmutations with a safe Copy snapshot, documents padded-struct validity, and makes closure captures explicit with move.

UTF-8 scope: For byte sequences of lengths 0–4 at fixed modeled stack placements, the proofs show that zerocopy’s Aligned- and Unaligned-marker validator paths and valid public-borrow paths agree with and preserve input accepted by core::str::from_utf8. This intentionally checks zerocopy plumbing against the same std classifier; it is not an independent proof of UTF-8 classification. Longer inputs and the public invalid-input path are excluded.

Other non-goals: Macro proofs remain limited to the documented u8/bool, usize/thin-pointer, and [u8; 16]/PaddedPointer cases. Final-state observations cannot exclude restored transient writes. Address equality is not a provenance, aliasing, dereferenceability, or lifetime theorem. Invalid values, uninitialized padding, arbitrary macro arms/toolchains, and custom/nested DST layout (#3630) remain outside the conclusions.

Evidence: the full pinned run verified 332/332 harnesses and all 896 covers; repository pre-push validation passes.

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@joshlf

joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@codex review

Please review exact current head 47c3086b9a010b7f850c0f4ae0aaea8bb04caba7. Challenge oracle independence and snapshot timing. In particular, verify that the UTF-8 claim is only plumbing agreement with core::str::from_utf8, and that pointer, padding, and final-state exclusions are accurate.

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 47c3086b9a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@joshlf
joshlf force-pushed the G31fb58e3f6c48d287ce6208bb1b061e4 branch from 222841b to e750fbc Compare September 9, 2026 03:39
@joshlf
joshlf force-pushed the G9a640f60dbaf8b9e24379dca9ac30494 branch from 47c3086 to f837dcf Compare September 9, 2026 03:39
@codecov-commenter

codecov-commenter commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (G31fb58e3f6c48d287ce6208bb1b061e4@6f016f6). Learn more about missing BASE report.

Additional details and impacted files
@@                         Coverage Diff                          @@
##             G31fb58e3f6c48d287ce6208bb1b061e4    #3664   +/-   ##
====================================================================
  Coverage                                     ?   91.85%           
====================================================================
  Files                                        ?       20           
  Lines                                        ?     6093           
  Branches                                     ?        0           
====================================================================
  Hits                                         ?     5597           
  Misses                                       ?      496           
  Partials                                     ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joshlf
joshlf force-pushed the G9a640f60dbaf8b9e24379dca9ac30494 branch from f837dcf to 73ef3b5 Compare September 9, 2026 03:42
@joshlf
joshlf force-pushed the G31fb58e3f6c48d287ce6208bb1b061e4 branch from e750fbc to 6f016f6 Compare September 9, 2026 03:42
@joshlf

joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@codex review

Please review exact current head 73ef3b54e8c40fb9f885ea42e774ab53202d8d6a. Challenge oracle independence and snapshot timing. In particular, verify that the UTF-8 claim is only plumbing agreement with core::str::from_utf8, and that pointer, padding, and final-state exclusions are accurate.

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 73ef3b54e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread zerocopy/src/impls.rs Outdated
Comment on lines +1845 to +1847
// `Unaligned` and `Aligned` zerocopy validator path returns with candidate
// bytes equal to the pre-call snapshot and reports the same classification
// as the standard-library operation it wraps.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Verify or exclude candidate pointer identity

The direct-validator harnesses do not establish that the candidate still refers to the original bytes: both new preservation checks compare bytes with snapshot, while neither observes candidate's address or referent. If the transmute_with/validator plumbing redirects the candidate to another same-valued buffer—the newly allocated snapshot provides such a buffer—the classifications and source-preservation assertions can all pass, so the stated conclusion that the candidate bytes equal the snapshot overstates what is proved. Snapshot bytes.as_ptr() before constructing the candidate and compare it with the candidate pointer, or explicitly exclude candidate address/referent preservation from the theorem.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

Addressed on exact head dbb798e6a8ab8081d548dfc5c0d9f9ddc59e7976. The direct validator harness now snapshots the address from the original byte slice before candidate construction. It binds each actual unaligned/aligned candidate, compares the exposed address of that candidate with the snapshot, and then passes that same candidate to the validator. The original source-byte frame remains checked afterward. The documentation limits this to an address observation, explicitly excluding metadata/provenance claims and any assumption that distinct zero-sized storage must have distinct addresses. All five focused direct-validator harnesses passed, including every cover.

Replace hand-reconstructed expectations with safe Rust and standard-library observations, take independent pre-call snapshots, and make closure captures explicit. Document normal-return frame, padding-validity, and transient-write limits next to the affected harness families.

The UTF-8 family now proves validator and public-borrow plumbing against core::str::from_utf8; it intentionally no longer claims an independent proof of the standard library’s UTF-8 classifier.

*Authored by an AI agent acting on Josh Liebow-Feeser's behalf.*

gherrit-pr-id: G9a640f60dbaf8b9e24379dca9ac30494
@joshlf
joshlf force-pushed the G9a640f60dbaf8b9e24379dca9ac30494 branch from 73ef3b5 to dbb798e Compare September 9, 2026 17:18
@joshlf
joshlf force-pushed the G31fb58e3f6c48d287ce6208bb1b061e4 branch from 6f016f6 to 92d5e03 Compare September 9, 2026 17:18
@joshlf

joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@codex review

Exact-head review request: dbb798e

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Provided git ref dbb798e6a8ab8081d548dfc5c0d9f9ddc59e7976 does not exist
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants