WARNING in xfrmi_xmit

Status: upstream: reported C repro on 2026/11/18 16:14
Subsystems: net
Labels: prio:low
[Documentation on labels]
Reported-by: syzbot+d29af9ef5c96a3f5e96c@syzkaller.appspotmail.com
First crash: 1d04h, last: 20h32m
✨ 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 AI root cause analysis
Based on kernel commit 666539eecdf4:

Root Cause Technical Analysis

1. Context and Involved Components

2. Detailed Bug Mechanism

  1. Uninitialized Network Header in Generic XSK Transmission: When an AF_XDP socket transmits in generic mode via xsk_generic_xmit() / __xsk_generic_xmit(), it builds an sk_buff using xsk_build_skb() (or xsk_build_skb_zerocopy()). In xsk_build_skb() (net/xdp/xsk.c:1133-1140):

    hr = max(NET_SKB_PAD, L1_CACHE_ALIGN(dev->needed_headroom));
    tr = dev->needed_tailroom;
    skb = sock_alloc_send_skb(&xs->sk, hr + len + tr, 1, &err);
    ...
    skb_reserve(skb, hr);
    skb_put(skb, len);
    skb_store_bits(skb, 0, buffer, len);
    

    sock_alloc_send_skb() initializes skb->network_header to 0. skb_reserve(skb, hr) shifts skb->data forward by hr (64 bytes on x86_64, where NET_SKB_PAD == 64). Unlike raw packet socket paths (such as tpacket_fill_skb() or packet_snd() in net/packet/af_packet.c), which explicitly call skb_reset_network_header(skb) after skb_reserve(), xsk_build_skb() and xsk_build_skb_zerocopy() do not reset skb->network_header. Consequently, skb->network_header remains 0, meaning skb_network_header(skb) points to skb->head, while skb->data points to skb->head + hr.

  2. Negative Network Header Offset: __xsk_generic_xmit() passes the newly built skb to __dev_direct_xmit(), which directly invokes the destination netdev's dev->netdev_ops->ndo_start_xmit(skb, dev). When AF_XDP is bound to an L3/tunnel device (such as xfrm0 whose ndo_start_xmit is xfrmi_xmit()), xfrmi_xmit() expects an L3 payload and immediately verifies the packet headers using:

    if (!pskb_inet_may_pull(skb))
        goto tx_err;
    

    pskb_inet_may_pull() calls pskb_inet_may_pull_reason(skb) (include/net/ip_tunnels.h:466):

    switch (skb->protocol) {
    case htons(ETH_P_IPV6):
        nhlen = sizeof(struct ipv6hdr);
        break;
    case htons(ETH_P_IP):
        nhlen = sizeof(struct iphdr);
        break;
    default:
        nhlen = 0;
    }
    return pskb_network_may_pull_reason(skb, nhlen);
    

    Because AF_XDP does not initialize skb->protocol, skb->protocol is 0, leading to nhlen = 0.

  3. Integer Underflow and Warning Trigger: pskb_network_may_pull_reason() (include/linux/skbuff.h:3284) computes the pull length:

    static inline enum skb_drop_reason
    pskb_network_may_pull_reason(struct sk_buff *skb, unsigned int len)
    {
        return pskb_may_pull_reason(skb, skb_network_offset(skb) + len);
    }
    

    Here, skb_network_offset(skb) is defined as skb_network_header(skb) - skb->data. Because skb->network_header was never reset: $$\text{skb_network_offset} = \text{skb}\to\text{head} - (\text{skb}\to\text{head} + 64) = -64 \text{ (as a signed int)}.$$ When evaluated in skb_network_offset(skb) + len where len is unsigned int (0), standard C integer conversion rules convert -64 to (unsigned int)0xffffffc0 (4,294,967,232). Inside pskb_may_pull_reason() (include/linux/skbuff.h:2854):

    DEBUG_NET_WARN_ON_ONCE(len > INT_MAX);
    

    Because len == 0xffffffc0 > 0x7fffffff (INT_MAX), the assertion fires, triggering the warning splat reported by syzkaller.

3. Resolution

In net/xdp/xsk.c, xsk_build_skb() and xsk_build_skb_zerocopy() should ensure that skb_reset_network_header(skb) (and skb_reset_mac_header(skb) where appropriate) is called after reserving headroom, ensuring skb_network_offset(skb) evaluates to 0 when transmitting over L3/tunnel devices.

▶ ▼ ✨ AI Jobs (2)
ID Workflow Result Correct Bug Created Started Finished Revision
abf59af0 bisect-cause 🏃 WARNING in xfrmi_xmit 2026/11/18 16:37 2026/11/18 16:37 2006bdcc
67b81572 assessment-security DenialOfService: ❌ Exploitable: ❌ FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: ❌ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: ✅ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ WARNING in xfrmi_xmit 2026/11/18 15:11 2026/11/18 15:11 2026/11/18 16:07 2006bdcc
▶ ▼ Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [net?] WARNING in xfrmi_xmit 0 (1) 2026/11/18 16:14

Sample crash report:
------------[ 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>

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/17 20:34 upstream 666539eecdf4 43af6cac .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root WARNING in xfrmi_xmit
2026/11/17 18:57 upstream 666539eecdf4 43af6cac .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root WARNING in xfrmi_xmit
2026/11/17 17:20 upstream 666539eecdf4 43af6cac .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root WARNING in xfrmi_xmit
2026/11/17 15:42 upstream 666539eecdf4 43af6cac .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root WARNING in xfrmi_xmit
2026/11/17 14:03 upstream 666539eecdf4 43af6cac .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root WARNING in xfrmi_xmit
2026/11/17 12:26 upstream 666539eecdf4 43af6cac .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root WARNING in xfrmi_xmit
* Struck through repros no longer work on HEAD.