From: sashiko-bot@kernel.org
To: "Tianyi Gao" <tianyi@cloudflare.com>, bpf@vger.kernel.org
Cc: intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH bpf-next 10/15] xdp: warn on XDP_PASS with stored values when XDP runs on an skb
Date: Tue, 10 Nov 2026 04:10:19 +0000 [thread overview]
Message-ID: <sashiko-outbox-206173@kernel.org> (raw)
In-Reply-To: <15f830924c4d06d3d8c7e41fb8a9f8c29b63d9a7.1794281983.git.tianyi@cloudflare.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] veth: race on rq->xdp_rxq in veth_disable_xdp() [1]
--
commit 7b602275436247ecf1d76650c01ef17cdab5904b
Author: Tianyi Gao <tianyi@cloudflare.com>
xdp: warn on XDP_PASS with stored values when XDP runs on an skb
This commit adds xdp_skb_ext_warn_skb() to warn when an XDP program running
on an existing skb returns XDP_PASS after storing skb extension metadata,
and skips generic XDP in xdp_skb_ext_warn_pass() to avoid warning twice.
> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> index b402f8ed50966..f0d279e2da6a4 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -826,6 +826,8 @@ static struct sk_buff *veth_xdp_rcv_skb(struct veth_rq *rq,
>
> switch (act) {
> case XDP_PASS:
> + if (unlikely(xdp_buff_has_skb_ext(xdp)))
> + xdp_skb_ext_warn_skb(xdp_prog, xdp);
> break;
> case XDP_TX:
> veth_xdp_get(xdp);
[Severity: Critical]
This problem wasn't introduced by this patch, but can veth_disable_xdp()
unregister rq->xdp_rxq [1] while veth_xdp_rcv_skb() or
veth_xdp_rcv_one() is still using it?
drivers/net/veth.c:veth_disable_xdp() {
for (i = 0; i < dev->real_num_rx_queues; i++)
rcu_assign_pointer(priv->rq[i].xdp_prog, NULL);
if (!netif_running(dev) || !veth_gro_requested(dev))
veth_napi_del(dev);
veth_disable_xdp_range(dev, 0, dev->real_num_rx_queues, false);
}
When detaching an XDP program on a running veth device with GRO enabled,
veth_disable_xdp() skips veth_napi_del(), so neither napi_disable() nor
synchronize_net() runs after clearing rq->xdp_prog:
CPU0 CPU1 (NAPI)
veth_disable_xdp() veth_xdp_rcv_skb()
rcu_read_lock()
xdp_prog = rcu_dereference(rq->xdp_prog)
rcu_assign_pointer(rq->xdp_prog, NULL)
veth_disable_xdp_range()
rq->xdp_rxq.mem = rq->xdp_mem
xdp_rxq_info_unreg(&rq->xdp_rxq)
bpf_prog_run_xdp(xdp_prog, xdp)
xdp_skb_ext_warn_skb(xdp_prog, xdp)
xdp->rxq->dev->name <-- NULL deref
xdp_rxq_info_unreg() clears rq->xdp_rxq.dev to NULL and resets
rq->xdp_rxq.mem.type while the NAPI poll is still running with xdp->rxq
pointing to rq->xdp_rxq. Beyond the NULL pointer dereference on
xdp->rxq->dev (here or when the BPF program reads ingress_ifindex), this
also causes page_pool leaks or use-after-free when frames are redirected,
transmitted, or freed.
[1] https://sashiko.dev/#/bug/linux-717ec225-ebb9-408c-a2e0-a2698846ef4a
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1794281983.git.tianyi@cloudflare.com?part=10
next prev parent reply other threads:[~2026-11-10 4:10 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 3:56 [PATCH bpf-next 00/15] xdp: add SKB core extensions to keep RX metadata until skb creation Tianyi Gao
2026-11-10 3:56 ` [PATCH bpf-next 01/15] xdp: reserve an skb core extension area after the xdp_frame Tianyi Gao
2026-11-10 4:18 ` sashiko-bot
2026-11-10 4:42 ` Tianyi Gao
2026-11-10 13:10 ` Jesper Dangaard Brouer
2026-11-10 3:57 ` [PATCH bpf-next 02/15] net: dpaa, dpaa2: clear the skb core extension flag Tianyi Gao
2026-11-10 3:57 ` [PATCH bpf-next 03/15] xdp: add kfuncs to store RX hash and VLAN tag Tianyi Gao
2026-11-10 14:13 ` Jesper Dangaard Brouer
2026-11-10 3:57 ` [PATCH bpf-next 04/15] xdp: add a kfunc to delete skb core extension entries Tianyi Gao
2026-11-10 14:20 ` Jesper Dangaard Brouer
2026-11-10 3:57 ` [PATCH bpf-next 05/15] xdp: add a kfunc to store the RX checksum status Tianyi Gao
2026-11-10 3:57 ` [PATCH bpf-next 06/15] selftests/bpf: Test the skb core extension kfuncs Tianyi Gao
2026-11-10 3:57 ` [PATCH bpf-next 07/15] xdp: set skb RX metadata from the skb core extension area of xdp_frame Tianyi Gao
2026-11-10 3:57 ` [PATCH bpf-next 08/15] selftests/bpf: Test RX metadata on skbs built from xdp_frames Tianyi Gao
2026-11-10 3:57 ` [PATCH bpf-next 09/15] xdp: add the skb-ext-pass XDP feature and warn without it Tianyi Gao
2026-11-10 3:57 ` [PATCH bpf-next 10/15] xdp: warn on XDP_PASS with stored values when XDP runs on an skb Tianyi Gao
2026-11-10 4:10 ` sashiko-bot [this message]
2026-11-10 4:57 ` Tianyi Gao
2026-11-10 4:53 ` bot+bpf-ci
2026-11-10 4:53 ` bot+bpf-ci
2026-11-10 3:57 ` [PATCH bpf-next 11/15] ice: set skb RX metadata from the skb core extension area of xdp_buff Tianyi Gao
2026-11-10 4:23 ` sashiko-bot
2026-11-10 3:57 ` [PATCH bpf-next 12/15] selftests: drv-net: xdp: test the stored RX metadata on XDP_PASS Tianyi Gao
2026-11-10 3:57 ` [PATCH bpf-next 13/15] xdp: add kfuncs to load the stored RX metadata Tianyi Gao
2026-11-10 3:57 ` [PATCH bpf-next 14/15] selftests/bpf: Test the load kfuncs on cpumap and veth Tianyi Gao
2026-11-10 3:57 ` [PATCH bpf-next 15/15] docs: net: document the skb core extension area Tianyi Gao
2026-11-10 4:53 ` bot+bpf-ci
2026-11-10 4:53 ` bot+bpf-ci
2026-11-10 13:01 ` [PATCH bpf-next 00/15] xdp: add SKB core extensions to keep RX metadata until skb creation Jesper Dangaard Brouer
2026-11-11 0:00 ` Stanislav Fomichev
2026-11-11 1:07 ` Tianyi Gao
2026-11-11 22:25 ` Stanislav Fomichev
2026-11-11 23:46 ` Tianyi Gao
2026-11-12 0:34 ` Alexei Starovoitov
2026-11-12 14:55 ` Tianyi Gao
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=sashiko-outbox-206173@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tianyi@cloudflare.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.