================================================================== BUG: KASAN: use-after-free in __xfrm_state_insert+0x8af/0x1450 net/xfrm/xfrm_state.c:1748 Read of size 1 at addr ffff88806731feb0 by task syz.1.8143/2377 CPU: 1 UID: 0 PID: 2377 Comm: syz.1.8143 Not tainted 6.16.0-rc5-next-20250709-syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xca/0x230 mm/kasan/report.c:480 kasan_report+0x118/0x150 mm/kasan/report.c:593 __xfrm_state_insert+0x8af/0x1450 net/xfrm/xfrm_state.c:1748 xfrm_state_insert+0x54/0x60 net/xfrm/xfrm_state.c:1800 ipcomp6_tunnel_attach net/ipv6/ipcomp6.c:129 [inline] ipcomp6_init_state+0x5b0/0x7f0 net/ipv6/ipcomp6.c:161 __xfrm_init_state+0xa76/0x13f0 net/xfrm/xfrm_state.c:3196 xfrm_state_construct net/xfrm/xfrm_user.c:954 [inline] xfrm_add_sa+0x2f5d/0x4080 net/xfrm/xfrm_user.c:1019 xfrm_user_rcv_msg+0x7a0/0xab0 net/xfrm/xfrm_user.c:3501 netlink_rcv_skb+0x208/0x470 net/netlink/af_netlink.c:2551 xfrm_netlink_rcv+0x79/0x90 net/xfrm/xfrm_user.c:3523 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] netlink_unicast+0x75c/0x8e0 net/netlink/af_netlink.c:1346 netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1896 sock_sendmsg_nosec net/socket.c:714 [inline] __sock_sendmsg+0x219/0x270 net/socket.c:729 ____sys_sendmsg+0x505/0x830 net/socket.c:2614 ___sys_sendmsg+0x21f/0x2a0 net/socket.c:2668 __sys_sendmsg net/socket.c:2700 [inline] __do_sys_sendmsg net/socket.c:2705 [inline] __se_sys_sendmsg net/socket.c:2703 [inline] __x64_sys_sendmsg+0x19b/0x260 net/socket.c:2703 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f5443b8e929 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:00007f54419d5038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f5443db6160 RCX: 00007f5443b8e929 RDX: 0000000000000000 RSI: 0000200000000040 RDI: 0000000000000005 RBP: 00007f5443c10b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f5443db6160 R15: 00007ffec1fc2018 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x688 pfn:0x6731f flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000 raw: 0000000000000688 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 2, migratetype Unmovable, gfp_mask 0x152c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 2308, tgid 2296 (syz.0.8126), ts 3052949794322, free_ts 3057443186910 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1848 prep_new_page mm/page_alloc.c:1856 [inline] get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3855 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5145 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2416 alloc_frozen_pages_noprof mm/mempolicy.c:2487 [inline] alloc_pages_noprof+0xa9/0x190 mm/mempolicy.c:2507 folio_alloc_noprof+0x1e/0x30 mm/mempolicy.c:2517 filemap_alloc_folio_noprof+0xdf/0x470 mm/filemap.c:1007 ractl_alloc_folio mm/readahead.c:186 [inline] ra_alloc_folio mm/readahead.c:441 [inline] page_cache_ra_order+0x4de/0xd40 mm/readahead.c:506 do_async_mmap_readahead mm/filemap.c:3332 [inline] filemap_fault+0x5a0/0x1200 mm/filemap.c:3431 __do_fault+0x138/0x390 mm/memory.c:5158 do_read_fault mm/memory.c:5579 [inline] do_fault mm/memory.c:5713 [inline] do_pte_missing mm/memory.c:4240 [inline] handle_pte_fault mm/memory.c:6058 [inline] __handle_mm_fault+0x3611/0x5440 mm/memory.c:6201 handle_mm_fault+0x40a/0x8e0 mm/memory.c:6370 do_user_addr_fault+0x764/0x1390 arch/x86/mm/fault.c:1387 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x76/0xf0 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 page last free pid 2308 tgid 2296 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1392 [inline] free_unref_folios+0xd77/0x1570 mm/page_alloc.c:2949 folios_put_refs+0x559/0x640 mm/swap.c:992 folio_batch_release include/linux/pagevec.h:101 [inline] truncate_inode_pages_range+0x346/0xda0 mm/truncate.c:383 kill_bdev block/bdev.c:91 [inline] blkdev_flush_mapping+0x108/0x270 block/bdev.c:712 blkdev_put_whole block/bdev.c:719 [inline] bdev_release+0x417/0x650 block/bdev.c:1144 blkdev_release+0x15/0x20 block/fops.c:684 __fput+0x44c/0xa70 fs/file_table.c:468 task_work_run+0x1d1/0x260 kernel/task_work.c:227 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x6b5/0x2300 kernel/exit.c:959 do_group_exit+0x21c/0x2d0 kernel/exit.c:1100 get_signal+0x1286/0x1340 kernel/signal.c:3034 arch_do_signal_or_restart+0x9a/0x750 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop+0x75/0x110 kernel/entry/common.c:40 exit_to_user_mode_prepare include/linux/irq-entry-common.h:208 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:175 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:210 [inline] do_syscall_64+0x2bd/0x3b0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88806731fd80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88806731fe00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88806731fe80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88806731ff00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88806731ff80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================