* [PATCH net] net: xdp: Fix skb->tail after bpf_xdp_adjust_tail() in generic mode
@ 2026-11-26 12:55 Sechang Lim
2026-11-26 12:58 ` netdev-bot+sinfo
0 siblings, 1 reply; 3+ messages in thread
From: Sechang Lim @ 2026-11-26 12:55 UTC (permalink / raw)
To: netdev
Cc: bpf, davem, edumazet, kuba, pabeni, willemb, horms, ast, daniel,
hawk, john.fastabend, sdf, tehnerd
In generic XDP the program sees a frame starting at the MAC header,
mac_len bytes before skb->data. After bpf_xdp_adjust_tail(), skb->tail
is set to skb->data + (xdp->data_end - xdp->data), which is mac_len
bytes beyond the new end of the frame and can be beyond skb->end.
When a tc program then calls bpf_skb_change_tail(), __skb_grow()
compares the negative skb_tailroom() as unsigned and does not expand
the head, so zeroing the new bytes runs past the end of the buffer:
BUG: KASAN: slab-out-of-bounds in bpf_skb_grow_rcsum+0x1cc/0x460
Write of size 4096 at addr ffff888108e84ec0 by task xg/365
Call Trace:
bpf_skb_grow_rcsum+0x1cc/0x460
bpf_skb_change_tail+0x50b/0x800
bpf_prog_f9246b7887bf521b_tail+0x53/0x67
__netif_receive_skb_core.constprop.0+0x132f/0x2e60
Subtract mac_len from the offset.
Fixes: 198d83bb3bec ("bpf: make generic xdp compatible w/ bpf_xdp_adjust_tail")
Signed-off-by: Sechang Lim <rhkrqnwk98@gmail.com>
---
net/core/dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index cd0796a1dbfd..1934e11c4401 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5737,7 +5737,7 @@ u32 bpf_prog_run_generic_xdp(struct sk_buff *skb, struct xdp_buff *xdp,
/* check if bpf_xdp_adjust_tail was used */
off = xdp->data_end - orig_data_end;
if (off != 0) {
- skb_set_tail_pointer(skb, xdp->data_end - xdp->data);
+ skb_set_tail_pointer(skb, xdp->data_end - xdp->data - mac_len);
skb->len += off; /* positive on grow, negative on shrink */
}
--
2.56.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: xdp: Fix skb->tail after bpf_xdp_adjust_tail() in generic mode
2026-11-26 12:55 [PATCH net] net: xdp: Fix skb->tail after bpf_xdp_adjust_tail() in generic mode Sechang Lim
@ 2026-11-26 12:58 ` netdev-bot+sinfo
2026-11-26 13:15 ` Sechang Lim
0 siblings, 1 reply; 3+ messages in thread
From: netdev-bot+sinfo @ 2026-11-26 12:58 UTC (permalink / raw)
To: Sechang Lim
Cc: netdev, bpf, davem, edumazet, kuba, pabeni, willemb, horms, ast,
daniel, hawk, john.fastabend, sdf, tehnerd
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: xdp: Fix skb->tail after bpf_xdp_adjust_tail() in generic mode
2026-11-26 12:58 ` netdev-bot+sinfo
@ 2026-11-26 13:15 ` Sechang Lim
0 siblings, 0 replies; 3+ messages in thread
From: Sechang Lim @ 2026-11-26 13:15 UTC (permalink / raw)
To: netdev-bot+sinfo
Cc: netdev, bpf, davem, edumazet, kuba, pabeni, willemb, horms, ast,
daniel, hawk, john.fastabend, sdf, tehnerd
On Thu, Nov 26, 2026 at 12:58:50PM +0000, netdev-bot+sinfo@kernel.org wrote:
>Hi!
>
>This is an automated message. This series looks like a fix, but its
>commit messages seem to be missing some information:
>
> - How the issue was discovered, e.g. hit in production, hit during
> development, syzbot report, manual code inspection, LLM or static
> analysis tool scan.
>
>Please do not repost the series just to address the above. Instead,
>reply to this email with the missing information, so that reviewers
>can take it into account.
>
>*IMPORTANT*: If you do repost (for other reasons) - please include
>the relevant info in the cover letter or commit messages.
Found with a custom fuzzer. I'll add that to the commit message
if there is a v2.
Thanks.
sechang
>--
>The evaluation is done by an LLM so it may be wrong, if you think
>that is the case please reply and explain.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-26 13:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 12:55 [PATCH net] net: xdp: Fix skb->tail after bpf_xdp_adjust_tail() in generic mode Sechang Lim
2026-11-26 12:58 ` netdev-bot+sinfo
2026-11-26 13:15 ` Sechang Lim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox