Repository navigation
Align ancillary send and receive buffers - #9642
youknowdot wants to merge 0 commit into
Conversation
|
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. |
Merging this PR will not alter performance
Comparing Footnotes
|
f201043 to
b5556ee
Compare
b5556ee to
86f3312
Compare
86f3312 to
2933db2
Compare
|
This PR's branch was accidentally reset to — commented by Claude |
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.