]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
vsock/test: fix failures due to wrong SO_RCVLOWAT parameter
authorKonstantin Shkolnyy <kshk@linux.ibm.com>
Tue, 3 Dec 2024 15:06:54 +0000 (09:06 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 19:03:09 +0000 (20:03 +0100)
commitb24737a85e182ea0a91b9bccae16791a9697b706
treef091b4986d5526b7df9fd01820756ee28adbac14
parent3591bc9067185c7ae837adae2aba335018a258e8
vsock/test: fix failures due to wrong SO_RCVLOWAT parameter

[ Upstream commit 7ce1c0921a806ee7d4bb24f74a3b30c89fc5fb39 ]

This happens on 64-bit big-endian machines.
SO_RCVLOWAT requires an int parameter. However, instead of int, the test
uses unsigned long in one place and size_t in another. Both are 8 bytes
long on 64-bit machines. The kernel, having received the 8 bytes, doesn't
test for the exact size of the parameter, it only cares that it's >=
sizeof(int), and casts the 4 lower-addressed bytes to an int, which, on
a big-endian machine, contains 0. 0 doesn't trigger an error, SO_RCVLOWAT
returns with success and the socket stays with the default SO_RCVLOWAT = 1,
which results in vsock_test failures, while vsock_perf doesn't even notice
that it's failed to change it.

Fixes: b1346338fbae ("vsock_test: POLLIN + SO_RCVLOWAT test")
Fixes: 542e893fbadc ("vsock/test: two tests to check credit update logic")
Fixes: 8abbffd27ced ("test/vsock: vsock_perf utility")
Signed-off-by: Konstantin Shkolnyy <kshk@linux.ibm.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/vsock/vsock_perf.c
tools/testing/vsock/vsock_test.c