Skip to content

[kani] Prove utility memory operations - #3648

Open
joshlf wants to merge 1 commit into
Gcmpgic3rdonowgrcxzylfnswfrlxt6lmfrom
G4pavaeiw7kliymw4ujvmg43vcwah5v5p
Open

[kani] Prove utility memory operations#3648
joshlf wants to merge 1 commit into
Gcmpgic3rdonowgrcxzylfnswfrlxt6lmfrom
G4pavaeiw7kliymw4ujvmg43vcwah5v5p

Conversation

@joshlf

@joshlf joshlf commented Sep 7, 2026

Copy link
Copy Markdown
Member

Replace the private raw copy helper with safe copy_prefix, prove its bounded
frame behavior, and remove three caller unsafe blocks. Add concrete
representation and mutation proofs for transmute helpers, plus sized, ZST, and
plain-slice new_box smoke proofs. Document the remaining aliasing, provenance,
allocator, and nested-DST limits.

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


Latest Update: v52 — Compare vs v51

📚 Full Patch History

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

Version v51 v50 v49 v48 v47 v46 v45 v44 v43 v42 v41 v40 v39 v38 v37 v36 v35 v34 v33 v32 v31 v30 v29 v28 v27 v26 v25 v24 v23 v22 v21 v20 v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v52 v51 v50 v49 v48 v47 v46 v45 v44 v43 v42 v41 v40 v39 v38 v37 v36 v35 v34 v33 v32 v31 v30 v29 v28 v27 v26 v25 v24 v23 v22 v21 v20 v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v51 v50 Base
v50 v49 Base
v49 v48 Base
v48 v47 Base
v47 v46 Base
v46 v45 Base
v45 v44 Base
v44 v43 Base
v43 v42 Base
v42 v41 Base
v41 v40 Base
v40 v39 Base
v39 v38 Base
v38 v37 Base
v37 v36 Base
v36 v35 Base
v35 v34 Base
v34 v33 Base
v33 v32 Base
v32 v31 Base
v31 v30 Base
v30 v29 Base
v29 v28 Base
v28 v27 Base
v27 v26 Base
v26 v25 Base
v25 v24 Base
v24 v23 Base
v23 v22 Base
v22 v21 Base
v21 v20 Base
v20 v19 Base
v19 v18 Base
v18 v17 Base
v17 v16 Base
v16 v15 Base
v15 v14 Base
v14 v13 Base
v13 v12 Base
v12 v11 Base
v11 v10 Base
v10 v9 Base
v9 v8 Base
v8 v7 Base
v7 v6 Base
v6 v5 Base
v5 v4 Base
v4 v3 Base
v3 v2 Base
v2 v1 Base
v1 Base
⬇️ Download this PR

Branch

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

Checkout

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

Cherry Pick

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

Pull

git pull origin refs/heads/G4pavaeiw7kliymw4ujvmg43vcwah5v5p

Stacked PRs enabled by GHerrit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 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:00.875687Z 867d9c2 Manual request
🔒 Security Review Completed 2026-09-08T21:37:13.532985Z 312a2ff 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 7, 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.

@codecov-commenter

codecov-commenter commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@                         Coverage Diff                          @@
##             Gcmpgic3rdonowgrcxzylfnswfrlxt6lm    #3648   +/-   ##
====================================================================
  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.

@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: f22e083f02

ℹ️ 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/util/mod.rs Outdated
Comment on lines +503 to +505
// SAFETY: The assumptions above establish that the source subslice is
// no longer than the destination subslice.
unsafe { copy_unchecked(&src[..src_len], &mut dst[..dst_len]) };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add required sources to the new safety comments

The safety comment here—and each of the other newly added unsafe call sites in this proof module—only restates the callee's preconditions. The repository's mandatory reviewing protocol requires every unsafe block's justification to cite and quote a versioned Rust Reference or standard-library guarantee, so these comments must be expanded with the relevant documentation citations and excerpts before merging.

AGENTS.md reference: zerocopy/AGENTS.md:L21-L23

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.

Addressed in the current revision. The unsafe calls now cite and quote the exact versioned guarantees they consume: copy_nonoverlapping validity/alignment/non-overlap, numeric bit validity for transmutation, and the allocator contracts for the modeled allocation paths. Expected values are derived from safe copying, native-byte conversions, Wrapping, and safe dereferencing.

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

@joshlf
joshlf force-pushed the G4pavaeiw7kliymw4ujvmg43vcwah5v5p branch from f22e083 to 503d7a8 Compare September 7, 2026 17:14
@joshlf
joshlf force-pushed the Gcmpgic3rdonowgrcxzylfnswfrlxt6lm branch from e2d0662 to 2753765 Compare September 7, 2026 17:14
@joshlf
joshlf force-pushed the G4pavaeiw7kliymw4ujvmg43vcwah5v5p branch from 503d7a8 to 9719a71 Compare September 7, 2026 17:47
@joshlf
joshlf force-pushed the Gcmpgic3rdonowgrcxzylfnswfrlxt6lm branch from 2753765 to 49e0f09 Compare September 7, 2026 17:47
@joshlf
joshlf force-pushed the G4pavaeiw7kliymw4ujvmg43vcwah5v5p branch from 9719a71 to e6b583c Compare September 7, 2026 18:13
@joshlf

joshlf commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

Please review current head e6b583c20b4f56dd9953b7b7536c2fce761a7b2c; in particular, challenge the documented proof domain and exclusions, and verify that expected behavior comes from an independent safe Rust, standard-library, language, or explicitly labeled policy oracle.

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

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: e6b583c20b

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: e6b583c20b

ℹ️ 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/util/mod.rs Outdated
// Note that even if the effectively copied size
// (`count * size_of::<T>()`) is 0, the pointers must be non-null
// and properly aligned.
unsafe { copy_unchecked(&src[..src_len], &mut dst[..dst_len]) };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Cite the guarantees that make the copy nonoverlapping

The current revision's [1] excerpt only lists copy_nonoverlapping's preconditions; it does not support the safety comment's claims that the subslices are live and aligned or that regions belonging to distinct local arrays cannot overlap. This is fresh evidence relative to the prior thread because the newly added citation still leaves those essential claims based on intuition rather than quoted, versioned Reference or standard-library guarantees; add citations establishing reference validity/alignment and exclusivity/non-overlap. zerocopy/agent_docs/unsafe_code.mdL56-L65

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.

Addressed in the current revision. The safety rationale now cites the Rust 1.93.0 reference guarantees for reference alignment, non-nullness, validity, slice-buffer pointers, and exclusive-reference access, and connects those guarantees to every copy_nonoverlapping precondition, including non-overlap.

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

@joshlf
joshlf force-pushed the G4pavaeiw7kliymw4ujvmg43vcwah5v5p branch from e6b583c to 60f0d48 Compare September 7, 2026 19:04
@joshlf
joshlf force-pushed the Gcmpgic3rdonowgrcxzylfnswfrlxt6lm branch from 49e0f09 to 4c05617 Compare September 7, 2026 19:04
@joshlf

joshlf commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

Please review current head 60f0d48bc9273ef9136c73842770e1397a44a749; in particular, challenge the documented proof domain and exclusions, and verify that expected behavior comes from an independent safe Rust, standard-library, language, or explicitly labeled policy oracle.

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

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 60f0d48bc9

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: 60f0d48bc9

ℹ️ 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/util/mod.rs Outdated
Comment on lines +524 to +525
// Oracle: Safe `u32::to_ne_bytes`, `u32::from_ne_bytes`, and `Wrapping`
// construction.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Ground address preservation in an independent oracle

For the two reference-transmute harnesses, Wrapping construction supplies an expected value but cannot establish the separately claimed address preservation. The assertions merely designate the original pointer as the expected address without citing a Rust or standard-library rule that requires this result, explaining why that rule is independent of transmute_ref/transmute_mut, or labeling its limitations. Cite the normative pointer/reference rule used to derive the expected address (or stop claiming this property); otherwise these assertions do not satisfy the repository's oracle requirements. zerocopy/agent_docs/validation.mdL74-L83

Useful? React with 👍 / 👎.

Comment thread zerocopy/src/util/mod.rs Outdated
// 12.
// Establishes: The copied prefix and every destination frame byte exactly
// match a safe copy.
// Oracle: `slice::copy_from_slice` applied to a separate destination copy.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Cite the semantics of the copy oracle

When this harness is used as evidence for copy_unchecked's copy and frame behavior, the expected buffer is derived entirely through slice::copy_from_slice, but the scope comment only names that API and never cites its documented guarantee that the receiver elements are replaced by the source elements. Add a versioned standard-library citation for that semantic contract and explicitly state why using it on the separate destination is independent of copy_unchecked; otherwise the asserted expected result lacks the normative basis required for every proof oracle. zerocopy/agent_docs/validation.mdL74-L83

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

@joshlf
joshlf force-pushed the Gcmpgic3rdonowgrcxzylfnswfrlxt6lm branch from dc3f69d to 69aa306 Compare September 9, 2026 01:35
@joshlf
joshlf force-pushed the G4pavaeiw7kliymw4ujvmg43vcwah5v5p branch from 274a10a to 6037ae9 Compare September 9, 2026 01:35
@joshlf

joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@codex review

Please review current head 6037ae9d4c2846b6ed01a477b8bdf0d449c4e59a; in particular, challenge the documented proof domain and exclusions, and verify that expected behavior comes from an independent safe Rust, standard-library, language, or explicitly labeled policy oracle.

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. More of your lovely PRs please.

Reviewed commit: 6037ae9d4c

ℹ️ 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 Gcmpgic3rdonowgrcxzylfnswfrlxt6lm branch from 69aa306 to 7485956 Compare September 9, 2026 01:53
@joshlf
joshlf force-pushed the G4pavaeiw7kliymw4ujvmg43vcwah5v5p branch from 6037ae9 to 2f73227 Compare September 9, 2026 01:53
@joshlf

joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@codex review

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.

@joshlf
joshlf force-pushed the G4pavaeiw7kliymw4ujvmg43vcwah5v5p branch from 2f73227 to 9aebc12 Compare September 9, 2026 02:28
@joshlf
joshlf force-pushed the Gcmpgic3rdonowgrcxzylfnswfrlxt6lm branch from 7485956 to 5e538bb Compare September 9, 2026 02:28
@joshlf

joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@codex review

Please review exact head 9aebc123d856ab30cae9ac3a46dbff0380acd4a7.

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. Nice work!

Reviewed commit: 9aebc123d8

ℹ️ 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 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: 6350696

@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. Keep it up!

Reviewed commit: 6350696001

ℹ️ 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".

Replace the private raw copy helper with safe `copy_prefix`, prove its bounded
frame behavior, and remove three caller unsafe blocks. Add concrete
representation and mutation proofs for transmute helpers, plus sized, ZST, and
plain-slice `new_box` smoke proofs. Document the remaining aliasing, provenance,
allocator, and nested-DST limits.

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

gherrit-pr-id: G4pavaeiw7kliymw4ujvmg43vcwah5v5p
@joshlf
joshlf force-pushed the G4pavaeiw7kliymw4ujvmg43vcwah5v5p branch from 6350696 to 867d9c2 Compare September 9, 2026 17:18
@joshlf
joshlf force-pushed the Gcmpgic3rdonowgrcxzylfnswfrlxt6lm branch from 72bf299 to 1961311 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: 867d9c2

@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 867d9c2605adb06887b46ad294a61b7420afb083 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