Re: [PATCH] vsock/test: fix failures due to wrong SO_RCVLOWAT parameter

From: Stefano Garzarella
Date: Thu Oct 24 2024 - 11:21:49 EST


On Thu, Oct 24, 2024 at 10:00:47AM -0500, Konstantin Shkolnyy wrote:
On 10/24/2024 03:43, Stefano Garzarella wrote:
Other setsockopt() in the tests where we use unsigned long are
SO_VM_SOCKETS_* but they are expected to be unsigned, so we should be
fine.

It's actually not "signed vs unsigned", but a "size + endianess" problem.

I see, thanks!


Also, looking at SO_VM_SOCKETS_* code in the test, it uses unsigned long and size_t which (I believe) will both shrink to 4 bytes on 32-bit machines, while the corresponding kernel code in af_vsock.c uses u64. It looks to me that this kernel code will be unhappy to receive just 4 bytes when it expects 8.


In include/uapi/linux/vm_sockets.h we talk about unsigned long long for SO_VM_SOCKETS_*, that IIUC also on 32-bit machines should be on 64bit, so the kernel code looks okay, but the tests should be improved, right?

Thanks,
Stefano