Repository navigation
Align ancillary send and receive buffers - #9642
Draft
youknowdot wants to merge 2 commits into
Draft
youknowdot wants to merge 2 commits into
youknowdot wants to merge 2 commits into
Conversation
Assisted-by: OpenAI Codex:model version not exposed
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
Assisted-by: OpenAI Codex:model version not exposed
Contributor
Merging this PR will not alter performance
Comparing Footnotes
|
youknowone
approved these changes
Nov 4, 2026
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.
Summary
Encode generic ancillary messages with checked per-message offsets and unaligned header-field stores instead of dereferencing
cmsghdrpointers into aVec<u8>. This also handles platforms such as AIX that do not pad between control messages. Keep the existing publicVec<u8>return API, documenting that its byte allocation does not promise CMSG alignment.Add an aligned owned buffer for the Python
sendmsgpath. The buffer is 16-byte aligned for supported platform CMSG layouts, zeroes exposed padding, stays alive through syscall retries and does not add a payload copy beyond the existing snapshots. Bound the combined control size to the CPython 3.15SOCKLEN_T_LIMITbefore constructing it and validate rounded allocation size. Reuse the same initialized, aligned owner forrecvmsg_intocontrol storage, including checked size andmsg_controllenconversion.The encoder uses explicit checked offsets rather than
CMSG_NXTHDRwhile building messages. Consequently, it can encode layouts that some previous platform macro boundary checks rejected. The existing infallible allocation policy, Python argument/iovec handling and other socket behavior are unchanged. #9640 independently addresses ancillary parsing and #9638 the AF_ALG-specific send helper.Validation
rustfmt,git diff --check, and normal repository hooks passed. Source merge-trees were clean against Fix accepting Linux AF_ALG sockets #9637, Safeguard AF_ALG control and send buffers #9638 and Safely parse unaligned ancillary messages #9640.test_socketsendmsg coverage is also relevant where the platform supports it.