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 v2] vsock: wait for EOM before reporting SEQPACKET readable
Date: Fri, 04 Dec 2026 18:52:54 +0000 [thread overview]
Message-ID: <sashiko-outbox-250465@kernel.org> (raw)
In-Reply-To: <20261203184926.10262-1-bugs@stellman-greene.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] vsock: deferring vsock_data_ready() until EOM breaks BPF
sockmap SEQPACKET
--
commit f7a0289cd402e3133a79450eba0ffb3fc3a8bb87
Author: Andrew Stellman <astellman@stellman-greene.com>
vsock: wait for EOM before reporting SEQPACKET readable
This commit updates vsock_data_ready() and virtio_transport_notify_poll_in()
to check for a complete message rather than queued bytes on SOCK_SEQPACKET
sockets.
> 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]
Does deferring sk->sk_data_ready() until EOM break BPF sockmap verdict
programs on SOCK_SEQPACKET sockets?
When a multi-fragment SOCK_SEQPACKET message arrives (for example, split
across guest RX buffers by vhost_transport_do_send_pkt()), vvs->msg_count
stays zero on the non-EOM fragments. vsock_data_ready() then invokes
sk_psock_verdict_data_ready() only once when the EOM fragment arrives.
sk_psock_verdict_data_ready() calls virtio_transport_read_skb() once, and
virtio_transport_read_skb() only dequeues a single skb from vvs->rx_queue.
Fragments 2..N, including the EOM packet, are left stranded in vvs->rx_queue
with vvs->msg_count still 1 and no further sk_data_ready() call.
Under an SK_DROP verdict on fragment 1, vsock_bpf_recvmsg() sees
vsock_has_data() true with an empty psock queue and falls back to
__vsock_recvmsg(), delivering fragments 2..N directly to userspace and
bypassing the BPF policy.
If vsock_data_ready() is deferred until EOM, should
virtio_transport_read_skb() loop to drain vvs->rx_queue like tcp_read_skb()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203184926.10262-1-bugs@stellman-greene.com?part=1
next prev parent reply other threads:[~2026-12-04 18:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 18:49 [PATCH net v2] vsock: wait for EOM before reporting SEQPACKET readable Andrew Stellman
2026-12-04 16:12 ` Bobby Eshleman
2026-12-04 18:52 ` sashiko-bot [this message]
2026-12-04 19:13 ` 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-250465@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox