KASAN: use-after-free Read in xfrm_alloc_spi

Status: upstream: reported on 2026/11/08 01:39
Reported-by: syzbot+9c5a00a20538ab8aae54@syzkaller.appspotmail.com
First crash: 5d11h, last: 5d11h
▶ ▼ Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.6 KASAN: slab-use-after-free Read in xfrm_alloc_spi origin:upstream 19 syz, C done 204 407d 441d 2/2 fixed on 2025/11/12 13:03

Sample crash report:
netlink: 64 bytes leftover after parsing attributes in process `syz.4.1953'.
==================================================================
BUG: KASAN: use-after-free in xfrm_state_lookup_spi_proto net/xfrm/xfrm_state.c:1315 [inline]
BUG: KASAN: use-after-free in xfrm_alloc_spi+0x5c4/0xcf0 net/xfrm/xfrm_state.c:2132
Read of size 4 at addr ffff8880565528a0 by task syz.4.1953/12121

CPU: 0 PID: 12121 Comm: syz.4.1953 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/15/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0xa8/0x210 mm/kasan/report.c:420
 kasan_report+0x10b/0x140 mm/kasan/report.c:524
 xfrm_state_lookup_spi_proto net/xfrm/xfrm_state.c:1315 [inline]
 xfrm_alloc_spi+0x5c4/0xcf0 net/xfrm/xfrm_state.c:2132
 xfrm_alloc_userspi+0x610/0xb30 net/xfrm/xfrm_user.c:1606
 xfrm_user_rcv_msg+0x7fc/0xaa0 net/xfrm/xfrm_user.c:3119
 netlink_rcv_skb+0x1ef/0x440 net/netlink/af_netlink.c:2516
 xfrm_netlink_rcv+0x75/0x90 net/xfrm/xfrm_user.c:3141
 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
 netlink_unicast+0x7ad/0x920 net/netlink/af_netlink.c:1344
 netlink_sendmsg+0x8ad/0xbd0 net/netlink/af_netlink.c:1877
 sock_sendmsg_nosec net/socket.c:718 [inline]
 __sock_sendmsg net/socket.c:730 [inline]
 ____sys_sendmsg+0x5ed/0x9a0 net/socket.c:2519
 ___sys_sendmsg+0x2a2/0x360 net/socket.c:2573
 __sys_sendmsg net/socket.c:2602 [inline]
 __do_sys_sendmsg net/socket.c:2611 [inline]
 __se_sys_sendmsg+0x1c3/0x2b0 net/socket.c:2609
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f5030b9fb19
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:00007f5031a4b028 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f5030e25fa0 RCX: 00007f5030b9fb19
RDX: 0000000000000000 RSI: 0000200000000b00 RDI: 0000000000000007
RBP: 00007f5030c37b70 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f5030e26038 R14: 00007f5030e25fa0 R15: 00007ffc3f1e3e08
 </TASK>

Allocated by task 10263:
 kasan_save_stack mm/kasan/common.c:46 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:53
 __kasan_slab_alloc+0x6b/0x80 mm/kasan/common.c:329
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x4b/0x490 mm/slab.h:742
 slab_alloc_node mm/slub.c:3366 [inline]
 slab_alloc mm/slub.c:3374 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3381 [inline]
 kmem_cache_alloc+0x18b/0x2f0 mm/slub.c:3390
 kmem_cache_zalloc include/linux/slab.h:689 [inline]
 xfrm_state_alloc+0x1e/0x2a0 net/xfrm/xfrm_state.c:648
 xfrm_state_find+0x1c62/0x28d0 net/xfrm/xfrm_state.c:1179
 xfrm_tmpl_resolve_one net/xfrm/xfrm_policy.c:2421 [inline]
 xfrm_tmpl_resolve net/xfrm/xfrm_policy.c:2466 [inline]
 xfrm_resolve_and_create_bundle+0x7b7/0x2da0 net/xfrm/xfrm_policy.c:2758
 xfrm_lookup_with_ifid+0x265/0x1fc0 net/xfrm/xfrm_policy.c:3092
 xfrm_lookup net/xfrm/xfrm_policy.c:3221 [inline]
 xfrm_lookup_route+0x38/0x1b0 net/xfrm/xfrm_policy.c:3232
 rawv6_sendmsg+0xcb2/0x1710 net/ipv6/raw.c:896
 sock_sendmsg_nosec net/socket.c:718 [inline]
 __sock_sendmsg net/socket.c:730 [inline]
 ____sys_sendmsg+0x5ed/0x9a0 net/socket.c:2519
 ___sys_sendmsg+0x2a2/0x360 net/socket.c:2573
 __sys_sendmmsg+0x2c3/0x510 net/socket.c:2659
 __do_sys_sendmmsg net/socket.c:2688 [inline]
 __se_sys_sendmmsg net/socket.c:2685 [inline]
 __x64_sys_sendmmsg+0x9c/0xb0 net/socket.c:2685
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff888056552800
 which belongs to the cache xfrm_state of size 848
The buggy address is located 160 bytes inside of
 848-byte region [ffff888056552800, ffff888056552b50)

The buggy address belongs to the physical page:
page:ffffea0001595400 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888056550000 pfn:0x56550
head:ffffea0001595400 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffff88801bad5b88 ffffea0001f3ee08 ffff888143efb640
raw: ffff888056550000 0000000000100000 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0x152a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 10263, tgid 10262 (syz.4.1530), ts 785259264884, free_ts 756046622568
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2560
 prep_new_page mm/page_alloc.c:2567 [inline]
 get_page_from_freelist+0x206b/0x2180 mm/page_alloc.c:4358
 __alloc_pages+0x1ec/0x4f0 mm/page_alloc.c:5658
 alloc_slab_page+0x5d/0x180 mm/slub.c:1805
 allocate_slab mm/slub.c:1950 [inline]
 new_slab+0x87/0x2d0 mm/slub.c:2003
 ___slab_alloc+0xbc5/0x1240 mm/slub.c:3161
 __slab_alloc mm/slub.c:3247 [inline]
 slab_alloc_node mm/slub.c:3332 [inline]
 slab_alloc mm/slub.c:3374 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3381 [inline]
 kmem_cache_alloc+0x111/0x2f0 mm/slub.c:3390
 kmem_cache_zalloc include/linux/slab.h:689 [inline]
 xfrm_state_alloc+0x1e/0x2a0 net/xfrm/xfrm_state.c:648
 xfrm_state_find+0x1c62/0x28d0 net/xfrm/xfrm_state.c:1179
 xfrm_tmpl_resolve_one net/xfrm/xfrm_policy.c:2421 [inline]
 xfrm_tmpl_resolve net/xfrm/xfrm_policy.c:2466 [inline]
 xfrm_resolve_and_create_bundle+0x7b7/0x2da0 net/xfrm/xfrm_policy.c:2758
 xfrm_lookup_with_ifid+0x265/0x1fc0 net/xfrm/xfrm_policy.c:3092
 xfrm_lookup net/xfrm/xfrm_policy.c:3221 [inline]
 xfrm_lookup_route+0x38/0x1b0 net/xfrm/xfrm_policy.c:3232
 rawv6_sendmsg+0xcb2/0x1710 net/ipv6/raw.c:896
 sock_sendmsg_nosec net/socket.c:718 [inline]
 __sock_sendmsg net/socket.c:730 [inline]
 ____sys_sendmsg+0x5ed/0x9a0 net/socket.c:2519
 ___sys_sendmsg+0x2a2/0x360 net/socket.c:2573
 __sys_sendmmsg+0x2c3/0x510 net/socket.c:2659
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1487 [inline]
 free_pcp_prepare mm/page_alloc.c:1537 [inline]
 free_unref_page_prepare+0x8e5/0x9e0 mm/page_alloc.c:3414
 free_unref_page+0x2e/0x3f0 mm/page_alloc.c:3509
 free_slab mm/slub.c:2042 [inline]
 discard_slab mm/slub.c:2048 [inline]
 __unfreeze_partials+0x188/0x1e0 mm/slub.c:2598
 put_cpu_partial+0x17c/0x250 mm/slub.c:2674
 qlink_free mm/kasan/quarantine.c:166 [inline]
 qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:185
 kasan_quarantine_reduce+0x144/0x160 mm/kasan/quarantine.c:292
 __kasan_slab_alloc+0x1e/0x80 mm/kasan/common.c:306
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x4b/0x490 mm/slab.h:742
 slab_alloc_node mm/slub.c:3366 [inline]
 slab_alloc mm/slub.c:3374 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3381 [inline]
 kmem_cache_alloc+0x18b/0x2f0 mm/slub.c:3390
 ptlock_alloc mm/memory.c:6045 [inline]
 ptlock_init include/linux/mm.h:2480 [inline]
 pmd_ptlock_init include/linux/mm.h:2566 [inline]
 pgtable_pmd_page_ctor include/linux/mm.h:2602 [inline]
 pmd_alloc_one include/asm-generic/pgalloc.h:129 [inline]
 __pmd_alloc+0x116/0x760 mm/memory.c:5487
 pmd_alloc include/linux/mm.h:2430 [inline]
 __handle_mm_fault mm/memory.c:5131 [inline]
 handle_mm_fault+0xa06/0x3d40 mm/memory.c:5292
 do_user_addr_fault+0x5a9/0xbb0 arch/x86/mm/fault.c:1338
 handle_page_fault arch/x86/mm/fault.c:1429 [inline]
 exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1482
 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:608

Memory state around the buggy address:
 ffff888056552780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888056552800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888056552880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff888056552900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888056552980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/08 01:39 linux-6.1.y c75b0cf0982c 5cecaf1f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in xfrm_alloc_spi
* Struck through repros no longer work on HEAD.