================================================================== 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 ffff8880795f40a0 by task syz.0.290/5750 CPU: 1 PID: 5750 Comm: syz.0.290 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026 Call Trace: 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 pfkey_getspi+0x72d/0xeb0 net/key/af_key.c:1403 pfkey_process net/key/af_key.c:2865 [inline] pfkey_sendmsg+0xc70/0x1140 net/key/af_key.c:3721 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:0x7f8db7fa9c99 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:00007f8db61b4028 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f8db8236190 RCX: 00007f8db7fa9c99 RDX: 0000000000000000 RSI: 0000200000000000 RDI: 0000000000000007 RBP: 00007f8db803b18b R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f8db8236228 R14: 00007f8db8236190 R15: 00007ffe70073748 Allocated by task 5308: 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 __find_acq_core+0x7cf/0x1500 net/xfrm/xfrm_state.c:1432 xfrm_find_acq+0x66/0x90 net/xfrm/xfrm_state.c:1908 pfkey_getspi+0x5c3/0xeb0 net/key/af_key.c:1383 pfkey_process net/key/af_key.c:2865 [inline] pfkey_sendmsg+0xc70/0x1140 net/key/af_key.c:3721 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 Freed by task 4402: kasan_save_stack mm/kasan/common.c:46 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:53 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516 ____kasan_slab_free+0x126/0x1f0 mm/kasan/common.c:237 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1735 [inline] slab_free_freelist_hook+0x133/0x1b0 mm/slub.c:1761 slab_free mm/slub.c:3694 [inline] kmem_cache_free+0xf7/0x2a0 mm/slub.c:3716 xfrm_state_free net/xfrm/xfrm_state.c:507 [inline] xfrm_state_gc_destroy net/xfrm/xfrm_state.c:535 [inline] xfrm_state_gc_task+0x7d6/0xa30 net/xfrm/xfrm_state.c:551 process_one_work+0x8ab/0x1160 kernel/workqueue.c:2292 worker_thread+0xaf5/0x12a0 kernel/workqueue.c:2439 kthread+0x29d/0x330 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 The buggy address belongs to the object at ffff8880795f4000 which belongs to the cache xfrm_state of size 848 The buggy address is located 160 bytes inside of 848-byte region [ffff8880795f4000, ffff8880795f4350) The buggy address belongs to the physical page: page:ffffea0001e57d00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x795f4 head:ffffea0001e57d00 order:2 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000122 ffff8881416e7dc0 raw: 0000000000000000 0000000080100010 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 5308, tgid 5302 (syz.0.204), ts 218462224565, free_ts 218357704374 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2561 prep_new_page mm/page_alloc.c:2568 [inline] get_page_from_freelist+0x208b/0x21a0 mm/page_alloc.c:4368 __alloc_pages+0x1ec/0x4f0 mm/page_alloc.c:5668 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 __find_acq_core+0x7cf/0x1500 net/xfrm/xfrm_state.c:1432 xfrm_find_acq+0x66/0x90 net/xfrm/xfrm_state.c:1908 pfkey_getspi+0x5c3/0xeb0 net/key/af_key.c:1383 pfkey_process net/key/af_key.c:2865 [inline] pfkey_sendmsg+0xc70/0x1140 net/key/af_key.c:3721 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 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1488 [inline] free_pcp_prepare mm/page_alloc.c:1538 [inline] free_unref_page_prepare+0x8e5/0x9e0 mm/page_alloc.c:3422 free_unref_page+0x2e/0x3f0 mm/page_alloc.c:3517 free_large_kmalloc+0xfd/0x1a0 mm/slab_common.c:913 ops_free_list+0x2f6/0x3b0 net/core/net_namespace.c:186 cleanup_net+0x7dc/0xba0 net/core/net_namespace.c:644 process_one_work+0x8ab/0x1160 kernel/workqueue.c:2292 worker_thread+0xaf5/0x12a0 kernel/workqueue.c:2439 kthread+0x29d/0x330 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff8880795f3f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880795f4000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880795f4080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880795f4100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880795f4180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================