From: Cheng Yongkang <teel4res@gmail.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
Jason Wang <jasowangio@gmail.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
Eugenio Perez <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, virtualization@lists.linux.dev,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [BUG] net: tun: zero-copy path can expose uninitialized packet data
Date: Thu, 22 Oct 2026 02:18:47 -0700 [thread overview]
Message-ID: <20261022091847.3654028-1-teel4res@gmail.com> (raw)
Hi all,
The experimental vhost-net TX zero-copy path can hand TUN a user buffer
whose effective vhost virtio header size is smaller than the TUN
device's configured vnet_hdr_sz. TUN computes an skb copylen that
remains larger than the bytes actually available after stripping its
configured header, publishes skb->len from that copylen, and
zerocopy_sg_from_iter() initializes only the real payload.
The resulting frame contains an uninitialized tail. The tail can be
read by userspace from the TAP peer through normal forwarding.
Observed on Linux v7.3, commit
08ab31164c55f20c7a2653de3186ae333470e2c1, with:
init_on_alloc=0
vhost_net.experimental_zcopytx=1
TAP vnet_hdr_sz=200
vhost TX total length=256
real payload length=56
TUN copylen / skb len=128
The exact control with vnet_hdr_sz=10 delivered the expected 246-byte
frame. The corrected trigger delivered 128 bytes after submitting only
56 payload bytes.
Sixteen of sixteen corrected triggers produced the overlong skb.
Eleven of sixteen had nonzero bytes in the 72-byte uninitialized tail.
Several contained recognizable stale kernel allocation content from
previous skbuff_small_head users, including fragments of environment
entries. Those bytes were never supplied in the virtio TX buffer.
This is a userspace-observable kernel-memory disclosure on a
network-forwarding path. It is configuration-gated by experimental
zero-copy and an enlarged TAP vnet header, but the overlong skb occurs
regardless of init_on_alloc; init_on_alloc=0 is needed to observe the
stale tail in this test build.
This is distinct from candidate BR-023/BR-025, which exercise
IFF_NAPI_FRAGS. This reproducer uses the non-frags tun_alloc_skb() /
zerocopy_sg_from_iter() branch.
I found no direct upstream fix or CVE.
The vhost ring reproducer and complete program/console logs are
available on request.
This was found with a multi-agent workflow; the
information disclosure was reproduced in QEMU/KVM.
Thanks,
Cheng Yongkang
next reply other threads:[~2026-10-22 9:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 9:18 Cheng Yongkang [this message]
2026-10-22 9:29 ` Paolo Abeni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261022091847.3654028-1-teel4res@gmail.com \
--to=teel4res@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=eperezma@redhat.com \
--cc=jasowangio@gmail.com \
--cc=kuba@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=willemdebruijn.kernel@gmail.com \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®