Skip to content

vsock/virtio: fix TX credit handling

Melbin K Mathew kvm lkml netdev virtualization 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v4 Latest4 patches 8 repliesIn review

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4vsock/virtio: fix potential underflow in virtio_transport_get_credit()net/vmw_vsock/virtio_transport_common.c+14 -31 reply
2/4vsock/virtio: cap TX credit to local buffer sizenet/vmw_vsock/virtio_transport_common.c+16 -32 replies
3/4vsock/test: fix seqpacket message bounds testtools/testing/vsock/vsock_test.c+11 -01 reply
4/4vsock/test: add stream TX credit bounds testtools/testing/vsock/vsock_test.c+103 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH net v4 0/4] vsock/virtio: fix TX credit handling

This series fixes TX credit handling in virtio-vsock:

Patch 1: Fix potential underflow in get_credit() using s64 arithmetic Patch 2: Cap TX credit to local buffer size (security hardening) Patch 3: Fix vsock_test seqpacket bounds test
Patch 4: Add stream TX credit bounds regression test

The core issue is that a malicious guest can advertise a huge buffer size via SO_VM_SOCKETS_BUFFER_SIZE, causing the host to allocate excessive sk_buff memory when sending data to that guest.

On an unpatched Ubuntu 22.04 host (~64 GiB RAM), running a PoC with 32 guest vsock connections advertising 2 GiB each and reading slowly drove Slab/SUnreclaim from ~0.5 GiB to ~57 GiB; the system only recovered after killing the QEMU process.

With this series applied, the same PoC shows only ~35 MiB increase in Slab/SUnreclaim, no host OOM, and the guest remains responsive.

Signature · 1 line
2.34.1