Repository navigation
Conversation
Large guest HTTP requests were truncated because TX payloads spanning virtqueue descriptors were rejected, and credit updates arrived only after ordinary guest send buffers stalled.
|
Cloud Hypervisor had the same issue: cloud-hypervisor/cloud-hypervisor#7672 |
|
hey @sazlin, thanks for flagging and for the fix. could we use a |
|
could we also add a CI step for the vsock tests? the default
|
Represent borrowed guest memory and gathered TX data with PacketBuffer variants, preserving the existing payload behavior. Cover receive writes for both descriptor layouts and run the vsock tests in CI.
toksdotdev
left a comment
There was a problem hiding this comment.
thanks for the fix. made a tiny adjustment to use concrete enum types. asides that, lgtm!
Reject truncated TSI request payloads and socket addresses before parsing. Preserve the 8 MiB window for Unix and TSI streams while carrying the custom stream 64 KiB window through queued control packets. Add malformed request regressions and verify advertised custom stream credit.
Decouple the 32 KiB credit update threshold from the 8 MiB receive window for Unix and TSI streams. Waiting for 4 MiB prevents 1 MiB guest uploads from completing. Extend existing VM integration tests with 1 MiB uploads and keep the TCP test connection alive until VM exit to avoid racing its final response with host close.
Return forwarding credit only after the Unix socket accepts queued bytes, including writable-event flushes. Reject guest writes that exceed the advertised 8 MiB window and copy only the declared packet payload. Add real-socket regressions for blocked peers, credit recovery after draining, and guests that exceed their window. Both tests fail before the fix and pass on macOS and Linux.
Keep upload credit and writable polling active while downloads wait for guest receive space. Disable read polling independently, and stop writable polling once pending bytes drain. Extend the real socket backpressure regression to both connected and receive-credit-waiting states; it fails before the fix and passes on macOS and Linux.
Keep custom uploads progressing while downloads wait for guest credit. Retain undelivered credit updates and requests, and retry when RX capacity is freed without requiring socket readiness or extra backend notifications. Share control delivery across Unix and Windows, clear stale control headers, return invalid RX descriptors, and restrict TSI sends to declared payloads. Add five regressions that fail on the prior commit and pass after repair.
Context
I am employing microsandbox to sandbox an OMP agent with an OpenAI Codex subscription. I don't want the subscription credentials visible inside the vm, so I am using a vsock channel to broker/proxy OMP --> OpenAI communication through the host. So: OMP (sandboxed guest) --vsock--> Broker/Proxy (host) --internet--> OpenAI. This patch fixes libkrun’s vsock handling so complete OMP requests can reach the host-side broker without being truncated or stalled.
Problem
Large guest-to-host stream writes can arrive as a virtqueue descriptor chain.
VsockPacket::from_tx_virtq_headcurrently requires the entire declared payload in the first descriptor, logsBufDescTooSmall, and drops the remaining HTTP request. Separately, the custom stream advertises an 8 MiB receive window but returns credit only after 4 MiB; ordinary guest socket transmit buffers can stall before reaching that threshold.This was reproduced through microsandbox 0.6.17 and 0.6.18 with an HTTP POST: 32 KiB succeeds, 65,535 bytes triggers
BufDescTooSmall, and larger uploads stall.Change
Verification
virtio::vsocktests pass.The PR appears safe to merge based on the changes since the previous review.
Reviews (6) · Last reviewed commit: "fix(vsock): retry credit safely after RX..."