Re: [RFC PATCH v1 3/3] af_vsock: SOCK_SEQPACKET broken buffer test

From: Stefano Garzarella
Date: Tue Mar 15 2022 - 07:49:40 EST


On Tue, Mar 15, 2022 at 09:34:35AM +0000, Krasnov Arseniy Vladimirovich wrote:
On 15.03.2022 11:36, Stefano Garzarella wrote:

Is this the right behavior? If read() fails because the buffer is invalid, do we throw out the whole packet?

I was expecting the packet not to be consumed, have you tried AF_UNIX, does it have the same behavior?

I've just checked AF_UNIX implementation of SEQPACKET receive in net/unix/af_unix.c. So, if 'skb_copy_datagram_msg()'
fails, it calls 'skb_free_datagram()'. I think this means that whole sk buff will be dropped, but anyway, i'll check
this behaviour in practice. See '__unix_dgram_recvmsg()' in net/unix/af_unix.c.


Yep. you are right it seems to be discarded but I don't know that
code very well, so better to test as you said ;-)

Thanks,
Stefano