]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
vsock/test: add stream TX credit bounds test
authorMelbin K Mathew <mlbnkm1@gmail.com>
Wed, 21 Jan 2026 09:36:28 +0000 (10:36 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 22 Jan 2026 14:41:33 +0000 (15:41 +0100)
commit2a689f76edd04a53137bd01d4618343f4cdd7e23
tree22a6c93948b01538ac61945aa81be61fe5247536
parent8ee784fdf006cbe8739cfa093f54d326cbf54037
vsock/test: add stream TX credit bounds test

Add a regression test for the TX credit bounds fix. The test verifies
that a sender with a small local buffer size cannot queue excessive
data even when the peer advertises a large receive buffer.

The client:
  - Sets a small buffer size (64 KiB)
  - Connects to server (which advertises 2 MiB buffer)
  - Sends in non-blocking mode until EAGAIN
  - Verifies total queued data is bounded

This guards against the original vulnerability where a remote peer
could cause unbounded kernel memory allocation by advertising a large
buffer and reading slowly.

Suggested-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Melbin K Mathew <mlbnkm1@gmail.com>
[Stefano: use sock_buf_size to check the bytes sent + small fixes]
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://patch.msgid.link/20260121093628.9941-5-sgarzare@redhat.com
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/vsock/vsock_test.c