================================================================== BUG: KASAN: slab-use-after-free in __xfrm_state_lookup_all net/xfrm/xfrm_state.c:-1 [inline] BUG: KASAN: slab-use-after-free in xfrm_state_find+0x2cf2/0x5400 net/xfrm/xfrm_state.c:1499 Read of size 1 at addr ffff888057ef0ff0 by task kworker/u8:1/13 CPU: 1 UID: 0 PID: 13 Comm: kworker/u8:1 Not tainted 6.16.0-rc5-next-20250710-syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Workqueue: bat_events batadv_nc_worker 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_lookup_all net/xfrm/xfrm_state.c:-1 [inline] xfrm_state_find+0x2cf2/0x5400 net/xfrm/xfrm_state.c:1499 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/0x2f90 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_output_key include/net/route.h:179 [inline] tipc_udp_xmit+0x1c3/0xaa0 net/tipc/udp_media.c:189 tipc_bearer_xmit_skb+0x2b3/0x400 net/tipc/bearer.c:575 tipc_disc_timeout+0x580/0x6d0 net/tipc/discover.c:338 call_timer_fn+0x17b/0x5f0 kernel/time/timer.c:1747 expire_timers kernel/time/timer.c:1798 [inline] __run_timers kernel/time/timer.c:2372 [inline] __run_timer_base+0x61a/0x860 kernel/time/timer.c:2384 run_timer_base kernel/time/timer.c:2393 [inline] run_timer_softirq+0xb7/0x180 kernel/time/timer.c:2403 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 spin_unlock_bh include/linux/spinlock.h:396 [inline] batadv_nc_purge_paths+0x318/0x3b0 net/batman-adv/network-coding.c:471 batadv_nc_worker+0x369/0x610 net/batman-adv/network-coding.c:722 process_one_work kernel/workqueue.c:3239 [inline] process_scheduled_works+0xade/0x17b0 kernel/workqueue.c:3322 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3403 kthread+0x711/0x8a0 kernel/kthread.c:463 ret_from_fork+0x3f9/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 13594: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:319 [inline] __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:345 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4180 [inline] slab_alloc_node mm/slub.c:4229 [inline] kmem_cache_alloc_noprof+0x1c1/0x3c0 mm/slub.c:4236 xfrm_state_alloc+0x24/0x2f0 net/xfrm/xfrm_state.c:733 __find_acq_core+0x8a7/0x1c00 net/xfrm/xfrm_state.c:1838 xfrm_find_acq+0x78/0xa0 net/xfrm/xfrm_state.c:2358 xfrm_alloc_userspi+0x6b5/0xca0 net/xfrm/xfrm_user.c:1863 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 Freed by task 5958: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x62/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2417 [inline] slab_free mm/slub.c:4680 [inline] kmem_cache_free+0x18f/0x400 mm/slub.c:4782 xfrm_state_gc_task+0x109/0x160 net/xfrm/xfrm_state.c:634 process_one_work kernel/workqueue.c:3239 [inline] process_scheduled_works+0xade/0x17b0 kernel/workqueue.c:3322 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3403 kthread+0x711/0x8a0 kernel/kthread.c:463 ret_from_fork+0x3f9/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 The buggy address belongs to the object at ffff888057ef0cc0 which belongs to the cache xfrm_state of size 928 The buggy address is located 816 bytes inside of freed 928-byte region [ffff888057ef0cc0, ffff888057ef1060) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888057ef2a80 pfn:0x57ef0 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff888144ed7000 dead000000000122 0000000000000000 raw: ffff888057ef2a80 00000000800f0006 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff888144ed7000 dead000000000122 0000000000000000 head: ffff888057ef2a80 00000000800f0006 00000000f5000000 0000000000000000 head: 00fff00000000002 ffffea00015fbc01 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 10881, tgid 10880 (syz.1.1698), ts 297022391728, free_ts 209801502066 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_slab_page mm/slub.c:2487 [inline] allocate_slab+0x8a/0x370 mm/slub.c:2655 new_slab mm/slub.c:2709 [inline] ___slab_alloc+0xbeb/0x1410 mm/slub.c:3891 __slab_alloc mm/slub.c:3981 [inline] __slab_alloc_node mm/slub.c:4056 [inline] slab_alloc_node mm/slub.c:4217 [inline] kmem_cache_alloc_noprof+0x283/0x3c0 mm/slub.c:4236 xfrm_state_alloc+0x24/0x2f0 net/xfrm/xfrm_state.c:733 __find_acq_core+0x8a7/0x1c00 net/xfrm/xfrm_state.c:1838 xfrm_find_acq+0x78/0xa0 net/xfrm/xfrm_state.c:2358 pfkey_getspi+0x65f/0xee0 net/key/af_key.c:1365 pfkey_process net/key/af_key.c:2848 [inline] pfkey_sendmsg+0xbfb/0x1090 net/key/af_key.c:3699 sock_sendmsg_nosec net/socket.c:714 [inline] __sock_sendmsg+0x219/0x270 net/socket.c:729 ____sys_sendmsg+0x52d/0x830 net/socket.c:2614 ___sys_sendmsg+0x21f/0x2a0 net/socket.c:2668 __sys_sendmmsg+0x227/0x430 net/socket.c:2757 page last free pid 8519 tgid 8519 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 discard_slab mm/slub.c:2753 [inline] __put_partials+0x156/0x1a0 mm/slub.c:3218 put_cpu_partial+0x17c/0x250 mm/slub.c:3293 __slab_free+0x2d5/0x3c0 mm/slub.c:4550 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x97/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4180 [inline] slab_alloc_node mm/slub.c:4229 [inline] kmem_cache_alloc_noprof+0x1c1/0x3c0 mm/slub.c:4236 ptlock_alloc+0x20/0x70 mm/memory.c:7163 ptlock_init include/linux/mm.h:2951 [inline] pagetable_pte_ctor include/linux/mm.h:3000 [inline] __pte_alloc_one_noprof include/asm-generic/pgalloc.h:78 [inline] pte_alloc_one+0x7d/0x170 arch/x86/mm/pgtable.c:18 __do_fault+0xd1/0x390 mm/memory.c:5153 do_shared_fault mm/memory.c:5643 [inline] do_fault mm/memory.c:5717 [inline] do_pte_missing mm/memory.c:4240 [inline] handle_pte_fault mm/memory.c:6058 [inline] __handle_mm_fault+0x1847/0x5440 mm/memory.c:6201 handle_mm_fault+0x40a/0x8e0 mm/memory.c:6370 do_user_addr_fault+0xa81/0x1390 arch/x86/mm/fault.c:1336 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 Memory state around the buggy address: ffff888057ef0e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888057ef0f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888057ef0f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888057ef1000: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff888057ef1080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================