From: sashiko-bot@kernel.org
To: "Andrew Stellman" <bugs@stellman-greene.com>
Cc: virtualization@lists.linux.dev, kvm@vger.kernel.org,
"Michael S. Tsirkin" <mst@redhat.com>,
"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH net] vsock/virtio: wait for EOM before reporting SEQPACKET readable
Date: Thu, 03 Dec 2026 18:26:56 +0000 [thread overview]
Message-ID: <sashiko-outbox-248383@kernel.org> (raw)
In-Reply-To: <20261202181307.73934-1-bugs@stellman-greene.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] vsock/virtio: wakeup mismatch for SOCK_SEQPACKET in
vsock_data_ready()
--
commit 4cf63f25637b2c89719d5209aa6314e30eb8d4ba
Author: Andrew Stellman <astellman@stellman-greene.com>
vsock/virtio: wait for EOM before reporting SEQPACKET readable
This commit updates virtio_transport_notify_poll_in() to check
virtio_transport_seqpacket_has_data() instead of comparing queued bytes
against target for SOCK_SEQPACKET sockets.
> diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
> index 1e762a480df49..d659986bb48b0 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. */
> + 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;
>
> return 0;
> }
[Severity: Medium]
Should vsock_data_ready() also check for a completed message on
SOCK_SEQPACKET sockets instead of comparing vsock_stream_has_data(vsk)
against sk->sk_rcvlowat?
When virtio_transport_recv_connected() enqueues a VIRTIO_VSOCK_OP_RW
packet, it wakes waiters through vsock_data_ready():
net/vmw_vsock/af_vsock.c:vsock_data_ready() {
struct vsock_sock *vsk = vsock_sk(sk);
if (vsock_stream_has_data(vsk) >= sk->sk_rcvlowat ||
sock_flag(sk, SOCK_DONE))
sk->sk_data_ready(sk);
}
Leaving vsock_data_ready() on the byte-count and sk_rcvlowat check while
virtio_transport_notify_poll_in() checks completed messages puts the wait
and wakeup conditions out of sync. If userspace raises SO_RCVLOWAT (or a
0-byte EOM message arrives with the default sk_rcvlowat of 1), a complete
message smaller than sk_rcvlowat makes virtio_transport_notify_poll_in()
report readable, but vsock_data_ready() does not call sk_data_ready(),
leaving threads blocked in poll(), epoll_wait(), or recv(). Conversely,
each non-EOM fragment of a multi-packet message exceeds the default
sk_rcvlowat of 1 and triggers sk_data_ready() (and SIGIO for O_ASYNC
sockets) even though poll and recv() still see no completed message.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202181307.73934-1-bugs@stellman-greene.com?part=1
next prev parent reply other threads:[~2026-12-03 18:26 UTC|newest]
Thread overview: 4+ 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
2026-12-03 18:26 ` sashiko-bot [this message]
2026-12-03 19:10 ` netdev-bot+sashiko
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=sashiko-outbox-248383@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bugs@stellman-greene.com \
--cc=eperezma@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=virtualization@lists.linux.dev \
/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.