]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
vsock/test: add MSG_PEEK after partial recv test
authorLuigi Leonardi <leonardi@redhat.com>
Wed, 15 Apr 2026 15:09:30 +0000 (17:09 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 17 Apr 2026 02:34:22 +0000 (19:34 -0700)
commit2a2675ef619010912a5826297cd3cab00d7dc697
tree9eb155b2aefa533ea3b48473352c86f6aeba3c20
parenta3f77afbf67d5ddbc8938fd5627a11221d8a3368
vsock/test: add MSG_PEEK after partial recv test

Add a test that verifies MSG_PEEK works correctly after a partial
recv().

This is to test a bug that was present in the
`virtio_transport_stream_do_peek()` when computing the number of bytes to
copy: After a partial read, the peek function didn't take into
consideration the number of bytes that were already read. So peeking the
whole buffer would cause an out-of-bounds read, that resulted in a -EFAULT.

This test does exactly this: do a partial recv on a buffer, then try to
peek the whole buffer content. The test re-uses
`test_stream_msg_peek_client()` to also cover this scenario.

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
Link: https://patch.msgid.link/20260415-fix_peek-v4-3-8207e872759e@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/vsock/vsock_test.c