Skip to content

Preserve nested DST padding in layout formulas - #3630

Open
joshlf wants to merge 1 commit into
mainfrom
Gxauzb34ce7e537xqailxsfsyzknfjcnl
Open

Preserve nested DST padding in layout formulas#3630
joshlf wants to merge 1 commit into
mainfrom
Gxauzb34ce7e537xqailxsfsyzknfjcnl

Conversation

@joshlf

@joshlf joshlf commented Sep 5, 2026

Copy link
Copy Markdown
Member

DstLayout flattened a nested slice DST's trailing-padding operation into the
alignment of its packed outer container. That could understate the Rust object
size, causing safe parsers and allocators to construct references and boxes
whose referents extended beyond their backing storage.

Represent slice-DST sizes as a normalized prefix plus an independently rounded
inner size. Carry that formula through composition, padding, metadata
inference, casts, projections, allocation, and split overlap checks. Add
regressions for the reported 8-byte-versus-10-byte packed layout, parsing,
allocation, zeroing, projection, metadata plateaus, and dynamic padding.

Closes #3617

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


Latest Update: v12 — Compare vs v11

📚 Full Patch History

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

Version v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v8 v7 v6 v5 v4 v3 v2 v1 Base
v7 v6 v5 v4 v3 v2 v1 Base
v6 v5 v4 v3 v2 v1 Base
v5 v4 v3 v2 v1 Base
v4 v3 v2 v1 Base
v3 v2 v1 Base
v2 v1 Base
v1 Base
⬇️ Download this PR

Branch

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

Checkout

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

Cherry Pick

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

Pull

git pull origin refs/heads/Gxauzb34ce7e537xqailxsfsyzknfjcnl

Stacked PRs enabled by GHerrit.

@codecov-commenter

codecov-commenter commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.60870% with 80 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.50%. Comparing base (2dad389) to head (aa40dc7).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
zerocopy/src/layout.rs 72.75% 79 Missing ⚠️
zerocopy/src/util/mod.rs 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3630      +/-   ##
==========================================
- Coverage   91.85%   91.50%   -0.36%     
==========================================
  Files          20       20              
  Lines        6093     6477     +384     
==========================================
+ Hits         5597     5927     +330     
- Misses        496      550      +54     

☔ 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: 4fe26d3863

ℹ️ 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
@joshlf
joshlf force-pushed the Gxauzb34ce7e537xqailxsfsyzknfjcnl branch 4 times, most recently from 3117a9b to d571d1b Compare September 5, 2026 23:51
@joshlf

joshlf commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

@codex review

@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-07T02:34:12.960846Z aa40dc7 Manual request
🔒 Security Review Completed 2026-09-07T02:34:34.837304Z aa40dc7 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.

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

ℹ️ 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
@joshlf
joshlf force-pushed the Gxauzb34ce7e537xqailxsfsyzknfjcnl branch from d571d1b to ced349d Compare September 6, 2026 00:09
@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. Can't wait for the next one!

Reviewed commit: ced349d715

ℹ️ 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/layout.rs
Comment thread zerocopy/src/layout.rs Outdated
Comment thread zerocopy/src/split_at.rs Outdated
Comment thread zerocopy/src/split_at.rs Outdated
Comment thread zerocopy/src/split_at.rs Outdated
Comment thread zerocopy/src/lib.rs Outdated
Comment thread zerocopy/src/lib.rs
@joshlf
joshlf force-pushed the Gxauzb34ce7e537xqailxsfsyzknfjcnl branch from ced349d to 5da0dec Compare September 6, 2026 23:20
@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. Chef's kiss.

Reviewed commit: 5da0decc6e

ℹ️ 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: 5da0decc6e

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.

Comment thread zerocopy/src/split_at.rs Outdated
@joshlf
joshlf force-pushed the Gxauzb34ce7e537xqailxsfsyzknfjcnl branch from 5da0dec to 96a2892 Compare September 7, 2026 02:07
@joshlf

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

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

Reviewed commit: 96a2892d47

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: 96a2892d47

ℹ️ 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/split_at.rs Outdated
Comment thread zerocopy/src/layout.rs Outdated
@joshlf
joshlf force-pushed the Gxauzb34ce7e537xqailxsfsyzknfjcnl branch from 96a2892 to 13952ba Compare September 7, 2026 02:16
DstLayout flattened a nested slice DST's trailing-padding operation into the
alignment of its packed outer container. That could understate the Rust object
size, causing safe parsers and allocators to construct references and boxes
whose referents extended beyond their backing storage.

Represent slice-DST sizes as a normalized prefix plus an independently rounded
inner size. Carry that formula through composition, padding, metadata
inference, casts, projections, allocation, and split overlap checks. Add
regressions for the reported 8-byte-versus-10-byte packed layout, parsing,
allocation, zeroing, projection, metadata plateaus, and dynamic padding.

Closes #3617

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

gherrit-pr-id: Gxauzb34ce7e537xqailxsfsyzknfjcnl
@joshlf
joshlf force-pushed the Gxauzb34ce7e537xqailxsfsyzknfjcnl branch from 13952ba to aa40dc7 Compare September 7, 2026 02:23
@joshlf

joshlf commented Sep 7, 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. More of your lovely PRs please.

Reviewed commit: aa40dc7ee4

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

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.

joshlf added a commit that referenced this pull request Sep 7, 2026
DstLayout flattened a nested slice DST's trailing-padding operation into the alignment of its packed outer container. That could understate the Rust object size, causing safe parsers and allocators to construct references and boxes whose referents extended beyond their backing storage.

Represent slice-DST sizes as C + round_up(r + nE, A), encoding A and r in one nonzero word. Carry that four-word layout formula through composition, padding, metadata inference, casts, projections, allocation, and split overlap checks.

This is a smaller state-model alternative to #3630. Exhaustive reduced-width model checking matches #3630's core formula transforms and representability behavior, and the checked benchmark snapshots are byte-for-byte identical.

Add regression coverage for compiler-accepted generic packed/aligned nesting, parsing, allocation, zeroing, projection, metadata plateaus, and dynamic padding. Add modular Kani proofs for the normal form, transforms, inverse validator, affine cast arithmetic, alignment, containment, the conservative dynamic-padding predicate, and both modern and MSRV unchecked-arithmetic implementations. The arithmetic proofs are conditional on the documented compiler-layout premise; regression and Miri coverage exercise the actual compiler layout and pointer paths.

Closes #3617

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

gherrit-pr-id: Ger2cetjqc3naucboffw4r4hal423gaa5
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.

Security Advisory: Nested packed DST layouts underallocate memory and permit out-of-bounds access

3 participants