Re: [PATCH net v2] vsock: wait for EOM before reporting SEQPACKET readable

From: netdev-bot+sashiko

Date: Fri Dec 04 2026 - 14:14:04 EST


Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 0 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] The patch suppresses data-ready callbacks for pre-EOM SEQPACKET
fragments, and this breaks vsock SOCK_SEQPACKET sockets that sit in a…

--

vsock: wait for EOM before reporting SEQPACKET readable

For SOCK_SEQPACKET sockets, this patch changes
virtio_transport_notify_poll_in() and vsock_data_ready() to look for a
complete message (msg_count != 0) rather than the number of queued
bytes. Poll no longer reports the socket readable, and data-ready
wakeups no longer fire, before the EOM packet has arrived.
SO_RCVLOWAT no longer affects SEQPACKET poll or wakeups.

> diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
> index 1d7d53542724f..d403d3226ef8b 100644
> --- a/net/vmw_vsock/af_vsock.c
> +++ b/net/vmw_vsock/af_vsock.c
> @@ -1117,9 +1117,10 @@ EXPORT_SYMBOL_GPL(vsock_stream_has_space);
>
> void vsock_data_ready(struct sock *sk)
> {
> + int target = sk->sk_type == SOCK_SEQPACKET ? 1 : sk->sk_rcvlowat;
> struct vsock_sock *vsk = vsock_sk(sk);
>
> - if (vsock_stream_has_data(vsk) >= sk->sk_rcvlowat ||
> + if (vsock_connectible_has_data(vsk) >= target ||
> sock_flag(sk, SOCK_DONE))
> sk->sk_data_ready(sk);
> }

[Severity: High]
Can this stall a SOCK_SEQPACKET vsock socket that is in a BPF sockmap
with a verdict program?

sock_map_sk_state_allowed() accepts established vsock SEQPACKET
sockets. When a verdict program is attached, sk_psock_start_verdict()
sets sk->sk_data_ready to sk_psock_verdict_data_ready(). That function
calls read_skb() once per callback and does not loop:

net/core/skmsg.c:sk_psock_verdict_data_ready() {
...
copied = ops->read_skb(sk, sk_psock_verdict_recv);
...
}

For virtio, read_skb() ends up in virtio_transport_read_skb(), which
dequeues a single skb and decrements msg_count only when that skb
carries EOM:

net/vmw_vsock/virtio_transport_common.c:virtio_transport_read_skb() {
...
skb = __skb_recv_datagram(sk, &vvs->rx_queue, MSG_DONTWAIT, &off, &err);
...
if (le32_to_cpu(hdr->flags) & VIRTIO_VSOCK_SEQ_EOM)
vvs->msg_count--;
...
}

Before this patch, virtio_transport_recv_connected() called
vsock_data_ready() for every enqueued packet. With the default
sk_rcvlowat of 1, each of those calls produced a callback.

A message can arrive as several skbs, F1..Fn-1 without EOM and Fn
with EOM. vhost_transport_do_send_pkt() splits host-to-guest packets
to the guest RX buffer size and keeps EOM only on the last piece. The
receive side merges only small payloads into the previous skb. With
the new gate:

F1..Fn-1 enqueued, msg_count == 0 -> no sk_data_ready()
Fn enqueued, msg_count == 1 -> one sk_data_ready()
sk_psock_verdict_data_ready()
vsock_read_skb()
virtio_transport_read_skb() -> dequeues F1 only
msg_count stays 1

F2..Fn then stay in vvs->rx_queue until another packet arrives or
SOCK_DONE is set. Each later callback drains only one more skb, so the
verdict and redirect path falls further behind with every
multi-fragment message. Wouldn't a request/response or proxy setup
hang here, since the rest of the message is never handed to the
verdict program?

The commit message says only that SO_RCVLOWAT no longer affects
SEQPACKET data-ready wakeups. It doesn't mention that pre-EOM
fragments no longer get a callback, or how that affects psock
consumers. Should the sockmap case be handled here, either by keeping
a per-skb callback when a psock is attached or by draining up to the
EOM in the read_skb path?

[ ... ]

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203184926.10262-1-bugs%40stellman-greene.com