Article View: linux.kernel.netdev
Article #17184Re: [PATCH net 2/2] selftests: net: check UDP tunnel GRO virtio offsets
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 13:50
Date: Mon, 16 Nov 2026 13:50
130 lines
12917 bytes
12917 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
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] In the gro_on variant, TEST_F(tun_vnet_gro,
outer_transport_header) in tools/testing/selftests/net/tun.c reports…
- [Low] In TEST_F(tun_vnet_gro, outer_transport_header)
(tools/testing/selftests/net/tun.c), `len` is an `int` that holds the…
--
selftests: net: check UDP tunnel GRO virtio offsets
This adds a tun_vnet_gro fixture to the tun selftest. It writes Geneve/TCP
frames into a NAPI TAP, bridges them to a second virtio-header TAP, and
compares the exported tunnel offsets and checksum fields of the GRO
aggregate with the parsed wire headers. A gro_off variant is used as a
packet integrity control.
> diff --git a/tools/testing/selftests/net/tun.c b/tools/testing/selftests/net/tun.c
> index 34de2580e32ec..192b3e0c0d172 100644
> --- a/tools/testing/selftests/net/tun.c
> +++ b/tools/testing/selftests/net/tun.c
[ ... ]
> +TEST_F(tun_vnet_gro, outer_transport_header)
> +{
> + uint8_t input[GRO_BUFFER_SIZE], output[GRO_BUFFER_SIZE];
> + unsigned int seen = 0, aggregates = 0, records = 0;
> + /* Bound the wait even if forwarding fails or packets are lost. */
> + int64_t deadline = gro_milliseconds() + GRO_RECEIVE_TIMEOUT_MS;
> + struct pollfd pfd = { .fd = self->fd[1], .events = POLLIN };
> + int i, len, frame_len, ready;
[ ... ]
> + ASSERT_NE(pfd.revents & POLLIN, 0);
> + ASSERT_LT(records++, 128);
> + len = read(self->fd[1], output, sizeof(output));
> + ASSERT_GE(len, TUN_VNET_TNL_SIZE + ETH_HLEN);
> + frame_len = len - TUN_VNET_TNL_SIZE;
[Severity: Low]
Can a failed read() get past this assert? len is an int, but
TUN_VNET_TNL_SIZE is sizeof(struct virtio_net_hdr_v1_hash_tunnel), so the
right-hand side is a size_t. __EXPECT() keeps the type of each operand:
__typeof__(_expected) __exp = (_expected);
__typeof__(_seen) __seen = (_seen);
if (!(__exp _t __seen)) {
That means a -1 from read() is compared as SIZE_MAX, and the assert passes.
read() can fail even after poll() reports POLLIN. tun_do_read() dequeues
the skb and calls tun_put_user(), which can return -EINVAL from
virtio_net_hdr_tnl_from_skb(). The skb is freed either way:
drivers/net/tun.c:tun_do_read() {
...
ret = tun_put_user(tun, tfile, skb, to);
if (unlikely(ret < 0))
kfree_skb(skb);
...
}
When that happens, frame_len goes negative. The later ASSERT_GE(frame_len,
...) checks against size_t or unsigned operands pass for the same reason.
On the first iteration, output[] is uninitialized stack memory. The MAC
memcmp() then most likely mismatches and the error is dropped by the
continue. On later iterations the stale previous frame is parsed until the
tot_len check fails with a misleading message.
The test still fails in the end because seen never reaches 0xff, but the
real errno is never reported. Would an ASSERT_GE(len, 0) before this check,
or an (int) cast on the size, give a clearer failure?
[ ... ]
> + if (!variant->gro || vh->gso_type == VIRTIO_NET_HDR_GSO_NONE) {
> + ASSERT_EQ(vh->gso_type, VIRTIO_NET_HDR_GSO_NONE);
> + ASSERT_EQ(segments, 1);
> + ASSERT_EQ(le16toh(vh->gso_size), 0);
> + ASSERT_EQ(gro_build_packet(input, first), len);
> + ASSERT_EQ(memcmp(frame, input + TUN_VNET_TNL_SIZE, frame_len), 0);
> + continue;
> + }
[ ... ]
> + ASSERT_EQ(seen, (1U << GRO_PACKETS) - 1);
> + if (variant->gro && !aggregates && _metadata->exit_code != KSFT_FAIL)
> + SKIP(return, "No multi-segment GRO aggregate observed");
[Severity: Medium]
Does this match the commit message? The commit message says:
Require a multi-segment GRO aggregate ... No output or no merge is not
a pass.
In kselftest_harness.h, SKIP() is documented as forcing a "pass" after
reporting why the test is skipped. It sets _metadata->exit_code to
KSFT_SKIP, which appears as "ok ... # SKIP" in the TAP output.
In the gro_on variant, the GSO_NONE branch above accepts unmerged frames
after only an integrity check. Those frames never reach the
outer_th_offset and inner_nh_offset checks. virtio_net_hdr_tnl_from_skb()
only fills those fields for SKB_GSO_UDP_TUNNEL or SKB_GSO_UDP_TUNNEL_CSUM
skbs, which means only for aggregates.
Suppose Geneve GRO stops merging, or the tunnel GSO export path stops
producing tunnel GSO skbs. All 8 packets would then arrive as valid
singles, seen would become 0xff, aggregates would stay 0, and the test
would report SKIP.
Wouldn't a regression in the path this test targets then look like an
environment skip instead of a failure? Should the gro_on variant fail
here instead?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112030708.1915665-1-bryon%40fryer.io
Technical Details
Message-ID:
<179483703798.3136.17536195102947528618@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364354-linux-kernel-netdev=dewy.ruReferences:
<20261112030708.1915665-3-bryon@fryer.io>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364354-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 2/2] selftests: net: check UDP tunnel GRO virtio offsets Date: Mon, 16 Nov 2026 13:50:37 +0000 Organization: Usenet Network Message-ID: <179483703798.3136.17536195102947528618@kernel.org> References: <20261112030708.1915665-3-bryon@fryer.io> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2076268"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:DdncHeeG6G2R1IfFMQZdB4EiW9E= sha256:LMVdAPUXNL9VxiddYlXkMNd1S5a9uYcCzoARRmWCwi4= sha1:tbwZfcjPZ8QjTM3TB26IHEDS1zQ= sha256:RcxAoerU5Y5cDJE0Zyz6sIuYrTYynTX9iVc9ZNMb/gM= 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 46535114C2D; Mon, 16 Nov 2026 16:51:02 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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 Wra3xkIbn8sQ; Mon, 16 Nov 2026 16:50:58 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-364354-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 4066D114C0C; Mon, 16 Nov 2026 16:50:48 +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 9EC93262EE; Mon, 16 Nov 2026 13:50:45 +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=1794837045; b=jy6YNHSIRcrrXAG/+5fKU6Xo63PnVrkytMf5N4Y+CX8eEuxfZy+0jbpVTFrozPYWqTQ/ JxvxhjcomsiwO6MQ6Ux7nwaOuxsecRY1Dq+4S0WAkylPsnhhW11DBvWT3D+0pVGy3QjXH eKYPuonKg7sV6lqeN9QrNxLQIiLjsK6CTLpzlA+6mzlE7qVkcDCRsI6b/McFHRX/DCr4+ iwlYqXxb89h8lWXyVOqRpn4/m+HCabVDD5Cs2Q7D1K3YQEHf5rVp6pkvzrrKlAB35BTfP wkuiIUDNEJnFg+//ife4PaxqMG3RBCwC8W75BoJmo3hJMVkSC/jhz1yXiV5TeXNryog== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794837045; 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=/3e3TImcCJs1Ha+JQOqG/r2t+apyd9H8tJkNWnphjK4=; b=3PUuh9xIELr2O+c5+kX/5R88sZaVysWjEdyaz9/XXGRAN0pyKToXzjCswDAasOdPKOW9 ZVGYthf3qlnfiVCA2kEThB9jfk5A0PFwYwPy4ZJ3EzZMKDyoIYhL7+jX4ncY8+0aFKkYT OlZfliE6Q/N5D4MmIqTLIU8+TkDSyFVy9tahuo2uqKc6u8r5nzo+uCB8SjW5D1KX/v9B5 aSCxkvQHb9CnYfpkw18cIXIErhR80frW0sdt/I4Sjxrk2hq5+Qyuuy+s8toz9I0umd2zW eLtO4F7K4uZbaHUm1EGecBAcLCHtA3Afuk54bqqFCrvcqdQhfZmlFQoqfi/nnTqdFbw== 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="FnbMR3k/"; 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 10A9D606A8A9; Mon, 16 Nov 2026 13:50:45 +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=FnbMR3k/ 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=1794837039; b=utm2YPXSrvqtVCnHG0nhxh54esZ7wHThRKOQxj0KhV2igif19BxcQ00pW7wXPi00M+B2 mlC88WqvOTgJclGzsiMKIugpJYDmrOUZ4xMfCKXrY44H1tQphuHYUTtS71x/M1uI8kYb2 JCICbv1/LiP5IHDfAqJEeucTXdKA2sBYovftmzopVINPfiQU3z+1yJv9YJ9WI/froPOio mhVolB9dMOdw+ta9P8mROQ2pg1BZkBkFu24pGJZ79R46a/axH/TiNb0MK+F22g5Cfb0Rx SSfrIEdwwu6R2+Xxc/sg7vA7+JEmkAk/9jFxNmfkL7SZ8CHFsSopGCcsZY3afHCkWHg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794837039; 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=/3e3TImcCJs1Ha+JQOqG/r2t+apyd9H8tJkNWnphjK4=; b=V76eKd4cZYTXrRIf4G11rvnG4KHZ50J7k8kNBcZc3DKCP0+Z8lTExQlvBOe2Nyhsn4M2 pJzGSZXqu1Pfo1xIpm0A/nZUq5kpgm5T4mo4OLTmc4p3G05eqdWcG0xKFRTBhr8yIUTtZ As9JAKEAOcntMLzzou/p5QWDYO62iBq0KmZhqfRZOkErz276Yw9OjVoVX12Xal3BtPhnd ioHL/QWeCT+VXcCpEcTjm5FJbtlaPz7g3RLQbXh+6Rfqh4unWIyJkocWGrmh2Fkl8KnJE qRMGgvXU2S5SpDSLgGM7Yga7PMOiNl8HgUpwFtHtgeyd+HYZ1yL5Ei97LXQsn0B0a4A== 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="FnbMR3k/"; 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 2F85B606A8BF; Mon, 16 Nov 2026 13:50:39 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C4631F000CA; Mon, 16 Nov 2026 13:50:38 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794837039; bh=/3e3TImcCJs1Ha+JQOqG/r2t+apyd9H8tJkNWnphjK4=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=FnbMR3k/s1857WfSWh6tB9WVVi7dyXHR6AtKTHY8lgxg48vmtBjWsrOcT5gNOxYNh efyOBtSbehimVZruZ2K5iLWS9cBvHXWZOEVTPLkYu/BMgpSa9kaeh8/eEVbO67rROk OKmNONRqKaLYfByF8V0TAOsBY+NoS4JSrx4wcRBMRuBjzmb8mwVEFPZ/R+L36mVvUI lfOZjeL3v10Wd00CNtaNnR4w/XX5qbuBanlg0VwDjkYwymDn7ezV2R07mTClvdT/o6 OOnYXOjg1IukP94opXGL85q6++NCt1EP6lHe5qk1/iKaHTgFQZOzh7A29ZSt+8nzjz /jpOhYmHUwrBA== X-Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org, horms@kernel.org, jasowangio@gmail.com, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, pabeni@redhat.com, shuah@kernel.org X-In-Reply-To: <20261112030708.1915665-3-bryon@fryer.io> 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