🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7147

Re: [PATCH net v5 1/7] net: account for ingress-resolved virtio net hdr state

#7147
From: netdev-bot+sashiko
Date: Sun, 25 Oct 2026 05:30
153 lines
13900 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

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

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 concern: the newly checked virtio_net_hdr_to_skb() call in
  raw_verify_header() (arch/um/drivers/vector_transports.c:213) runs on…
- [Low] This patch quietly includes a real behaviour fix for the UML
  vector raw transport.
- [Low] The concern: at this commit, virtio_net_hdr_to_skb(),
  __virtio_net_hdr_to_skb() and virtio_net_hdr_tnl_to_skb() in…

--

net: account for ingress-resolved virtio net hdr state

This commit changes callers of virtio_net_hdr_to_skb() and
virtio_net_hdr_tnl_to_skb() to treat only negative return values as errors.
It prepares for a later patch that returns a positive value when the
checksum is completed in software. It also makes the UML vector raw
transport check the return value, and adds a tun ethtool -S counter,
rx_csum_sw, for the positive case.

> diff --git a/arch/um/drivers/vector_transports.c b/arch/um/drivers/vector_transports.c
> index e1fb2a76fdff5..8b75484586635 100644
> --- a/arch/um/drivers/vector_transports.c
> +++ b/arch/um/drivers/vector_transports.c
> @@ -210,7 +210,9 @@ static int raw_verify_header(
>  		return 1;
>  
>  	skb_set_network_header(skb, ETH_HLEN);
> -	virtio_net_hdr_to_skb(skb, vheader, virtio_legacy_is_little_endian());
> +	if (virtio_net_hdr_to_skb(skb, vheader,
> +			virtio_legacy_is_little_endian()) < 0)
> +		return -1;
>  	return 0;
>  }

[Severity: Medium]
Can this drop valid frames at this point in the series? The skb passed in
here has not been trimmed to the received length yet. prep_skb() sizes it
to the whole receive buffer:

arch/um/drivers/vector_kern.c:prep_skb() {
    ...
	skb_put(result, vp->max_packet);
	result->data_len = len - vp->max_packet;
	result->len += len - vp->max_packet;
    ...
}

Both vector_legacy_rx() and vector_mmsg_rx() call verify_header() before
pskb_trim():

arch/um/drivers/vector_kern.c:vector_legacy_rx() {
    ...
				header_check = vp->verify_header(
					vp->header_rxbuffer, skb, vp);
				if (header_check < 0) {
    ...
			pskb_trim(skb, pkt_len - vp->rx_header_size);
    ...
}

That means the length checks in __virtio_net_hdr_to_skb() compare against
the buffer size (65536 with GSO), not the packet length. Take the USO check:

	if (skb->len - p_off > gso_size * UDP_MAX_SEGMENTS)
		return -EINVAL;

With a 64K buffer, this rejects a valid USO frame whose gso_size is below
about 511. Before this patch the error was ignored. Now raw_verify_header()
returns -1, and the caller frees the skb and increments rx_encaps_errors.

The same ordering also lets csum_start/csum_offset values that point past
the real packet, but still inside the buffer, pass validation.

The next patch in the series, "um: vector: trim skbs before verifying the
header", moves pskb_trim() ahead of verify_header() in both RX paths. That
fixes this, so only intermediate bisect points are affected. Could the trim
come before this change, or be folded into it?

[Severity: Low]
This hunk looks like a real behaviour fix for the UML raw transport, not
accounting preparation. The commit message says:

    The um vector raw transport even ignored the return value
    altogether: rejected packets went on into the stack with their
    metadata unvalidated, so check it there as well.

The return value has been ignored since commit 49da7e64f33e ("High
Performance UML Vector Network Driver").

For example, __virtio_net_hdr_to_skb() can call skb_partial_csum_set(),
which sets CHECKSUM_PARTIAL along with csum_start/csum_offset, and then
return -EINVAL from a later check. The old code still delivered that skb.

Should this be a separate UML patch, ordered together with the trim fix
from "um: vector: trim skbs before verifying the header", and carrying:

Fixes: 49da7e64f33e ("High Performance UML Vector Network Driver")

Right now the fix sits in a patch whose subject reads as accounting-only
and which also adds a new tun ethtool string. That makes it hard to pick
up cleanly for stable.

> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 7cca1a6f72ff4..133923317eae8 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c

[ ... ]

> @@ -1939,10 +1940,14 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
>  		break;
>  	}
>  
> -	if (tun_vnet_hdr_tnl_to_skb(tun->flags, features, skb, &hdr)) {
> +	err = tun_vnet_hdr_tnl_to_skb(tun->flags, features, skb, &hdr);
> +	if (err < 0) {
>  		atomic_long_inc(&tun->rx_frame_errors);
>  		err = -EINVAL;
>  		goto free_skb;
> +	} else if (err > 0) {
> +		atomic64_inc(&tun->rx_csum_sw);
> +		err = 0;
>  	}

[Severity: Low]
Can err be positive here at this commit? At this revision,
virtio_net_hdr_to_skb(), __virtio_net_hdr_to_skb() and
virtio_net_hdr_tnl_to_skb() in include/linux/virtio_net.h appear to return
only 0 or -EINVAL.

If so, this branch and the matching ret > 0 branch in tun_xdp_one() can't
be reached. The new rx_csum_sw value reported by tun_get_ethtool_stats()
would always read 0.

The later patch "net: resolve uncommon partial checksums at ingress"
documents the tri-state return and adds
__virtio_net_resolve_csum_partial_mismatch(), which returns
skb_checksum_help(skb) ?: 1. That makes these branches live at the end of
the series, so this only affects intermediate bisect points.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.v5.git.mst%40redhat.com
Technical Details
Message-ID: <179290625983.3134.1093878831391467849@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351487-linux-kernel-netdev=dewy.ru
References: <94796ee3c32e50665ecf70e2b390db1bc2773be9.1792668082.git.mst@redhat.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351487-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v5 1/7] net: account for ingress-resolved virtio net hdr state
Date: Sun, 25 Oct 2026 05:30:59 +0000
Organization: Usenet Network
Message-ID: <179290625983.3134.1093878831391467849@kernel.org>
References: <94796ee3c32e50665ecf70e2b390db1bc2773be9.1792668082.git.mst@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="946089"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:6WGOgc/0q2/J+rNLLUlCJii52Js= sha256:LudgDN7n5yGtuZLIfx8w2Qf1pfHxbHOWb33MOJT+zkI=
	sha1:unBSCE3yvOdZpUnamelGBcCzBFQ= sha256:uNUoswOeolBDHe7zr0NoEqdboVLPT4w/4GFEiBiSwXQ=
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 7C76D125B2A; Sun, 25 Oct 2026 08:31:38 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.739
X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, 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 lEpqLWflerlL;
	Sun, 25 Oct 2026 08:31:34 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-351487-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id CEFF5125B27; Sun, 25 Oct 2026 08:31:23 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 8364125B72; Sun, 25 Oct 2026 05:31:09 +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=1792906267;
	b=uVKoiA+68pbBDV961tTQLr3uBssF9503AkzqubrTL56cgYAnEilMSJeE6JIvZ/3Iczip
	 /G6fq2gtu/vhU5feHcgaWmMGLgoJ+w8b4HtPCWuj1a0P9OEWbOGED3HikE7kHTzksh4wR
	 2CN3oKUs3fd4TDu/AAhisN+f3iuIFnIJRWhKM696JayeVA5VnN4DOfPxYrderjw+rHsQe
	 VhtDf4arlLFCvkw9HBkv1h32o9oZK2Mml1/o0ZR0Sdf2S5cCcDoEOe3Tm+tq/5XdTL6uR
	 uQnH0SNSQZsNBzStbvCOW7C/GCdJOK0bmNMe4OxBHVLHkCjkaJcHNLyMdH+xU+VieYA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792906267;
	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=ZzKajPNZhJBaeiX7KrF0L4LRhebWXvs6tMtkK6E+pA4=;
	b=xL1Qub00A+zgL4wncf77MvihVcty+6ybcUqxnKgoj/GXYyEhQrqliyP9DmXE26B6ZsP2
	 M5oUw6YOLhDLbsaxAVMA9w7rbWOjeHbLsDdbfUQpYLteS0s/v7YS/CNd9W/MpaAafr8H1
	 GqU/7KUVm3WFDd2Fi+eNicaQG3gb4V+2nTYaDZo9bpE6+0gP47zPiuhr9A1I30WhY3KX+
	 9DyE1YKBYshQZgEtc7mBu8bUItL/6qCh2E498H6IqBfN75ezw7O3k5vTv9NzR4gL5RcsX
	 kxj4HdZMGq3S0iXDiIJ4Sh93CBcJA1AQWhx9Qi/517jtYACDHwZqzJBzhqg0TrfuFBw==
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=XIQDBQGY;
	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 DB94860A2600;
	Sun, 25 Oct 2026 05:31:07 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XIQDBQGY
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=1792906262;
	b=cI31XP9sxKnuGiQfBJLQ/tMLHRbB6X5H0izF2LLp2KbMvg1PNOgv5D/BYM4eFOApFvPZ
	 uS8ZlLdm7zF+n/WgroRhnr/dnCNEoKXmr5gMrYJqJ6USVZlXXUlsuGb1Rn6iwl9tTETFX
	 GWTNl6Xry+I3PK9ca/5V4lCLL1ho2JWrjLJ3TMzgFUJ0hvckqqeMNXkVc5+rG0S23Vl2p
	 3dcCb3VDPF0T7PdPxyyfpN/nfT3S+EQdil89hu2qBaYAgdbQUb3NJ65iIKC5fuKGT0xur
	 OEbvZNNL5fR3zHp4Tbz/Y7Y1zQjKmngSokazZLWn4q+jF+CUQOsOvrdWu+ILlCQE5rg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792906262;
	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=ZzKajPNZhJBaeiX7KrF0L4LRhebWXvs6tMtkK6E+pA4=;
	b=zCV8CX4B+mV3BeHNwdhYfMdMueUTh5EV92hBL4xSWjaH6WOfE3yisoSLI5ykNku42tkk
	 83sRmWD/7Mf0umpUM3ek4zl5vUm8w1nmaAIJhic9deimTlZKqk25boZYOGWKFA5LTrObr
	 wp6hyASZICxkUJgTcSUx6RK+raWJ5frM7gUfVy2Hy2KvRbf7rHb9/c7eVUBARMICG9Y0t
	 HbFIlw7xfssUktI5MOznDQbXIu2flNxoLjsE+ACZfaaKz3h+eXHR2mdND3Wj1+cJJKpS8
	 hLXGOLZYYOUg+t2sAzINBnlRtFbzEQR6a8U+3yvYcze2dRpR7LJ+kR5lyiVbupALwbg==
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=XIQDBQGY;
	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 A63EA606A31A;
	Sun, 25 Oct 2026 05:31:01 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 584C41F01825;
	Sun, 25 Oct 2026 05:31:00 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792906261;
	bh=ZzKajPNZhJBaeiX7KrF0L4LRhebWXvs6tMtkK6E+pA4=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=XIQDBQGYo0HizMSKxpCpMD164TC/u5LTwuqveTngIR6NYP8e2MI8LnG/XMqXFTSeI
	 waYdtcOz2Qy2KpLbYJZG2dQl/3HRqD4+xe03eeV1Jdv8VU5nw38rmkmzdCQlGuo1+g
	 tI4ZUNYIEtF2QUyqgP+VP9x08/Kt6HgFEeG3klxNDSvYt0GMqMHMmpdKzQw4LL96+B
	 Bl1FRSsrqLVA585hNWKi1q6TCg+gHKvMnjxJfpdCCerx3K2pZJwAKqrLvn686uWXEF
	 vmZSOz2Bky5GVtozBZiitNz9ZbmLX8rn5gWfFfEe6K9UC9bUFpsX1E0WCbhUcJpxOT
	 Mi1XAXXXCUa/g==
X-Cc: linux-kernel@vger.kernel.org, willemdebruijn.kernel@gmail.com,
 carges@cloudflare.com, bjorn@kernel.org, phil@nwl.cc, jasowangio@gmail.com,
 eperezma@redhat.com, xuanzhuo@linux.alibaba.com, andrew+netdev@lunn.ch,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 netdev@vger.kernel.org, virtualization@lists.linux.dev, maxk@qualcomm.com,
 rusty@rustcorp.com.au
X-In-Reply-To:  <94796ee3c32e50665ecf70e2b390db1bc2773be9.1792668082.git.mst@redhat.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