From: "Björn Töpel" <bjorn@kernel.org>
To: Clement Lecigne <clecigne@google.com>,
aleksander.lobakin@intel.com, edumazet@google.com,
netdev@vger.kernel.org, maciej.fijalkowski@intel.com
Cc: clecigne@google.com, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org, kuba@kernel.org, sdf@fomichev.me,
horms@kernel.org, john.fastabend@gmail.com, ast@kernel.org,
daniel@iogearbox.net
Subject: Re: [PATCH v3] xsk: fix memory corruptions in net/core/xdp.c
Date: Fri, 16 Oct 2026 13:19:35 +0200 [thread overview]
Message-ID: <87qzhp51vc.fsf@all.your.base.are.belong.to.us> (raw)
In-Reply-To: <20260629072300.1664622-1-clecigne@google.com>
Waking a dead thread: RISE FROM YOUR GRAVE!
Clement Lecigne <clecigne@google.com> writes:
> From: Clément Lecigne <clecigne@google.com>
>
> Commit 560d958c6c68 ("xsk: add generic XSk &xdp_buff -> skb conversion")
> introduced a vulnerability in the handling of XDP_PASS for AF_XDP zero-copy
> frames.
Hmm, I acually hit this in my WIP for UMEM page pool provider hack.
> Note: Currently, this specific AF_XDP zero-copy conversion path is only
> reachable from the drivers/net/ethernet/intel/ice and
> drivers/net/ethernet/intel/idpf drivers.
>
> When building an skb, xdp_build_skb_from_zc() uses the chunk size
> (xdp->frame_sz) for the allocation. However, napi_build_skb() automatically
> reserves space at the end of the allocation for the skb_shared_info
> structure.
>
> Most high performance UMEM applications use 4K chunks, where the
> corruption cannot happen.
I think this can also happen with 4K UMEM chunks.
For example, on ice, use MTU 3800, 4K chunks, and no extra UMEM
headroom. Attach an xdp.frags program that returns XDP_PASS, and bind
the socket without XDP_USE_SG.
A 3814-byte Ethernet frame fits in the UMEM chunk:
256 headroom + 3814 packet = 4070 bytes
But the copied skb also needs space for skb_shared_info. Using
the 320-byte size from your example:
256 headroom + 3814 packet + 320 shared info = 4390 bytes
The old code allocates only 4096 bytes, so the packet copy
overwrites skb_shared_info.
Am I missing something?
Björn
next prev parent reply other threads:[~2026-10-16 11:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 7:22 [PATCH v3] xsk: fix memory corruptions in net/core/xdp.c Clement Lecigne
2026-06-29 10:34 ` Fijalkowski, Maciej
2026-06-29 11:15 ` Clement Lecigne
2026-07-01 14:52 ` Paolo Abeni
2026-10-16 11:19 ` Björn Töpel [this message]
2026-10-16 12:57 ` Maciej Fijalkowski
2026-10-16 20:15 ` Björn Töpel
2026-10-17 14:09 ` Maciej Fijalkowski
2026-10-17 14:37 ` Björn Töpel
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=87qzhp51vc.fsf@all.your.base.are.belong.to.us \
--to=bjorn@kernel.org \
--cc=aleksander.lobakin@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clecigne@google.com \
--cc=daniel@iogearbox.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=netdev@vger.kernel.org \
--cc=sdf@fomichev.me \
/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