WARNING in xfrmi_xmit
Subsystems (4)
syzbot
syzbotHello,
syzbot found the following issue on:
HEAD commit: 666539eecdf4 Merge tag 'assoc-array-fixes-v2' git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=170dce4d580000 kernel config: https://syzkaller.appspot.com/x/.config?x=3cc6a7ee2d24d208 dashboard link: https://syzkaller.appspot.com/bug?extid=d29af9ef5c96a3f5e96c compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=105b5755580000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10136803580000
Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-666539ee.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/57b04345f38e/vmlinux-666539ee.xz
kernel image: https://storage.googleapis.com/syzbot-assets/127bf2b14452/bzImage-666539ee.xz
AI-generated root cause summary:
In AF_XDP generic transmit, xsk_build_skb() and xsk_build_skb_zerocopy() allocate an sk_buff and advance skb->data using skb_reserve(skb, hr) without subsequently resetting the network header via skb_reset_network_header(). Because skb->network_header remains 0 (relative to skb->head), skb_network_offset(skb) returns a negative value equal to -hr (e.g. -64). When transmitting over devices whose ndo_start_xmit checks pskb_inet_may_pull() (such as xfrm interfaces), this negative offset is converted to a large unsigned integer when added to the network header length (0xffffffc0 > INT_MAX), triggering a DEBUG_NET_WARN_ON_ONCE assertion in pskb_may_pull_reason().
full analysis: https://syzkaller.appspot.com/x/ai_root_cause?x=d29af9ef5c96a3f5e96c
IMPORTANT: if you fix the issue, please add the following tag to the commit:
------------[ cut here ]------------ len > ((int)(~0U >> 1)) WARNING: ./include/linux/skbuff.h:2856 at pskb_may_pull_reason include/linux/skbuff.h:2856 [inline], CPU#0: syz.0.17/5560 WARNING: ./include/linux/skbuff.h:2856 at pskb_network_may_pull_reason include/linux/skbuff.h:3286 [inline], CPU#0: syz.0.17/5560 WARNING: ./include/linux/skbuff.h:2856 at pskb_inet_may_pull_reason include/net/ip_tunnels.h:483 [inline], CPU#0: syz.0.17/5560 WARNING: ./include/linux/skbuff.h:2856 at pskb_inet_may_pull include/net/ip_tunnels.h:488 [inline], CPU#0: syz.0.17/5560 WARNING: ./include/linux/skbuff.h:2856 at xfrmi_xmit+0x1844/0x1eb0 net/xfrm/xfrm_interface_core.c:534, CPU#0: syz.0.17/5560 Modules linked in: CPU: 0 UID: 0 PID: 5560 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 RIP: 0010:pskb_may_pull_reason include/linux/skbuff.h:2856 [inline] RIP: 0010:pskb_network_may_pull_reason include/linux/skbuff.h:3286 [inline] RIP: 0010:pskb_inet_may_pull_reason include/net/ip_tunnels.h:483 [inline] RIP: 0010:pskb_inet_may_pull include/net/ip_tunnels.h:488 [inline] RIP: 0010:xfrmi_xmit+0x1844/0x1eb0 net/xfrm/xfrm_interface_core.c:534 Code: db e9 ef fd ff ff e8 bb 47 23 f7 49 8d b4 24 20 01 00 00 48 c7 c7 80 9b 54 8d e8 77 d2 81 f6 e9 c8 f8 ff ff e8 9d 47 23 f7 90 <0f> 0b 90 e9 38 ea ff ff 89 df 44 89 ee e8 9a 49 23 f7 44 39 eb 0f RSP: 0018:ffffc90001be7300 EFLAGS: 00010293 RAX: ffffffff8aa5f033 RBX: 00000000ffffffc0 RCX: ffff88803050a580 RDX: 0000000000000000 RSI: 00000000ffffffc0 RDI: 0000000000000000 RBP: ffffc90001be7490 R08: ffffc90001be7417 R09: 0000000000000000 R10: ffffc90001be73c0 R11: fffff5200037ce83 R12: 0000000000000000 R13: 1ffff9200037ce74 R14: ffff8880136f5358 R15: ffff8880136f5280 FS: 00005555787d1500(0000) GS:ffff88808a9f1000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000001f9fc000 CR4: 0000000000352ef0 Call Trace: <TASK> __netdev_start_xmit include/linux/netdevice.h:5457 [inline] netdev_start_xmit include/linux/netdevice.h:5466 [inline] __dev_direct_xmit+0x4b6/0x730 net/core/dev.c:5164 __xsk_generic_xmit net/xdp/xsk.c:1288 [inline] xsk_generic_xmit+0x27d8/0x47a0 net/xdp/xsk.c:1344 xsk_poll+0x326/0x670 net/xdp/xsk.c:1472 sock_poll+0x341/0x460 net/socket.c:1517 vfs_poll include/linux/poll.h:82 [inline] do_pollfd fs/select.c:877 [inline] do_poll fs/select.c:920 [inline] do_sys_poll+0x98f/0x1150 fs/select.c:1015 __do_sys_ppoll fs/select.c:1112 [inline] __se_sys_ppoll+0x209/0x2b0 fs/select.c:1092 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fa010ba94d9 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fff5b713048 EFLAGS: 00000246 ORIG_RAX: 000000000000010f RAX: ffffffffffffffda RBX: 00007fa010e25fa0 RCX: 00007fa010ba94d9 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000200000000800 RBP: 00007fa010c38136 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fa010e25fac R14: 00007fa010e25fa0 R15: 00007fa010e25fa0 </TASK>
---
This report is generated by a bot. It may contain errors. See https://goo.gl/tpsmEJ for more information about syzbot. syzbot engineers can be reached at [email protected].
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
PATCH 1/1 xfrm: interface: drop non-IP packets before pskb_inet_may_pull()
AF_XDP sockets bound to an xfrm interface submit skbs with skb->protocol unset (0) and skb->network_header still 0 from the __alloc_skb() zero-initialization; skb_reserve() only moves data NET_SKB_PAD bytes into the headroom.
Since commit 86de3a1118a16 ("xfrm: interface: validate the IP header on xmit"), xfrmi_xmit() calls pskb_inet_may_pull() unconditionally. For such a skb, pskb_inet_may_pull_reason() selects nhlen = 0 for the unknown protocol and pskb_may_pull_reason() receives
len = skb_network_offset(skb) = network_header - data = -64, which as unsigned int exceeds INT_MAX and trips the DEBUG_NET_WARN_ON_ONCE(len > INT_MAX) in pskb_may_pull_reason():
WARNING: ./include/linux/skbuff.h:2856 at pskb_may_pull_reason [inline]
WARNING: ./include/linux/skbuff.h:3286 at pskb_network_may_pull_reason [inline]
WARNING: ./include/net/ip_tunnels.h:483 at pskb_inet_may_pull_reason [inline]
WARNING: ./include/net/ip_tunnels.h:488 at pskb_inet_may_pull [inline]
WARNING: ./include/net/ip_tunnels.h:488 at xfrmi_xmit+0x1844/0x1eb0
net/xfrm/xfrm_interface_core.c:534
RIP: 0010:pskb_may_pull_reason include/linux/skbuff.h:2856 [inline]
Call Trace:
__dev_direct_xmit+0x4b6/0x730 net/core/dev.c:5164
__xsk_generic_xmit net/xdp/xsk.c:1288 [inline]
xsk_generic_xmit+0x27d8/0x47a0 net/xdp/xsk.c:1344
xsk_poll+0x326/0x670 net/xdp/xsk.c:1472The packet is dropped by the pull returning PKT_TOO_SMALL and hitting the default case afterwards anyway, so the only visible effect is the warning; reject unknown protocols before the pull to restore the pre-86de3a1118a16 behavior of dropping them silently via the switch default.
--- net/xfrm/xfrm_interface_core.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/xfrm/xfrm_interface_core.c +8 -0
@@ -531,6 +531,14 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev)memset (&fl,0 ,sizeof (fl)); +switch (skb->protocol) { +case htons (ETH_P_IPV6 ): +case htons (ETH_P_IP ): +break ; +default : + goto tx_err; + } +if (!pskb_inet_may_pull (skb)) goto tx_err;
Signature · 1 line
2.43.0
Paolo Abeni
maintainerRe: [PATCH net] xfrm: interface: drop non-IP packets before pskb_inet_may_pull()
Quoted 32 lines · Shuai Liu
AF_XDPsockets bound to an xfrm interface submit skbs withskb->protocolunset (0) andskb->network_headerstill 0 from the__alloc_skb()zero-initialization;skb_reserve()only moves dataNET_SKB_PADbytes into the headroom.Since commit
86de3a1118a16("xfrm: interface: validate the IP header on xmit"),xfrmi_xmit()callspskb_inet_may_pull()unconditionally. For such a skb,pskb_inet_may_pull_reason()selects nhlen = 0 for the unknown protocol andpskb_may_pull_reason()receives
len =skb_network_offset(skb)=network_header- data = -64, which as unsigned int exceedsINT_MAXand trips theDEBUG_NET_WARN_ON_ONCE(len > INT_MAX)inpskb_may_pull_reason():WARNING: ./include/linux/skbuff.h:2856 at pskb_may_pull_reason [inline] WARNING: ./include/linux/skbuff.h:3286 at pskb_network_may_pull_reason [inline] WARNING: ./include/net/ip_tunnels.h:483 at pskb_inet_may_pull_reason [inline] WARNING: ./include/net/ip_tunnels.h:488 at pskb_inet_may_pull [inline] WARNING: ./include/net/ip_tunnels.h:488 at xfrmi_xmit+0x1844/0x1eb0 net/xfrm/xfrm_interface_core.c:534 RIP: 0010:pskb_may_pull_reason include/linux/skbuff.h:2856 [inline] Call Trace: __dev_direct_xmit+0x4b6/0x730 net/core/dev.c:5164 __xsk_generic_xmit net/xdp/xsk.c:1288 [inline] xsk_generic_xmit+0x27d8/0x47a0 net/xdp/xsk.c:1344 xsk_poll+0x326/0x670 net/xdp/xsk.c:1472The packet is dropped by the pull returning
PKT_TOO_SMALLand hitting the default case afterwards anyway, so the only visible effect is the warning; reject unknown protocols before the pull to restore the pre-86de3a1118a16 behavior of dropping them silently via the switch default.
Quoted 4 lines
Reported-by [email protected]Fixes 86de3a1118a16 ("xfrm: interface: validate the IP header on xmit")
The blamed commit is in the current release, Cc: stable is not needed No need to resubmit just for this, I can drop the tag while applying.
Quoted 1 line
Signed-off-by Shuai Liu <[email protected]>
@Steffen: looks good?
/P
Paolo Abeni
maintainerRe: [PATCH net] xfrm: interface: drop non-IP packets before pskb_inet_may_pull()
Quoted 38 lines · Paolo Abeni
Quoted 32 lines · Shuai Liu
AF_XDPsockets bound to an xfrm interface submit skbs withskb->protocolunset (0) andskb->network_headerstill 0 from the__alloc_skb()zero-initialization;skb_reserve()only moves dataNET_SKB_PADbytes into the headroom.Since commit
86de3a1118a16("xfrm: interface: validate the IP header on xmit"),xfrmi_xmit()callspskb_inet_may_pull()unconditionally. For such a skb,pskb_inet_may_pull_reason()selects nhlen = 0 for the unknown protocol andpskb_may_pull_reason()receives
len =skb_network_offset(skb)=network_header- data = -64, which as unsigned int exceedsINT_MAXand trips theDEBUG_NET_WARN_ON_ONCE(len > INT_MAX)inpskb_may_pull_reason():WARNING: ./include/linux/skbuff.h:2856 at pskb_may_pull_reason [inline] WARNING: ./include/linux/skbuff.h:3286 at pskb_network_may_pull_reason [inline] WARNING: ./include/net/ip_tunnels.h:483 at pskb_inet_may_pull_reason [inline] WARNING: ./include/net/ip_tunnels.h:488 at pskb_inet_may_pull [inline] WARNING: ./include/net/ip_tunnels.h:488 at xfrmi_xmit+0x1844/0x1eb0 net/xfrm/xfrm_interface_core.c:534 RIP: 0010:pskb_may_pull_reason include/linux/skbuff.h:2856 [inline] Call Trace: __dev_direct_xmit+0x4b6/0x730 net/core/dev.c:5164 __xsk_generic_xmit net/xdp/xsk.c:1288 [inline] xsk_generic_xmit+0x27d8/0x47a0 net/xdp/xsk.c:1344 xsk_poll+0x326/0x670 net/xdp/xsk.c:1472The packet is dropped by the pull returning
PKT_TOO_SMALLand hitting the default case afterwards anyway, so the only visible effect is the warning; reject unknown protocols before the pull to restore the pre-86de3a1118a16 behavior of dropping them silently via the switch default.Quoted 4 lines
Reported-by [email protected]Fixes 86de3a1118a16 ("xfrm: interface: validate the IP header on xmit")
Quoted 5 lines
The blamed commit is in the current release, Cc: stable is not needed No need to resubmit just for this, I can drop the tag while applying.
Quoted 1 line
Signed-off-by Shuai Liu <[email protected]>@Steffen: looks good?
I forgot to mention. Since this is one of the very rare regression we have nowadays, I would like to have it in this week PR, taking it directly via the 'net' tree would help. Ok with that?
Thanks,
Paolo
Re: [PATCH net] xfrm: interface: drop non-IP packets before pskb_inet_may_pull()
Quoted 39 lines · Paolo Abeni
Quoted 38 lines · Paolo Abeni
Quoted 36 lines · Shuai Liu
AF_XDPsockets bound to an xfrm interface submit skbs withskb->protocolunset (0) andskb->network_headerstill 0 from the__alloc_skb()zero-initialization;skb_reserve()only moves dataNET_SKB_PADbytes into the headroom.Since commit
86de3a1118a16("xfrm: interface: validate the IP header on xmit"),xfrmi_xmit()callspskb_inet_may_pull()unconditionally. For such a skb,pskb_inet_may_pull_reason()selects nhlen = 0 for the unknown protocol andpskb_may_pull_reason()receives
len =skb_network_offset(skb)=network_header- data = -64, which as unsigned int exceedsINT_MAXand trips theDEBUG_NET_WARN_ON_ONCE(len > INT_MAX)inpskb_may_pull_reason():WARNING: ./include/linux/skbuff.h:2856 at pskb_may_pull_reason [inline] WARNING: ./include/linux/skbuff.h:3286 at pskb_network_may_pull_reason [inline] WARNING: ./include/net/ip_tunnels.h:483 at pskb_inet_may_pull_reason [inline] WARNING: ./include/net/ip_tunnels.h:488 at pskb_inet_may_pull [inline] WARNING: ./include/net/ip_tunnels.h:488 at xfrmi_xmit+0x1844/0x1eb0 net/xfrm/xfrm_interface_core.c:534 RIP: 0010:pskb_may_pull_reason include/linux/skbuff.h:2856 [inline] Call Trace: __dev_direct_xmit+0x4b6/0x730 net/core/dev.c:5164 __xsk_generic_xmit net/xdp/xsk.c:1288 [inline] xsk_generic_xmit+0x27d8/0x47a0 net/xdp/xsk.c:1344 xsk_poll+0x326/0x670 net/xdp/xsk.c:1472The packet is dropped by the pull returning
PKT_TOO_SMALLand hitting the default case afterwards anyway, so the only visible effect is the warning; reject unknown protocols before the pull to restore the pre-86de3a1118a16 behavior of dropping them silently via the switch default.Reported-by [email protected]Fixes 86de3a1118a16 ("xfrm: interface: validate the IP header on xmit")
Quoted 8 lines
Quoted 5 lines
The blamed commit is in the current release, Cc: stable is not needed No need to resubmit just for this, I can drop the tag while applying.
Quoted 1 line
Signed-off-by Shuai Liu <[email protected]>@Steffen: looks good?
I forgot to mention. Since this is one of the very rare regression we have nowadays, I would like to have it in this week PR, taking it directly via the 'net' tree would help. Ok with that?
Ok. If it helps, take it into net.
Re: [PATCH net] xfrm: interface: drop non-IP packets before pskb_inet_may_pull()
In reply to Shuai LiuThis patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 13 lines · On Thu, 19 Nov 2026 13:08:14 +0800 you wrote:
AF_XDPsockets bound to an xfrm interface submit skbs withskb->protocolunset (0) andskb->network_headerstill 0 from the__alloc_skb()zero-initialization;skb_reserve()only moves dataNET_SKB_PADbytes into the headroom.Since commit
86de3a1118a16("xfrm: interface: validate the IP header on xmit"),xfrmi_xmit()callspskb_inet_may_pull()unconditionally. For such a skb,pskb_inet_may_pull_reason()selects nhlen = 0 for the unknown protocol andpskb_may_pull_reason()receives
len =skb_network_offset(skb)=network_header- data = -64, which as unsigned int exceedsINT_MAXand trips theDEBUG_NET_WARN_ON_ONCE(len > INT_MAX)inpskb_may_pull_reason():
Quoted 1 line
[...]
Here is the summary with links:
- [net] xfrm: interface: drop non-IP packets before pskb_inet_may_pull()
https://git.kernel.org/netdev/net/c/e509726660dd
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html