Article View: linux.kernel.netdev
Article #26559Re: [PATCH net] vsock/virtio: wait for EOM before reporting SEQPACKET readable
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 19:10
Date: Thu, 03 Dec 2026 19:10
93 lines
11928 bytes
11928 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 1 ยท 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).
- [Medium] The patch changes when poll() reports a SEQPACKET socket
readable, but it does not change when sleeping pollers are woken.
--
vsock/virtio: wait for EOM before reporting SEQPACKET readable
For SEQPACKET sockets, this patch changes virtio_transport_notify_poll_in()
to use the completed-message count (msg_count) instead of comparing queued
bytes with the SO_RCVLOWAT target. As a result, poll() and epoll no longer
report a socket readable when only part of a message has arrived.
> 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;
[Severity: Medium]
This changes when poll() reports a SEQPACKET socket readable. Should the
wakeup side change as well?
For virtio, vhost and loopback, the RX wakeup comes from
virtio_transport_recv_connected() calling vsock_data_ready(). That happens
after virtio_transport_recv_enqueue() has done msg_count++ for an EOM packet.
vsock_data_ready() still uses the byte count and rcvlowat test:
net/vmw_vsock/af_vsock.c:vsock_data_ready() {
...
if (vsock_stream_has_data(vsk) >= sk->sk_rcvlowat ||
sock_flag(sk, SOCK_DONE))
sk->sk_data_ready(sk);
}
So msg_count can go from 0 to 1, which makes poll() readable under the new
rule, without any wakeup being sent. A couple of ways this can happen:
- Userspace sets SO_RCVLOWAT to, say, 4096 on a SEQPACKET socket and
sleeps in poll(), select() or epoll_wait(). The peer then sends a
complete 100 byte message. poll() with a zero timeout now returns
EPOLLIN, but rx_bytes is 100, which is less than 4096. The sleeping
waiter is not woken until its timeout expires, more data arrives, or
the peer shuts down. Edge-triggered epoll never sees the transition.
- With the default rcvlowat of 1, a peer sends a zero-length OP_RW
packet with VIRTIO_VSOCK_SEQ_EOM into an empty queue. msg_count is
incremented and rx_bytes stays at 0, so poll() reports readable but
no wakeup is sent. Linux senders skip zero-length OP_RW packets in
virtio_transport_send_pkt_info(), so this needs a non-Linux or
modified peer.
Before this patch, poll readiness and the wakeup used the same
rx_bytes >= rcvlowat test, so they always agreed.
The commit message says:
"SO_RCVLOWAT no longer affects SEQPACKET poll."
Isn't that only true for a non-sleeping poll? A sleeping poller is still
woken based on SO_RCVLOWAT.
Would it make sense to make vsock_data_ready() SEQPACKET-aware too? For
example, it could use the existing vsock_connectible_has_data() helper,
which already returns seqpacket_has_data() for SOCK_SEQPACKET. Another
option is to always wake for SEQPACKET once a message is complete.
> + else
> + *data_ready_now = vsock_stream_has_data(vsk) >= target;
>
> return 0;
> }
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202181307.73934-1-bugs%40stellman-greene.com
Technical Details
Message-ID:
<179632505944.3146.4004115120950433578@kernel.org>Path:
mbox-mo1.pugleaf.net!news-ams.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.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-376833-linux-kernel-netdev=dewy.ruReferences:
<20261202181307.73934-1-bugs@stellman-greene.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-ams.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.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-376833-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] vsock/virtio: wait for EOM before reporting SEQPACKET readable Date: Thu, 03 Dec 2026 19:10:59 +0000 Organization: Usenet Network Message-ID: <179632505944.3146.4004115120950433578@kernel.org> References: <20261202181307.73934-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="2573804"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:hbsQPMVrguBKDiVmribq/w8M0IY= sha256:ZnhS+isC89mvQ1w0qbhabq0T2HvsW4KPQCHoGsSxbh8= sha1:DXAZgAncr/0k6Ax1cme1fKuNtWA= sha256:3BEpCAYeXdKcD6K3a6Ou+7X5aCSoafoDQpaCUaSryhA= 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 DF549117A1A; Thu, 3 Dec 2026 22:11:24 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.64 X-Spam-Status: No, score=-3.64 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, 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] 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 Rqmko42va9Bq; Thu, 3 Dec 2026 22:11:21 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376833-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 DF45D117A0B; Thu, 3 Dec 2026 22:11:07 +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 8B2252A3B8; Thu, 3 Dec 2026 19:11:03 +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=1796325062; b=K6OaOaxDo0VT+RlBLwq+xvEzASI0DPXolAzX8x1ZILSq/A87mFIYfuXvhegFTdUBt/o6 9/KBg1RoF2Y1DWzjC+hd/QYdYWFOiix5rz05qPtNNN11bS7AQxX9YpN6qs3mbby/1YnBs 9wmKnE8DE7hok6D1r6IPg/dyZgt6cqbXvwtOUf5wYJH2+uSqePBsTtHIYE7XmkFeEKnZa FRUu2eKxaeVMhVHiZP5EpaZSqmsOjmdDaEX4L7+s8NLDfDHPcT1sRCccgxVlWYeAJT6Ti uPXQraIZvIaA8FqGvT8KqiNLDm14u7ldzLWm54b3CPV57GviJa3TaA0LSPdWoYf68PQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796325062; 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=5Fi8o/sViJo9u2mx8ebMOii5FCB1Nt69GA3vZALNt5I=; b=gn9bDXby4/AjWavIZhmN7fXRKXkDSOCGwleMXCrFUrSF0f+XQy/YjjEd6OMGDE6iP8J6 PC1a4X+z/rLTNs1VcSFxoaH7HNWWHzfZOMKVIulJa50yja8R8CoN0ym9RDT7fYOFBmxso ErpXI006IA2aT10Jtz+syHADJaJBRUC778VjyBMRnRgLHKDLDAGbFOSpZ+1sc88LtCTcF wt/RfaIhB/WoeR9II5XUU6l+qvKzqcAqePzttuIW7Masr+0iA5ouSL7NDrhDmI9/wf3bf V9FHW33DRzVlQoMAotZ8mFaTkIdffKktoygvzlQ4ZMH1TewV53cyqc2MYI1U4PgN/SA== 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="ej/7ZKwm"; 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 0BA8160A2623; Thu, 3 Dec 2026 19:11:02 +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=ej/7ZKwm 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=1796325061; b=mtJDrNg+NoSppcl2z1gV0zmGHsTJU7L31gLysXN9i8oU57uE7cdNsvMGb+lB4KlCSLAk bmj7/BVnrRiltCTIZNkNGajcjop3L5M6jA4Zc+8Tumd89yXPGhmfV1Z7iB4XtxB2gGcE6 2oX+KgVIuRslf7CVNa+sIrAOcezCpaMNHyHAlubxKmtE4xDNsGfhSrW2r4lqBDWWNKlC9 Oyj56n7KZeLIOHe4FuTTF/ZoTL4rKLp1YODlGEUDlXKRPLjgd4qIDcK6WGz3u5Mf+C8eu cAjSYAcGKLb5uaMw2oEXRLxxAEsU3LQKMwg1pjJiu1PgaUVvs3NwWKyUivhnmohU5Sg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796325061; 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=5Fi8o/sViJo9u2mx8ebMOii5FCB1Nt69GA3vZALNt5I=; b=ia1SM/xH5WeZKVCCWXVJDQpOUn0veNOeeeMooZJG4werXD0eKYOD+aHIYWvwxPuiCHZy 5eWPc9sUGWu7X1y1l4ym2ws6KNBIZTqZrDfP+cNoEnRxejNlIRERAYdByuXXPzLf2UMbB E74SauATk7CTClmQ5k1/4nW5JMYxkZthalpdbh97+AU04oY4sefcIGarUtR/zTkQOhH/h g21kb60lYg35GitU9QP7MeoMDZdWlYHRmmPO+lcLXNeB/sk4ERqdfYPtrSiuBrO9BbF2h umpgFnmtIgEJchjXyBmn9lL8OZlxOGBXDjNAKBtiUtKiqalEefFBVzxkUavkgRGUi3Q== 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="ej/7ZKwm"; 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 29B4C60A2604; Thu, 3 Dec 2026 19:11:00 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCD1A1F000C2; Thu, 3 Dec 2026 19:10:59 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796325060; bh=5Fi8o/sViJo9u2mx8ebMOii5FCB1Nt69GA3vZALNt5I=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=ej/7ZKwm8wwhjklGWY7qo0RD+VdXvzdaSlmJezv5Das+1JrvP3GPJjHXP0U+DV5Oi vk3BMvN/Xlz9J/Elklkw+b4Ru4SN/KaOHntHVfyJfZLZ81pUl+IwVPW4xBvR8H/x8F J98N9FeLiWwk8Rd+7gYs6YHyJfyodxeRs/Xq7N1ybZBlyP9cQ/mNZTqzEf7Xs4cHU2 6Ic4yM0In+kGdJkAfpOIQMKIP7qF+FjGu/GupVk8wF06GLSRxANHZc6d6Hj2bLqM7K gSS/uaH4ILUinwTaVC/cYxHoPv+Z+WrMEaImauRo65eprWORmF9WDkV6tS/KxZM7mf WnZ0ayaDa50ew== X-Cc: stefanha@redhat.com, sgarzare@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, horms@kernel.org, virtualization@lists.linux.dev, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261202181307.73934-1-bugs@stellman-greene.com> X-sashiko-severity: Medium 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