All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bobby Eshleman <bobbyeshleman@meta.com>
To: Andrew Stellman <bugs@stellman-greene.com>
Cc: "Stefan Hajnoczi" <stefanha@redhat.com>,
	"Stefano Garzarella" <sgarzare@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowangio@gmail.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Simon Horman" <horms@kernel.org>,
	virtualization@lists.linux.dev, kvm@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] vsock/virtio: wait for EOM before reporting SEQPACKET readable
Date: Wed, 2 Dec 2026 15:15:29 -0800	[thread overview]
Message-ID: <axCmkcXoW3BfkfKa@devvm29614.prn0.facebook.com> (raw)
In-Reply-To: <20261202181307.73934-1-bugs@stellman-greene.com>

On Wed, Dec 02, 2026 at 01:13:07PM -0500, Andrew Stellman wrote:
> From: Andrew Stellman <astellman@stellman-greene.com>
> 
> virtio_transport_notify_poll_in() compares queued bytes with the
> receive low-water mark for every socket type, but SEQPACKET recv() only
> returns a message once its EOM packet has arrived. When only the first
> packet of a message larger than 64 KiB is queued, poll() and epoll
> report the socket readable and a nonblocking recv() returns EAGAIN.
> 
> Use the completed-message count for SEQPACKET, as recv() does. An
> incomplete message is no longer reported readable, and SO_RCVLOWAT no
> longer affects SEQPACKET poll.
> 
> Fixes: 9ac841f5e9f2 ("virtio/vsock: rest of SOCK_SEQPACKET support")
> Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
> ---
> Tested on mainline 693c2e04e3f1 (7.4.0-rc5) in arm64 QEMU with KASAN
> over vsock loopback, with a test-only three-second delay after the
> first packet: before the fix poll() and epoll reported the socket
> readable while recv() returned EAGAIN, and with the fix they didn't.
> 
> Found with Quality Playbook
> (https://github.com/andrewstellman/quality-playbook) running Claude
> Opus 5; the fix was drafted with OpenAI GPT-6 (Codex).
> 
> A reproducer is available on request.
> 
>  net/vmw_vsock/virtio_transport_common.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
> index 1e762a480df4..d659986bb48b 100644
> --- a/net/vmw_vsock/virtio_transport_common.c
> +++ b/net/vmw_vsock/virtio_transport_common.c
> @@ -1107,7 +1107,11 @@ virtio_transport_notify_poll_in(struct vsock_sock *vsk,
>  				size_t target,
>  				bool *data_ready_now)
>  {
> -	*data_ready_now = vsock_stream_has_data(vsk) >= target;
> +	/* A SEQPACKET message is readable only after its EOM packet arrives. */

I'd probably drop this comment.

> +	if (sk_vsock(vsk)->sk_type == SOCK_SEQPACKET)
> +		*data_ready_now = virtio_transport_seqpacket_has_data(vsk) != 0;
> +	else
> +		*data_ready_now = vsock_stream_has_data(vsk) >= target;

This looks good, but I also noticed that vsock_data_ready() is still
using `vsock_stream_has_data() >= sk->sk_rcvlowat`, so won't seqpacket
readers still get woken up on incomplete messages (e.g., in
virtio_transport_recv_connected())?

Maybe we should change vsock_data_ready() too to generally fix seqpacket
rcvlowat?

Best,
Bobby

      reply	other threads:[~2026-12-02 23:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 18:13 [PATCH net] vsock/virtio: wait for EOM before reporting SEQPACKET readable Andrew Stellman
2026-12-02 23:15 ` Bobby Eshleman [this message]

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=axCmkcXoW3BfkfKa@devvm29614.prn0.facebook.com \
    --to=bobbyeshleman@meta.com \
    --cc=bugs@stellman-greene.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=horms@kernel.org \
    --cc=jasowangio@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sgarzare@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.