FAILED: patch "[PATCH] veth: convert frag_list skbs before running XDP" failed to apply to 6.6-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x d0d6415963040c401e7a7e4e482a698ba52448cb
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026080507-delighted-scouring-7597@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From d0d6415963040c401e7a7e4e482a698ba52448cb Mon Sep 17 00:00:00 2001
From: Matt Fleming <[email protected]>
Date: Wed, 22 Jul 2026 20:19:25 +0100
Subject: [PATCH] veth: convert frag_list skbs before running XDP
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
A frag_list skb can reach veth with data_len set but nr_frags zero. veth_convert_skb_to_xdp_buff() only converts skbs that are shared, locked, have frags[], or do not have enough headroom. It later uses skb_is_nonlinear() to decide whether to set XDP_FLAGS_HAS_FRAGS and xdp_frags_size.
That exposes frag_list data to XDP as if it were stored in frags[], but frags[] is empty. AF_XDP copy mode can then trust the bogus XDP fragment metadata, walk an empty fragment entry, and crash in memcpy() from __xsk_rcv().
Route non-linear skbs through skb_pp_cow_data() before exposing them to XDP, and only advertise XDP frags when the resulting skb has frags[]. skb_copy_bits() already handles frag_list input, and skb_pp_cow_data() builds frags[] output with skb_add_rx_frag(), which is the representation XDP multi-buffer expects.
drivers/net/veth.c +2 -2
@@ -756,7 +756,7 @@ static int veth_convert_skb_to_xdp_buff(struct veth_rq *rq,u32 frame_sz;if (skb_shared (skb) ||skb_head_is_locked (skb) || -skb_shinfo (skb)->nr_frags || +skb_is_nonlinear (skb) ||skb_headroom (skb) <XDP_PACKET_HEADROOM ) {if (skb_pp_cow_data (rq->page_pool, pskb,XDP_PACKET_HEADROOM )) goto drop;
@@ -771,7 +771,7 @@ static int veth_convert_skb_to_xdp_buff(struct veth_rq *rq,xdp_prepare_buff (xdp, skb->head,skb_headroom (skb),skb_headlen (skb), true); -if (skb_is_nonlinear (skb)) { +if (skb_shinfo (skb)->nr_frags) {skb_shinfo (skb)->xdp_frags_size = skb->data_len;xdp_buff_set_frags_flag (xdp); }else {
net/core/skbuff.c +12 -6
@@ -927,6 +927,18 @@ static void skb_clone_fraglist(struct sk_buff *skb)skb_get (list); } +/** +* skb_pp_cow_data() - copy skb data into page-pool backed storage +* @pool: page pool to allocate from +* @pskb: pointer to skb pointer, replaced with the copied skb on success +* @headroom: headroom to reserve in the copied skb +* +* skb_copy_bits() handles both frags[] and frag_list input. If the copied +* skb remains non-linear, it uses frags[], which is the representation used +* by XDP multi-buffer. +* +* Return: 0 on success or a negative errno on failure. +*/ int skb_pp_cow_data (struct page_pool *pool,struct sk_buff **pskb,unsigned int headroom) {
@@ -936,12 +948,6 @@ int skb_pp_cow_data(struct page_pool *pool, struct sk_buff **pskb,int err, i, head_off;void *data; -/* XDP does not support fraglist so we need to linearize -* the skb. -*/ -if (skb_has_frag_list (skb)) -return -EOPNOTSUPP ; - max_head_size =SKB_WITH_OVERHEAD (PAGE_SIZE - headroom);if (skb->len > max_head_size +MAX_SKB_FRAGS *PAGE_SIZE )return -ENOMEM ;
Sasha Levin
maintainerPATCH 1/1 veth: convert frag_list skbs before running XDP
From: Matt Fleming <[email protected]>
[ Upstream commit d0d6415963040c401e7a7e4e482a698ba52448cb ]
A frag_list skb can reach veth with data_len set but nr_frags zero. veth_convert_skb_to_xdp_buff() only converts skbs that are shared, locked, have frags[], or do not have enough headroom. It later uses skb_is_nonlinear() to decide whether to set XDP_FLAGS_HAS_FRAGS and xdp_frags_size.
That exposes frag_list data to XDP as if it were stored in frags[], but frags[] is empty. AF_XDP copy mode can then trust the bogus XDP fragment metadata, walk an empty fragment entry, and crash in memcpy() from __xsk_rcv().
Route non-linear skbs through skb_pp_cow_data() before exposing them to XDP, and only advertise XDP frags when the resulting skb has frags[]. skb_copy_bits() already handles frag_list input, and skb_pp_cow_data() builds frags[] output with skb_add_rx_frag(), which is the representation XDP multi-buffer expects.
--- drivers/net/veth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/veth.c +2 -2
@@ -731,7 +731,7 @@ static int veth_convert_skb_to_xdp_buff(struct veth_rq *rq,u32 frame_sz;if (skb_shared (skb) ||skb_head_is_locked (skb) || -skb_shinfo (skb)->nr_frags || +skb_is_nonlinear (skb) ||skb_headroom (skb) <XDP_PACKET_HEADROOM ) {u32 size, len, max_head_size, off;struct sk_buff *nskb;
@@ -808,7 +808,7 @@ static int veth_convert_skb_to_xdp_buff(struct veth_rq *rq,xdp_prepare_buff (xdp, skb->head,skb_headroom (skb),skb_headlen (skb), true); -if (skb_is_nonlinear (skb)) { +if (skb_shinfo (skb)->nr_frags) {skb_shinfo (skb)->xdp_frags_size = skb->data_len;xdp_buff_set_frags_flag (xdp); }else {
Signature · 1 line
2.53.0