Skip to content

sys/linux: fix and extend AF_VSOCK descriptions - #8086

Merged
a-nogikh merged 1 commit into
google:masterfrom
roglew:vsock-descriptions
Oct 30, 2026
Merged

a-nogikh merged 1 commit into
google:masterfrom
roglew:vsock-descriptions

Conversation

@roglew

@roglew roglew commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Split out of #8049 as requested.

accept4$vsock_stream passed addrlen by value, so accept4() always failed with -EFAULT and accepted sockets never reached the fuzzer. The descriptions also had no SOCK_SEQPACKET sockets, no svm_flags/VMADDR_FLAG_TO_HOST, no getsockopt or 64-bit connect timeout, and no typed MSG_ZEROCOPY path.

vsock diag dumps used the 2-byte generic sock_diag_req. vsock_diag_handler_dump() rejects it because it needs a 24-byte struct vsock_diag_req.

This fixes accept4$vsock_stream and splits svm_zero into svm_flags and padding. It adds socket$vsock_seqpacket, getsockopt$vsock, setsockopt$SO_VM_SOCKETS_CONNECT_TIMEOUT_NEW, setsockopt$SO_ZEROCOPY_vsock, sendmsg$vsock_stream and sendmsg$vsock_diag. Per the review comment on #8049, sendmsg$vsock_stream uses a vsock-specific send_msghdr_vsock without a destination, since vsock_connectible_sendmsg() rejects one.

Manual seeds cover loopback stream (zerocopy, diag), seqpacket and vhost-vsock transport selection.

Tested: make descriptions; the seeds parse in strict mode on all arches (pkg/runtest TestParsing); pkg/csource tests.

`accept4$vsock_stream` passed `addrlen` by value, so `accept4()` always failed
with `-EFAULT` and accepted sockets never reached the fuzzer. The descriptions
also had no `SOCK_SEQPACKET` sockets, no `svm_flags`/`VMADDR_FLAG_TO_HOST`, no
`getsockopt` or 64-bit connect timeout, and no typed `MSG_ZEROCOPY` path. vsock
diag dumps used the 2-byte generic `sock_diag_req`, which
`vsock_diag_handler_dump()` rejects because it needs a 24-byte
`struct vsock_diag_req`.

Fix `accept4$vsock_stream`, split `svm_zero` into `svm_flags` and padding, and
add `socket$vsock_seqpacket`, `getsockopt$vsock`,
`setsockopt$SO_VM_SOCKETS_CONNECT_TIMEOUT_NEW`, `setsockopt$SO_ZEROCOPY_vsock`,
`sendmsg$vsock_stream`, and `sendmsg$vsock_diag`. `sendmsg$vsock_stream` uses a
vsock-specific `send_msghdr_vsock` without a destination, since
`vsock_connectible_sendmsg()` rejects messages that carry one. Add manual seed
programs for loopback stream (including zerocopy and diag), seqpacket, and
vhost-vsock transport selection.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request expands the Linux system call descriptions for AF_VSOCK, adding support for SOCK_SEQPACKET, getsockopt, sendmsg, SO_ZEROCOPY, and vsock_diag netlink monitoring, along with corresponding test cases. The feedback suggests defining a flag set for the vdiag_show field in vsock_diag_req instead of hardcoding it to a constant zero, which will allow the fuzzer to properly exercise the kernel's detailed socket info paths.

Comment thread sys/linux/socket_vnet.txt Resolved
@github-actions github-actions Bot added the well-shaped PR has no conflicts and all checks pass label Oct 30, 2026
@a-nogikh
a-nogikh enabled auto-merge October 30, 2026 22:17
@a-nogikh
a-nogikh added this pull request to the merge queue Oct 30, 2026
Merged via the queue into google:master with commit 2041d3f Oct 30, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

well-shaped PR has no conflicts and all checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants