GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Align ancillary send and receive buffers by youknowdot · Pull Request #9642 · RustPython/RustPython

Conversation

@youknowdot

@youknowdot youknowdot commented Nov 3, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

Encode generic ancillary messages with checked per-message offsets and unaligned header-field stores instead of dereferencing cmsghdr pointers into a Vec<u8>. This also handles platforms such as AIX that do not pad between control messages. Keep the existing public Vec<u8> return API, documenting that its byte allocation does not promise CMSG alignment.

Add an aligned owned buffer for the Python sendmsg path. 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.15 SOCKLEN_T_LIMIT before constructing it and validate rounded allocation size. Reuse the same initialized, aligned owner for recvmsg_into control storage, including checked size and msg_controllen conversion.

The encoder uses explicit checked offsets rather than CMSG_NXTHDR while 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

  • Independent source review covered 16-byte alignment requirements, unaligned AIX headers, initialized bytes, bounds and 32-bit allocation rounding, public API, ownership and retries. No additional per-payload copy was found; performance was not benchmarked.
  • Added host-internal tests for aligned and unaligned encoding, zero/odd payloads, multiple headers, zero padding, equivalent legacy/aligned bytes, empty buffers and receive-storage alignment/size checks. These test byte-layout invariants rather than Python API behavior.
  • 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.
  • No local RustPython build or execution, host-unit-test execution, or cross-target runtime validation. Hosted CI is required; existing test_socket sendmsg coverage is also relevant where the platform supports it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowdot youknowdot changed the title Align and safely encode ancillary send buffers Align ancillary send and receive buffers Nov 3, 2026
@codspeed

codspeed Bot commented Nov 3, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:fix/ancillary-pack-safety-20261103 (b5556ee) with main (3d0f6fc)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowdot youknowdot mentioned this pull request Nov 3, 2026
Align socket receive and control argument binding #9668
Merged
youknowone
youknowone approved these changes Nov 4, 2026
View reviewed changes
@youknowdot
youknowdot force-pushed the fix/ancillary-pack-safety-20261103 branch from f201043 to b5556ee Compare November 7, 2026 21:57
@youknowone
youknowone force-pushed the fix/ancillary-pack-safety-20261103 branch from b5556ee to 86f3312 Compare November 12, 2026 04:35
@youknowone youknowone closed this Nov 12, 2026
@youknowone
youknowone force-pushed the fix/ancillary-pack-safety-20261103 branch from 86f3312 to 2933db2 Compare November 12, 2026 07:33
@youknowone youknowone mentioned this pull request Nov 12, 2026
Use aligned control buffers and CMSG macros for ancillary data #9818
Merged
@youknowone

youknowone commented Nov 12, 2026

Copy link
Copy Markdown
Member

This PR's branch was accidentally reset to main during a force push, which closed it. The reworked change (aligned ControlBuffer + the libc CMSG_* macros for sendmsg, recvmsg/recvmsg_into and sendmsg_afalg) continues in #9818.

— commented by Claude

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@youknowone youknowone youknowone approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@youknowdot @youknowone
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.