Skip to content

gh-161657: Fix SOL_SOCKET options on AF_VSOCK sockets - #161658

Open
bvolpato wants to merge 1 commit into
python:mainfrom
bvolpato:bvolpato/vsock-socket-option-level
Open

bvolpato wants to merge 1 commit into
python:mainfrom
bvolpato:bvolpato/vsock-socket-option-level

Conversation

@bvolpato

@bvolpato bvolpato commented Nov 9, 2026 •

Copy link
Copy Markdown

Fixes #161657.

AF_VSOCK sockets currently force all options through VSOCK's 64-bit integer handling. This rejects valid buffered SOL_SOCKET options such as SO_LINGER before the kernel sees them. Restrict the VSOCK-specific get/set branches to level == AF_VSOCK, so other option levels use the existing generic paths.

Add a regression that adopts an owned, unconnected Unix socket FD with an explicit Python AF_VSOCK family. It covers buffered SO_LINGER get/set, ordinary integer options, and preservation of the 64-bit VSOCK conversion path without requiring a VSOCK device or VM.

Validation: built a debug interpreter with ./configure --with-pydebug --without-ensurepip and make -j2. The new regression reproduces the buffered get/set failures before the C change and passes after it. Existing socket-option get/set/error tests also pass. Ruff and make patchcheck pass. Local test-module import probes were guarded, and syscall tracing confirmed that validation created no VSOCK endpoints and made no bind, connect, listen, or accept calls. The full test_socket suite and hardware-backed VSOCK tests were not run locally.

This contribution was prepared with AI assistance and independently reviewed for the scoped C change and regression.

@python-cla-bot

python-cla-bot Bot commented Nov 9, 2026

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T06:18:04.178607Z 02baf30 PR opened
ℹ️ 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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AF_VSOCK sockets reject buffered SOL_SOCKET options

1 participant