🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27098

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

#27098
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 19:13
106 lines
12191 bytes
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
Technical Details
Message-ID: <179641163064.3146.10029233264816252719@kernel.org>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377582-linux-kernel-netdev=dewy.ru
References: <20261203184926.10262-1-bugs@stellman-greene.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377582-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2] vsock: wait for EOM before reporting SEQPACKET readable
Date: Fri, 04 Dec 2026 19:13:50 +0000
Organization: Usenet Network
Message-ID: <179641163064.3146.10029233264816252719@kernel.org>
References: <20261203184926.10262-1-bugs@stellman-greene.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2840721"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:3EcT5Timq8AvR46wAIOIHRKClXQ= sha256:JQ6XhJVhoa2nro/FYQFfxzNfsg/yhQpLX4LUHITXH1Y=
	sha1:1p4/To1DtLocm/Yg1jYUS/HtNq0= sha256:D2dADuuwRrLGelQ9JYtRNFo/f76qacT8sr82G77Fj7o=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id DA9ED117CB7; Fri,  4 Dec 2026 22:14:13 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.541
X-Spam-Status: No, score=-3.541 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 2XGgZtMRnI9k;
	Fri,  4 Dec 2026 22:14:10 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377582-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 521E7117CAF; Fri,  4 Dec 2026 22:14:01 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id AC4DD60428; Fri,  4 Dec 2026 19:13:58 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796411638;
	b=clcxcWPCj1ywXpqMpVjjR+uWwEmX53/abdkY9CgC4gClXX+98iSUXiN7cTzzv3EsntJc
	 ptGrqx4YKfbfrhbZsQ8BItyNkE+ogSFYpGvhuluyJfFSzTZiYRZYYsWdlyuOcjqBJOc1h
	 NjQDRvcsdjNtSK09S+JhJpbrgT9OMfTiGX556rIJOnnPBf3M+njNBma5dXZOZAR4h5H5Z
	 CjpybVolul7sX1ypY/1/V226V/zzIZIEH/s9bM9T672bvhMNZ8Esv+Y4M89cFkCWp6Oz6
	 nYrH7Zo36pOVjcwpdh0tZdYkIM/N7YZqLRAS3msQJcwnO/0rzfnnpDleW2fzxJF0btw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796411638;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=iSIDm6rBaVlm49ELF5MwGs5t+Jx1KLn9gN1UMXktdYE=;
	b=nfs1SKquLfztQNVdJvfwfR/eYaGoyh3VJeZW5LesjUbrL+no++9QPrpASF4wBDYeWjJ8
	 Zmn7sP4o2J7rg71aH4BGYAFVk9KM+5g7eejwxvAhSZnqb4EGReBPoeALngtTnGutWbbcm
	 d/fze/Hfed8mqu5tm6kjVM6A0V/LVXJnEKgz5aa0ijjpF58jAOf62oY9vIk4GmkJxeHDg
	 05OxqxeVpz2mtDa9UgVE+ECAPIqQIr/E9OuDS/NWwmNQcbQkj2MXuHjxtmQdctoDtDt6i
	 bJ/sy5oswEuYq2/NRtBjfOsWX37kqMh9anFVPVXYPrrnzL7Gf4372eIrDVbwg6ex3hw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L8Dn18ZE;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 74162606A336;
	Fri,  4 Dec 2026 19:13:58 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L8Dn18ZE
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796411632;
	b=eUW7r1BgnzGFSsKoXP1tVF4cxJNS0KMzZRA+awI7/47E8TJU+9nF7Ac9VimDnF+2gVX+
	 fkcQmzBkpPmjU6VjFw7fPkN3oT2wlsyYQunUpiT9bqKeSiboh9VsPG9ncFF4C0SJHiyuM
	 wtbgWo/lGCD8c2IWuYv0ckcD5kyRCvWFz9/S620/qs6oTmN1O014QKDmSQKHR+6sDVfM5
	 WWVy5kH7eHkH2ReA94+m6jP5D7spAgWb4i4ImlT9zoy4oJ9h+itJbG4RQZ4ErkIjt5Kpv
	 6cRAKOVXvGyfmtkrsBrsBKXkKHLi9PmUok32uDe74+10r7KdcQ1JZGL0Jv1mgeb7nDg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796411632;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=iSIDm6rBaVlm49ELF5MwGs5t+Jx1KLn9gN1UMXktdYE=;
	b=HpFmUG7JhCT6WUoQ0T3WL/9SgM39yAnn9LqLPrW8qg72DrymBgPK2JI/94XOQgy/jGNb
	 Z8a2WAmLwIUrvJHGn9VSjdN8LAMGa0GrRpL31cpEdbAYS3CWe6XjlJowmdRHT4ATbKPGt
	 apOHQE/wDA70Nfm5WbzQlS44vC1yvOVXi6dSYJx+yJUcZxA2B5jGQZhmK0visCI4WhXBm
	 VU7q8YRkx/EbF9YWMFQ182goN4cIOL101+MdjRSp0bCQfmbUMvMlJpSgcY6unJh7SK9ng
	 A0cosvNpryjVOxCOIPDMCowlGNaHXTjqmUGwWON5/SBYqD7SIdIribq29+jiI4B9JCQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L8Dn18ZE;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90295606A322;
	Fri,  4 Dec 2026 19:13:52 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 260B91F00936;
	Fri,  4 Dec 2026 19:13:51 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796411632;
	bh=iSIDm6rBaVlm49ELF5MwGs5t+Jx1KLn9gN1UMXktdYE=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=L8Dn18ZExi5dlZik2yXteomJZohBkMJIoASY3Y9wbb01yWNzlCn/niTQfuxrAqrCz
	 DZ02Xt7fxNRK0BEYiWuhzydEgFtxWnyVnQYNNwJ+L1uyfMKY+caEk6PUg9zV2z2i2h
	 z4g3xgKWqcCgj3INbLHFWMTlui2DKTqg3/L5U6ccQBeAso3lHIQZPeKAOgMSXhvt3q
	 efLGtjEDRRUFbFk95rnoCswztgTaRxSZAV3PHkEeWsjR72xBDH8XOAberot7C13Z84
	 QXOjaJ3KMU8PSbXSSZKrzsaJ+VZI4X4pes/3q8PD3Z8pEyIEAjVxzXQXf+FsDAi3R/
	 +dVhZEmJ//jSg==
X-Cc: sgarzare@redhat.com, stefanha@redhat.com, bobbyeshleman@meta.com,
 mst@redhat.com, jasowangio@gmail.com, eperezma@redhat.com,
 xuanzhuo@linux.alibaba.com, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org,
 virtualization@lists.linux.dev, kvm@vger.kernel.org, netdev@vger.kernel.org,
 linux-kernel@vger.kernel.org
X-In-Reply-To: <20261203184926.10262-1-bugs@stellman-greene.com>
X-sashiko-severity: High
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list