syzbot


KASAN: slab-use-after-free Read in xfrm_alloc_spi

Status: upstream: reported on 2025/08/28 16:50
Reported-by: syzbot+d1b064a9c8637489ebe5@syzkaller.appspotmail.com
First crash: 1d18h, last: 11h43m

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in xfrm_state_lookup_spi_proto net/xfrm/xfrm_state.c:1477 [inline]
BUG: KASAN: slab-use-after-free in xfrm_alloc_spi+0x598/0x11f0 net/xfrm/xfrm_state.c:2302
Read of size 4 at addr ffff88801f37b0a0 by task syz.4.9326/26492

CPU: 0 PID: 26492 Comm: syz.4.9326 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xac/0x220 mm/kasan/report.c:468
 kasan_report+0x117/0x150 mm/kasan/report.c:581
 xfrm_state_lookup_spi_proto net/xfrm/xfrm_state.c:1477 [inline]
 xfrm_alloc_spi+0x598/0x11f0 net/xfrm/xfrm_state.c:2302
 xfrm_alloc_userspi+0x5d1/0xa90 net/xfrm/xfrm_user.c:1623
 xfrm_user_rcv_msg+0x596/0x870 net/xfrm/xfrm_user.c:3169
 netlink_rcv_skb+0x216/0x480 net/netlink/af_netlink.c:2545
 xfrm_netlink_rcv+0x79/0x90 net/xfrm/xfrm_user.c:3191
 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
 netlink_unicast+0x751/0x8d0 net/netlink/af_netlink.c:1346
 netlink_sendmsg+0x8c1/0xbe0 net/netlink/af_netlink.c:1894
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg net/socket.c:745 [inline]
 ____sys_sendmsg+0x5bf/0x950 net/socket.c:2595
 ___sys_sendmsg+0x220/0x290 net/socket.c:2649
 __sys_sendmsg net/socket.c:2678 [inline]
 __do_sys_sendmsg net/socket.c:2687 [inline]
 __se_sys_sendmsg+0x1a5/0x270 net/socket.c:2685
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fd497b8ebe9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fd495df6038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fd497dc5fa0 RCX: 00007fd497b8ebe9
RDX: 0000000000000000 RSI: 0000200000000540 RDI: 0000000000000003
RBP: 00007fd497c11e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fd497dc6038 R14: 00007fd497dc5fa0 R15: 00007ffd5e916888
 </TASK>

Allocated by task 24759:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4e/0x70 mm/kasan/common.c:52
 __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:188 [inline]
 slab_post_alloc_hook+0x6e/0x4d0 mm/slab.h:767
 slab_alloc_node mm/slub.c:3485 [inline]
 slab_alloc mm/slub.c:3493 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3500 [inline]
 kmem_cache_alloc+0x11e/0x2e0 mm/slub.c:3509
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 xfrm_state_alloc+0x22/0x2a0 net/xfrm/xfrm_state.c:661
 __find_acq_core+0x7d8/0x19d0 net/xfrm/xfrm_state.c:1598
 xfrm_find_acq+0x6a/0x90 net/xfrm/xfrm_state.c:2070
 xfrm_alloc_userspi+0x57a/0xa90 net/xfrm/xfrm_user.c:1613
 xfrm_user_rcv_msg+0x596/0x870 net/xfrm/xfrm_user.c:3169
 netlink_rcv_skb+0x216/0x480 net/netlink/af_netlink.c:2545
 xfrm_netlink_rcv+0x79/0x90 net/xfrm/xfrm_user.c:3191
 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
 netlink_unicast+0x751/0x8d0 net/netlink/af_netlink.c:1346
 netlink_sendmsg+0x8c1/0xbe0 net/netlink/af_netlink.c:1894
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg net/socket.c:745 [inline]
 ____sys_sendmsg+0x5bf/0x950 net/socket.c:2595
 ___sys_sendmsg+0x220/0x290 net/socket.c:2649
 __sys_sendmsg net/socket.c:2678 [inline]
 __do_sys_sendmsg net/socket.c:2687 [inline]
 __se_sys_sendmsg+0x1a5/0x270 net/socket.c:2685
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

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

The buggy address belongs to the physical page:
page:ffffea00007cde00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88801f37ac00 pfn:0x1f378
head:ffffea00007cde00 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888144e41500 dead000000000122 0000000000000000
raw: ffff88801f37ac00 000000008010000c 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 0x152820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 7552, tgid 7549 (syz.2.689), ts 145058730606, free_ts 144972605357
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1cd/0x210 mm/page_alloc.c:1554
 prep_new_page mm/page_alloc.c:1561 [inline]
 get_page_from_freelist+0x195c/0x19f0 mm/page_alloc.c:3191
 __alloc_pages+0x1e3/0x460 mm/page_alloc.c:4457
 alloc_slab_page+0x5d/0x170 mm/slub.c:1876
 allocate_slab mm/slub.c:2023 [inline]
 new_slab+0x87/0x2e0 mm/slub.c:2076
 ___slab_alloc+0xc6d/0x12f0 mm/slub.c:3230
 __slab_alloc mm/slub.c:3329 [inline]
 __slab_alloc_node mm/slub.c:3382 [inline]
 slab_alloc_node mm/slub.c:3475 [inline]
 slab_alloc mm/slub.c:3493 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3500 [inline]
 kmem_cache_alloc+0x1b7/0x2e0 mm/slub.c:3509
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 xfrm_state_alloc+0x22/0x2a0 net/xfrm/xfrm_state.c:661
 pfkey_msg2xfrm_state net/key/af_key.c:1122 [inline]
 pfkey_add+0x6e1/0x2da0 net/key/af_key.c:1503
 pfkey_process net/key/af_key.c:2847 [inline]
 pfkey_sendmsg+0xbed/0x1050 net/key/af_key.c:3698
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg net/socket.c:745 [inline]
 ____sys_sendmsg+0x5bf/0x950 net/socket.c:2595
 ___sys_sendmsg+0x220/0x290 net/socket.c:2649
 __sys_sendmsg net/socket.c:2678 [inline]
 __do_sys_sendmsg net/socket.c:2687 [inline]
 __se_sys_sendmsg+0x1a5/0x270 net/socket.c:2685
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1154 [inline]
 free_unref_page_prepare+0x7ce/0x8e0 mm/page_alloc.c:2336
 free_unref_page+0x32/0x2e0 mm/page_alloc.c:2429
 __slab_free+0x35e/0x410 mm/slub.c:3722
 qlink_free mm/kasan/quarantine.c:166 [inline]
 qlist_free_all+0x75/0xe0 mm/kasan/quarantine.c:185
 kasan_quarantine_reduce+0x143/0x160 mm/kasan/quarantine.c:292
 __kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:188 [inline]
 slab_post_alloc_hook+0x6e/0x4d0 mm/slab.h:767
 slab_alloc_node mm/slub.c:3485 [inline]
 slab_alloc mm/slub.c:3493 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3500 [inline]
 kmem_cache_alloc+0x11e/0x2e0 mm/slub.c:3509
 getname_flags+0xbb/0x500 fs/namei.c:140
 getname fs/namei.c:219 [inline]
 __do_sys_unlink fs/namei.c:4439 [inline]
 __se_sys_unlink fs/namei.c:4437 [inline]
 __x64_sys_unlink+0x3c/0x50 fs/namei.c:4437
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
 ffff88801f37af80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88801f37b000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88801f37b080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff88801f37b100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801f37b180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (27):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/08/29 23:38 linux-6.6.y cc1a1c5b404a 807a3b61 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 23:26 linux-6.6.y cc1a1c5b404a 807a3b61 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 23:23 linux-6.6.y cc1a1c5b404a 807a3b61 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 23:22 linux-6.6.y cc1a1c5b404a 807a3b61 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 23:06 linux-6.6.y cc1a1c5b404a 807a3b61 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 23:04 linux-6.6.y cc1a1c5b404a 807a3b61 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 23:03 linux-6.6.y cc1a1c5b404a 807a3b61 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 23:03 linux-6.6.y cc1a1c5b404a 807a3b61 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 18:55 linux-6.6.y cc1a1c5b404a 3e1beec6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 15:56 linux-6.6.y cc1a1c5b404a 3e1beec6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 15:55 linux-6.6.y cc1a1c5b404a 3e1beec6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 15:55 linux-6.6.y cc1a1c5b404a 3e1beec6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 15:53 linux-6.6.y cc1a1c5b404a 3e1beec6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 09:55 linux-6.6.y cc1a1c5b404a 3e1beec6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 09:54 linux-6.6.y cc1a1c5b404a 3e1beec6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 09:42 linux-6.6.y cc1a1c5b404a 3e1beec6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 02:15 linux-6.6.y cc1a1c5b404a d401b9d7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 01:55 linux-6.6.y cc1a1c5b404a d401b9d7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/28 21:30 linux-6.6.y cc1a1c5b404a d401b9d7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/28 20:29 linux-6.6.y cc1a1c5b404a d401b9d7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/28 20:21 linux-6.6.y cc1a1c5b404a d401b9d7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/28 20:19 linux-6.6.y cc1a1c5b404a d401b9d7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/28 20:18 linux-6.6.y cc1a1c5b404a d401b9d7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/28 16:49 linux-6.6.y cc1a1c5b404a e12e5ba4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in xfrm_alloc_spi
2025/08/29 09:55 linux-6.6.y cc1a1c5b404a 3e1beec6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KFENCE: use-after-free read in xfrm_alloc_spi
2025/08/29 09:42 linux-6.6.y cc1a1c5b404a 3e1beec6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan general protection fault in xfrm_alloc_spi
2025/08/29 02:12 linux-6.6.y cc1a1c5b404a d401b9d7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in xfrm_alloc_spi
* Struck through repros no longer work on HEAD.