================================================================== 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 ffff88802928d4a0 by task syz.4.1643/12548 CPU: 0 PID: 12548 Comm: syz.4.1643 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:0x7ff917da9c99 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:00007ff918bed028 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007ff918036098 RCX: 00007ff917da9c99 RDX: 0000000000000000 RSI: 0000200000000000 RDI: 0000000000000006 RBP: 00007ff917e3b18b R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ff918036130 R14: 00007ff918036098 R15: 00007ffe033de4d8 Allocated by task 12145: 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 The buggy address belongs to the object at ffff88802928d400 which belongs to the cache xfrm_state of size 848 The buggy address is located 160 bytes inside of 848-byte region [ffff88802928d400, ffff88802928d750) The buggy address belongs to the physical page: page:ffffea0000a4a300 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88802928cc00 pfn:0x2928c head:ffffea0000a4a300 order:2 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000122 ffff8881426ebdc0 raw: ffff88802928cc00 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 0x152a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 8256, tgid 8255 (syz.4.772), ts 587369244972, free_ts 587266722423 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 device_release+0x92/0x1c0 drivers/base/core.c:-1 kobject_cleanup lib/kobject.c:681 [inline] kobject_release lib/kobject.c:712 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x217/0x450 lib/kobject.c:729 netdev_run_todo+0xca9/0xdb0 net/core/dev.c:10612 tun_detach drivers/net/tun.c:708 [inline] tun_chr_close+0x13b/0x1b0 drivers/net/tun.c:3520 __fput+0x20a/0x8b0 fs/file_table.c:320 task_work_run+0x1d0/0x260 kernel/task_work.c:203 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:180 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:213 __syscall_exit_to_user_mode_work kernel/entry/common.c:295 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:306 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Memory state around the buggy address: ffff88802928d380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802928d400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88802928d480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802928d500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802928d580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================