Article View: linux.kernel.netdev
Article #17225Re: [PATCH net-next v5 2/9] virtio-net: zero the whole tx header
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 13:55
Date: Mon, 16 Nov 2026 13:55
104 lines
12362 bytes
12362 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] The commit fixes a real bug: virtio-net TX headers reach the
device with stale or uninitialised bytes.
- [Low] The commit message says the bytes the helper does not set "go to
the device as they were in skb->cb or the headroom", but it never says…
--
virtio-net: zero the whole tx header
This commit clears the whole negotiated virtio-net header in xmit_skb()
before virtio_net_hdr_tnl_from_skb() fills it in. Bytes past struct
virtio_net_hdr no longer carry stale skb->cb or headroom contents to the
device. The separate num_buffers assignment for mergeable rx buffers is
dropped because the memset covers it.
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index dd2c41ef6fbe7..4c740b403ad1e 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -3326,14 +3326,16 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb, bool orphan)
> else
> hdr = &skb_vnet_common_hdr(skb)->tnl_hdr;
>
> + /* Fields the helper below does not fill in must not carry stale
> + * skb->cb or headroom bytes to the device.
> + */
> + memset(hdr, 0, hdr_len);
> +
[Severity: Medium]
This fixes uninitialized bytes reaching the device. Should it carry a Fixes:
tag and go to net on its own, rather than as part of a net-next series?
Before this change, non-tunnel skbs only went through
virtio_net_hdr_from_skb(). That clears sizeof(struct virtio_net_hdr), which
is 10 bytes.
virtnet_probe() sets vi->hdr_len to 12 (VIRTIO_F_VERSION_1 or MRG_RXBUF), 20
(hash report) or 24 (UDP tunnel GSO). So bytes 10 through hdr_len - 1 went to
the device unchanged from skb->cb or the headroom.
The 24-byte layout and the current form of the num_buffers assignment come
from this commit, which is in currently maintained stable kernels:
Fixes: 56a06bd40fab ("virtio_net: enable gso over UDP tunnel support.")
The 12-byte and 20-byte cases are older, so their origin commits could be
named as well.
Without the tag, the fix only lives in a net-next feature series (RX
timestamp support). Would stable and distro kernels then keep sending up to
14 stale bytes per packet?
> if (virtio_net_hdr_tnl_from_skb(skb, hdr, vi->tx_tnl,
> virtio_is_little_endian(vi->vdev), 0,
> false, feature_hdrlen))
> return -EPROTO;
>
> - if (vi->mergeable_rx_bufs)
> - hdr->hash_hdr.hdr.num_buffers = 0;
> -
[Severity: Low]
The commit message says the remaining bytes "go to the device as they were
in skb->cb or the headroom". It does not say that this exposes kernel memory
to the device. Could the message state that?
In the can_push case of xmit_skb(), hdr points into the skb headroom:
if (can_push)
hdr = (struct virtio_net_hdr_v1_hash_tunnel *)(skb->data -
hdr_len);
The skb allocators don't zero the headroom, and nothing writes the bytes in
front of the Ethernet header. So up to 14 bytes of uninitialized slab
content per packet ended up in buffers the device can read. This matters
when the host or backend is not trusted, for example SEV-SNP/TDX guests or
VDUSE and vhost-user backends.
Also, the virtio spec requires the driver to set num_buffers to zero on
transmit, so a non-zero value there breaks the spec.
The XDP TX path in the same driver already zeroes the whole header in
__virtnet_xdp_xmit_one():
memset(hdr, 0, vi->hdr_len);
Without words like "info leak" or "uninitialized memory", might maintainers
and stable reviewers treat this patch as a cleanup?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-v6-7-topic-virtio-net-ptp-v5-0-7ab67b572f4f%40pengutronix.de
Technical Details
Message-ID:
<179483730268.3136.457734979427680662@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364393-linux-kernel-netdev=dewy.ruReferences:
<20261112-v6-7-topic-virtio-net-ptp-v5-2-7ab67b572f4f@pengutronix.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364393-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v5 2/9] virtio-net: zero the whole tx header Date: Mon, 16 Nov 2026 13:55:02 +0000 Organization: Usenet Network Message-ID: <179483730268.3136.457734979427680662@kernel.org> References: <20261112-v6-7-topic-virtio-net-ptp-v5-2-7ab67b572f4f@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2079444"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:kOOs0zCjTwSZ//Zf+yjxzXNFgek= sha256:rpEMpcXs6g1PeN6AEQVl1KGIge12S3ektGwOSOirZ/s= sha1:LbYJWewFTqDA4ZgZ8MmHK1fcNaI= sha256:c6oO1iGUZlyMuXu3iVmuU3jVPuxRhRdKVCRs1UvKxaQ= 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 05D8D114C5B; Mon, 16 Nov 2026 16:57:14 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 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] 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 1s2W_lCNdASl; Mon, 16 Nov 2026 16:57:08 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364393-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 97964114C42; Mon, 16 Nov 2026 16:57:00 +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 082652F99F; Mon, 16 Nov 2026 13:56:19 +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=1794837311; b=ua86wxu2RLemnAd85FCkiyL4TFVYjdPu7D55Ii8GNVUMU3XMesp0IvYpkphrk1QJssDO 2INx1EmsLgZax4+muNKtplqdjcR6wgp5/PYr49BjHCUIW+K6cmIcoMYmV3AK5wZrTdALz pYiMbUsPULpLIejtCGKp5+VMMs6PI/Fa1xSUcDt+BnYRFuAMuHeIHXX7fG6I8ZBwj2KeU TI+Ry+SAyoOgPbnQMy6eIS31D2PCtipwiAo6sjTr9mGeJ4Vuny+hEWhMVh2KoNOuAvSvB DssX3vhdvhuyQU36YurmO/hyr+BTcWibT2ZJnLb0Kssoqk6G8HsaM9fXr/hmKrCs9Eg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794837311; 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=ZSJToYozTYxAoX2DSMhPYtF3x2Zug3BZ5Yp5Zwq1bHs=; b=NBcysUD0wvRM5cupuBv7scFjleO5q/QNWEpXL72SYcK5EhqXJ8fwU4f3uE9SNs388XSX gJ54ftqS/GDe00Nw7nyYNCKAppC1PDFoVWjsbf3X1UVrzzWaOvdWpeF0elzwo+kWAAUMj iSNKSwxocVvP8igMzC3NHo6y9PKuu6DbkFGCYjntImQRrJ4EgAuuivvcXDQ2ELRKoT9vA w49nCfElqZYmk7BRCVDC3psxU2ZT/Ec5IeNxHx3HfvWJlBQCaZimJBch42LxH+gd7v1pw BKXvOwIKe7IrdaptnRDuSMpRg5+Jg7zpus1aU/z3FxajjI80n5sRrMEBtsLSi3Hyn0A== 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=ojnttcYQ; 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 F02CA606A891; Mon, 16 Nov 2026 13:55:10 +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=ojnttcYQ 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=1794837305; b=0e3Kn4//WAOCM7i/qHM1QnQNnCvDum1dAOQ60X/MrzDwG+I4Adlcx1En/JpiIhGJDrWn LwD/rDn+k49FWQTxBJMIBAhSJnPxOo/2BzkQlf7UrLB1Es+KAGDKTvZCD/5fM/P1G8bgx GTsHfPjhm4549SQoYgeaCoHnMPxnrsvhLNib8czvbkeqxMfYbP2OsUraoNPWuEmjXsKDg NFD6k5AwaR7ctoeKVIqrgt/ajQ5Fa864mNRgwmDplBg4ZGFA2FwFAn6ihWQ6YoyIotyFK mjx6qtaqbQqT7y6lb6sLoDzO+Bd/+j7r6thhaPDQz47F9LQjjCYV34+LC5GoIaK345g== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794837305; 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=ZSJToYozTYxAoX2DSMhPYtF3x2Zug3BZ5Yp5Zwq1bHs=; b=DlubN8mhM/0C42zKBSQ6JdGF4j6tmYvntcFGrQd7IHJu9Zzuv9V+PTBVs3E41m1msFdv UJOkN1EKBMxtE8esN3gIS+qwLxJiZJHyOmVD3VOn1JhluD/EDnuVHAhOY3FgHf9GThqaO rDWJY9h73vZGld5OcKYZqHyjsUBOneNuzDP8yPFWX9FWIsQg+DueVH7DXPHvD7QbQTSJd 088coX39qHx+gNsF8QrGjyAx/AxAzyHCccOb/l6E2cRuOgl4eH7Xgvslq+jy70Y82RnCD suluvirLwlO05pzq/EI18jEq+9KLY4WbLmVXuHFjPRKXf6uzkmDDEcjNfdb25OwRjpw== 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=ojnttcYQ; 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 1BB9560A2624; Mon, 16 Nov 2026 13:55:04 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E2771F000C6; Mon, 16 Nov 2026 13:55:03 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794837304; bh=ZSJToYozTYxAoX2DSMhPYtF3x2Zug3BZ5Yp5Zwq1bHs=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=ojnttcYQczskVLAWIQCzK/VB4k1GAQix19HvlONXnJ1thQ+Oo1tgiEZPyxnaPU8lg Q7NCrq7A8gYKz/TawlMkFKSmeazTobmJxK2a+2woscXmIFT+YZrdPP86tTBfY3OrNI SGbUmoLHnaaRTN0jd4jE7s8c1SiTZXBw/oJB07mRG62Wx7UrX2OpVndsbVyTGYdKwF An/GRp2qUrX/9g+qMRjwod8qwSCFfECjz8K1bN8IzhvRoYP/BZ3wDgcE/Cw6N87dSs /pYiQaney9BkzjPMfy5pcY7p6A8wFg+tR7rjMxsaOa5st+O5OlON36SoduDLERZdbc LY72u30mt6new== X-Cc: mst@redhat.com, xuanzhuo@linux.alibaba.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, willemdebruijn.kernel@gmail.com, andrew+netdev@lunn.ch, eperezma@redhat.com, jasowangio@gmail.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, edumazet@kernel.org, andrew@lunn.ch, horms@kernel.org, kory.maincent@bootlin.com, liangchen.linux@gmail.com, hengqi@linux.alibaba.com, virtualization@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, kvm@vger.kernel.org, kernel@pengutronix.de X-In-Reply-To: <20261112-v6-7-topic-virtio-net-ptp-v5-2-7ab67b572f4f@pengutronix.de> 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 X-Received-Bytes: 12076