Netdev List
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: Ren Wei <weir@nebusec.ai>
Cc: virtualization@lists.linux.dev, netdev@vger.kernel.org,
	 bobbyeshleman@meta.com, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org,  pabeni@redhat.com,
	willemb@google.com, horms@kernel.org,
	 arseny.krasnov@kaspersky.com, vega@nebusec.ai,
	caoruide123@gmail.com
Subject: Re: [PATCH net 1/2] vsock: preserve receive timeout across partial reads
Date: Tue, 1 Dec 2026 15:32:55 +0100	[thread overview]
Message-ID: <aw6_gV9bFE3yO_EQ@sgarzare-redhat> (raw)
In-Reply-To: <e8c2a7015710acbd5fb1832fd03659414465a399.1795587333.git.caoruide123@gmail.com>

On Fri, Nov 27, 2026 at 01:19:13PM +0800, Ren Wei wrote:
> From: Ruide Cao <caoruide123@gmail.com>
> 
> __vsock_stream_recvmsg() passes its receive timeout by value to
> vsock_connectible_wait_data(). schedule_timeout() therefore updates only
> the helper's local copy. After a partial dequeue, the stream receive loop
> calls the helper again with the original timeout, allowing a peer to
> restart SO_RCVTIMEO with periodic short writes.
> 
> This was found with LLM assistance on the Vega platform and reproduced
> with the platform PoC in QEMU as an unprivileged user on
> VMADDR_CID_LOCAL. recv(MSG_WAITALL, 6) with SO_RCVTIMEO=1s returned 6
> bytes after ~4.8s while the peer sent one byte every 0.8s:
> 
>     client: recv(MSG_WAITALL, 6) returned 6 after 4.816 s (timeout=1 s)
>     RESULT: bug observed. Finite SO_RCVTIMEO did not cap total wait time.
> 
> Pass the timeout by reference so the remaining time is retained across
> partial reads. This makes the receive wait budget cumulative without
> changing the existing blocking behavior. The seqpacket call site is
> updated the same way; it only waits once, so the change is mechanical.
> 
> Fixes: b3f7fd54881b ("af_vsock: separate wait data loop")
> Cc: stable@vger.kernel.org
> Reported-by: Vega <vega@nebusec.ai>
> Signed-off-by: Ruide Cao <caoruide123@gmail.com>
> Signed-off-by: Ren Wei <weir@nebusec.ai>
> ---
>  net/vmw_vsock/af_vsock.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)

LGTM, thanks!

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>


  parent reply	other threads:[~2026-12-01 14:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27  5:19 [PATCH net 0/2] vsock: preserve receive timeout across partial reads Ren Wei
2026-11-27  5:19 ` [PATCH net 1/2] " Ren Wei
2026-11-29  6:34   ` Jiaming Fan
2026-12-01 14:32   ` Stefano Garzarella [this message]
2026-11-27  5:19 ` [PATCH net 2/2] vsock/test: add stream MSG_WAITALL receive timeout test Ren Wei
2026-11-28  5:56   ` netdev-bot+sashiko
2026-11-29  6:34   ` Jiaming Fan
2026-12-01 14:33   ` Stefano Garzarella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aw6_gV9bFE3yO_EQ@sgarzare-redhat \
    --to=sgarzare@redhat.com \
    --cc=arseny.krasnov@kaspersky.com \
    --cc=bobbyeshleman@meta.com \
    --cc=caoruide123@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vega@nebusec.ai \
    --cc=virtualization@lists.linux.dev \
    --cc=weir@nebusec.ai \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox