Skip to content

vsock : start forward-listen stream polling after guest accepts - #992

Open
vatsalkeshav wants to merge 1 commit into
rust-vmm:mainfrom
vatsalkeshav:vsock-fix
Open

vsock : start forward-listen stream polling after guest accepts#992
vatsalkeshav wants to merge 1 commit into
rust-vmm:mainfrom
vatsalkeshav:vsock-fix

Conversation

@vatsalkeshav

@vatsalkeshav vatsalkeshav commented Aug 23, 2026

Copy link
Copy Markdown

Summary of the PR

Fixes #963

This pr fixes host-initiated forward-listen connection so host-side data is not polled before the guest-side vsock connection is accepted

Previously, VhostUserVsockThread::handle_event() accepted the host socket, sent VSOCK_OP_REQUEST to the guest, immediately registered the host stream for polling, and in case the host writes before the guest replies with VSOCK_OP_RESPONSE, the backend read host bytes before the guest-side connection was ready -- and they're not forwarded to the guest which sees eof/0 bytes when eventually connected with VSOCK_OP_RESPONSE

Now host-initiated forward-listen streams are not registered for EPOLLIN | EPOLLOUT immediately after accept -- which now sends the guest connection VSOCK_OP_REQUEST first and waits for VSOCK_OP_RESPONSE to start host stream polling in vhost-device-vsock/src/vsock_conn.rs

Requirements

Before submitting your PR, please make sure you addressed the following
requirements:

  • All commits in this PR have Signed-Off-By trailers (with
    git commit -s), and the commit message has max 60 characters for the
    summary and max 75 characters for each description line.
  • All added/changed functionality has a corresponding unit/integration
    test -- repro requires host-to-guest forward-listen path with QEMU side, guest vsock endpoint, timing where the host writes before guest's VSOCK_OP_RESPONSE
  • All added/changed public-facing functionality has entries in the "Upcoming
    Release" section of CHANGELOG.md (if no such section exists, please create one).
  • Any newly added unsafe code is properly documented.

@vatsalkeshav
vatsalkeshav force-pushed the vsock-fix branch 2 times, most recently from ae4b1aa to 287a213 Compare August 23, 2026 02:33
@vatsalkeshav vatsalkeshav changed the title vsock : forward-listen stream polling after guest accepts vsock : start forward-listen stream polling after guest accepts Aug 23, 2026
@vatsalkeshav
vatsalkeshav force-pushed the vsock-fix branch 2 times, most recently from f670249 to 32a4975 Compare August 23, 2026 02:45
poll host-initiated forward-listen stream/s after
guest-side connection has completed with VSOCK_OP_RESPONSE

this prevents data sent immediately after host
connect from being read before the guest endpoint is ready

Signed-off-by: vatsalkeshav <vatsalkeshav224@gmail.com>
@vatsalkeshav

Copy link
Copy Markdown
Author

rebased

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vsock: 0 byte receive in guest after accept

1 participant