Skip to content

Extract slice metadata without references - #3629

Merged
joshlf merged 1 commit into
mainfrom
Gro7m5vgpfdcy3pxtpl52hnbgworclnzw
Sep 9, 2026
Merged

Extract slice metadata without references#3629
joshlf merged 1 commit into
mainfrom
Gro7m5vgpfdcy3pxtpl52hnbgworclnzw

Conversation

@joshlf

@joshlf joshlf commented Sep 5, 2026

Copy link
Copy Markdown
Member

KnownLayout's slice implementation materialized a shared reference solely to
read raw pointer metadata. That is invalid for null, dangling, unaligned, or
otherwise non-dereferenceable slice pointers even though metadata extraction
itself must accept them.

Use the safe raw-slice pointer length API on Rust 1.79 and newer. On older
supported compilers, capture a metadata candidate through raw-pointer hashing
and authenticate it with raw slice pointer equality before returning it.
Strengthen the implementer contract and cover null, dangling, deallocated,
unaligned, derived-DST, and boundary-toolchain cases.

Closes #3615

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


Latest Update: v3 — Compare vs v2

📚 Full Patch History

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

Version v2 v1 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/Gro7m5vgpfdcy3pxtpl52hnbgworclnzw && git checkout -b pr-Gro7m5vgpfdcy3pxtpl52hnbgworclnzw FETCH_HEAD

Checkout

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

Cherry Pick

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

Pull

git pull origin refs/heads/Gro7m5vgpfdcy3pxtpl52hnbgworclnzw

Stacked PRs enabled by GHerrit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 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 Completed 2026-09-09T14:47:01.247246Z 70f05c5 Manual request
🔒 Security Review Completed 2026-09-06T22:06:09.543589Z 89f6867 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.

@codecov-commenter

codecov-commenter commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.89%. Comparing base (cb6d16d) to head (ee8bbba).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3629      +/-   ##
==========================================
+ Coverage   91.86%   91.89%   +0.03%     
==========================================
  Files          20       20              
  Lines        6097     6122      +25     
==========================================
+ Hits         5601     5626      +25     
  Misses        496      496              

☔ 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 commented Sep 6, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 2e0e5c5c55

ℹ️ 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/lib.rs
Comment thread zerocopy/src/lib.rs Outdated
@joshlf
joshlf force-pushed the Gro7m5vgpfdcy3pxtpl52hnbgworclnzw branch from 2e0e5c5 to 89f6867 Compare September 6, 2026 21:58
@joshlf

joshlf commented Sep 6, 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

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 89f6867632

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

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 89f6867632

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.

Base automatically changed from Gkpenpjjuex55evmm52puxsa34xtjgc7t to main September 6, 2026 22:07
Comment thread zerocopy/src/lib.rs
Comment thread zerocopy/src/lib.rs

@jswrenn jswrenn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The alternative here is altering the contract of pointer_to_metadata to consume a NonNull, but I think that'd cause more churn than it's worth for what can instead be resolved by an extremely cute MSRV workaround.

Comment thread zerocopy/src/lib.rs Outdated
@joshlf
joshlf force-pushed the Gro7m5vgpfdcy3pxtpl52hnbgworclnzw branch from 89f6867 to 70f05c5 Compare September 9, 2026 14:38
@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

Please review exact head 70f05c5df8a2d9f036321845dc6b5b3198f52ae0, including the latest requested documentation removal.

@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: 70f05c5df8

ℹ️ 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 enabled auto-merge September 9, 2026 15:13
KnownLayout's slice implementation materialized a shared reference solely to
read raw pointer metadata. That is invalid for null, dangling, unaligned, or
otherwise non-dereferenceable slice pointers even though metadata extraction
itself must accept them.

Use the safe raw-slice pointer length API on Rust 1.79 and newer. On older
supported compilers, capture a metadata candidate through raw-pointer hashing
and authenticate it with raw slice pointer equality before returning it.
Strengthen the implementer contract and cover null, dangling, deallocated,
unaligned, derived-DST, and boundary-toolchain cases.

Closes #3615

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

gherrit-pr-id: Gro7m5vgpfdcy3pxtpl52hnbgworclnzw
@joshlf
joshlf force-pushed the Gro7m5vgpfdcy3pxtpl52hnbgworclnzw branch from 70f05c5 to ee8bbba Compare September 9, 2026 15:15
@joshlf
joshlf added this pull request to the merge queue Sep 9, 2026
Merged via the queue into main with commit 6dc9e75 Sep 9, 2026
111 checks passed
@joshlf
joshlf deleted the Gro7m5vgpfdcy3pxtpl52hnbgworclnzw branch September 9, 2026 15:45
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.

Soundness Advisory: Extracting metadata from a null raw slice creates an invalid reference

3 participants