Thread (4 messages) 4 messages, 4 authors, 2026-08-18

Re: [PATCH net-next] net: xdp: don't assume an Ethernet header in generic XDP

From: Alexander Lobakin <aleksander.lobakin@intel.com>
Date: 2026-08-18 14:26:46
Also in: bpf, lkml

From: Jiayuan Chen <jiayuan.chen@linux.dev>
Date: Thu, 13 Aug 2026 19:32:24 +0800
Kenneth Lee reported a bug [1]:

  skb_vlan_push got skb with skb->data not at mac header (offset 14)
  WARNING: net/core/skbuff.c:6474 at skb_vlan_push+0x5ec/0x8a0
   ____bpf_skb_vlan_push net/core/filter.c:3239 [inline]
   bpf_skb_vlan_push+0x216/0x8b0 net/core/filter.c:3229
   bpf_prog_run_data_pointers+0x17c/0x240 include/linux/filter.h:917
   tcf_bpf_act+0x31c/0x940 net/sched/act_bpf.c:50
   tcf_action_exec+0x2c1/0x720 net/sched/act_api.c:1147
   tcf_classify+0x6e4/0x1080 net/sched/cls_api.c:1860
   tc_run+0x31c/0x5d0 net/core/dev.c:4411
   sch_handle_ingress net/core/dev.c:4486 [inline]
   __netif_receive_skb_core+0x141b/0x2ec0 net/core/dev.c:6054

bpf_prog_run_generic_xdp() just assumes xdp->data is an Ethernet header:
Most XDP programs expect Ethernet header at the beginning of a frame.
Unless you write a custom one which doesn't.
But then you may face that XDP_TX, XDP_REDIRECT won't work properly --
cpumap Rx, each .ndo_xdp_xmit() implementation -- all expect Ethernet
header at the beginning.

Thanks,
Olek
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help