================================================================== BUG: KASAN: use-after-free in __xfrm_state_lookup_all net/xfrm/xfrm_state.c:-1 [inline] BUG: KASAN: use-after-free in xfrm_state_find+0x2cf2/0x5400 net/xfrm/xfrm_state.c:1494 Read of size 1 at addr ffff8880331e4330 by task syz.2.442/7851 CPU: 1 UID: 0 PID: 7851 Comm: syz.2.442 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/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/0x240 mm/kasan/report.c:482 kasan_report+0x118/0x150 mm/kasan/report.c:595 __xfrm_state_lookup_all net/xfrm/xfrm_state.c:-1 [inline] xfrm_state_find+0x2cf2/0x5400 net/xfrm/xfrm_state.c:1494 xfrm_tmpl_resolve_one net/xfrm/xfrm_policy.c:2522 [inline] xfrm_tmpl_resolve net/xfrm/xfrm_policy.c:2573 [inline] xfrm_resolve_and_create_bundle+0x768/0x2f80 net/xfrm/xfrm_policy.c:2871 xfrm_bundle_lookup net/xfrm/xfrm_policy.c:3106 [inline] xfrm_lookup_with_ifid+0x58a/0x1a70 net/xfrm/xfrm_policy.c:3237 xfrm_lookup net/xfrm/xfrm_policy.c:3336 [inline] xfrm_lookup_route+0x3c/0x1c0 net/xfrm/xfrm_policy.c:3347 ip_route_connect include/net/route.h:355 [inline] __ip4_datagram_connect+0x9a5/0x1270 net/ipv4/datagram.c:49 udp_connect+0x33/0x1f0 net/ipv4/udp.c:2153 __sys_connect_file net/socket.c:2086 [inline] __sys_connect+0x313/0x440 net/socket.c:2105 __do_sys_connect net/socket.c:2111 [inline] __se_sys_connect net/socket.c:2108 [inline] __x64_sys_connect+0x7a/0x90 net/socket.c:2108 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:0x7fb687f8eba9 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:00007fb6861d5038 EFLAGS: 00000246 ORIG_RAX: 000000000000002a RAX: ffffffffffffffda RBX: 00007fb6881d6090 RCX: 00007fb687f8eba9 RDX: 0000000000000010 RSI: 0000200000000040 RDI: 0000000000000007 RBP: 00007fb688011e19 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fb6881d6128 R14: 00007fb6881d6090 R15: 00007ffc9e5a5078 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff8880331e4000 pfn:0x331e4 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffffea0001ef4c08 ffffea00015da308 0000000000000000 raw: ffff8880331e4000 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 0x92800(GFP_NOWAIT|__GFP_NORETRY|__GFP_NOMEMALLOC), pid 5528, tgid 5528 (dhcpcd), ts 149103222348, free_ts 149103275209 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1851 prep_new_page mm/page_alloc.c:1859 [inline] get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3858 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5148 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 stack_depot_save_flags+0x777/0x860 lib/stackdepot.c:677 ref_tracker_free+0xfe/0x7d0 lib/ref_tracker.c:308 netdev_tracker_free include/linux/netdevice.h:4395 [inline] netdev_put include/linux/netdevice.h:4412 [inline] dst_destroy+0x10f/0x350 net/core/dst.c:114 rcu_do_batch kernel/rcu/tree.c:2605 [inline] rcu_core+0xcab/0x1770 kernel/rcu/tree.c:2861 handle_softirqs+0x283/0x870 kernel/softirq.c:579 do_softirq+0xec/0x180 kernel/softirq.c:480 __local_bh_enable_ip+0x17d/0x1c0 kernel/softirq.c:407 lock_sock include/net/sock.h:1671 [inline] sockopt_lock_sock net/core/sock.c:1146 [inline] sk_setsockopt+0xe10/0x2dc0 net/core/sock.c:1304 do_sock_setsockopt+0x11b/0x1b0 net/socket.c:2340 __sys_setsockopt net/socket.c:2369 [inline] __do_sys_setsockopt net/socket.c:2375 [inline] __se_sys_setsockopt net/socket.c:2372 [inline] __x64_sys_setsockopt+0x13f/0x1b0 net/socket.c:2372 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 page last free pid 5528 tgid 5528 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1395 [inline] __free_frozen_pages+0xbc4/0xd30 mm/page_alloc.c:2895 stack_depot_save_flags+0x436/0x860 lib/stackdepot.c:727 ref_tracker_free+0xfe/0x7d0 lib/ref_tracker.c:308 netdev_tracker_free include/linux/netdevice.h:4395 [inline] netdev_put include/linux/netdevice.h:4412 [inline] dst_destroy+0x10f/0x350 net/core/dst.c:114 rcu_do_batch kernel/rcu/tree.c:2605 [inline] rcu_core+0xcab/0x1770 kernel/rcu/tree.c:2861 handle_softirqs+0x283/0x870 kernel/softirq.c:579 do_softirq+0xec/0x180 kernel/softirq.c:480 __local_bh_enable_ip+0x17d/0x1c0 kernel/softirq.c:407 lock_sock include/net/sock.h:1671 [inline] sockopt_lock_sock net/core/sock.c:1146 [inline] sk_setsockopt+0xe10/0x2dc0 net/core/sock.c:1304 do_sock_setsockopt+0x11b/0x1b0 net/socket.c:2340 __sys_setsockopt net/socket.c:2369 [inline] __do_sys_setsockopt net/socket.c:2375 [inline] __se_sys_setsockopt net/socket.c:2372 [inline] __x64_sys_setsockopt+0x13f/0x1b0 net/socket.c:2372 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 Memory state around the buggy address: ffff8880331e4200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880331e4280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8880331e4300: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8880331e4380: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880331e4400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================