==================================================================
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:1494
Read of size 1 at addr ffff8880557dc330 by task syz-executor/16362
CPU: 1 UID: 0 PID: 16362 Comm: syz-executor Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/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_output_key include/net/route.h:179 [inline]
tipc_udp_xmit+0x1c3/0xaa0 net/tipc/udp_media.c:189
tipc_udp_send_msg+0x27f/0x3f0 net/tipc/udp_media.c:271
tipc_bearer_xmit_skb+0x2b0/0x400 net/tipc/bearer.c:575
tipc_disc_timeout+0x580/0x6d0 net/tipc/discover.c:338
call_timer_fn+0x17e/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 kernel/softirq.c:613 [inline]
invoke_softirq kernel/softirq.c:453 [inline]
__irq_exit_rcu+0xca/0x1f0 kernel/softirq.c:680
irq_exit_rcu+0x9/0x30 kernel/softirq.c:696
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1050 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1050
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
RIP: 0010:rcu_lock_acquire include/linux/rcupdate.h:331 [inline]
RIP: 0010:rcu_read_lock include/linux/rcupdate.h:841 [inline]
RIP: 0010:class_rcu_constructor include/linux/rcupdate.h:1155 [inline]
RIP: 0010:unwind_next_frame+0xa5/0x2390 arch/x86/kernel/unwind_orc.c:479
Code: de 1b 00 00 41 8b 06 85 c0 0f 84 32 02 00 00 89 84 24 84 00 00 00 4c 89 bc 24 90 00 00 00 e8 f2 57 34 00 4c 8d 3d 00 00 00 00 <48> c7 c7 20 9f 13 8e 31 f6 31 d2 b9 02 00 00 00 45 31 c0 45 31 c9
RSP: 0018:ffffc90004916ad8 EFLAGS: 00000283
RAX: 0000000000000001 RBX: ffffffff820c0ab1 RCX: dffffc0000000000
RDX: dffffc0000000000 RSI: ffffffff820c0ab1 RDI: ffffc90004916ba8
RBP: dffffc0000000000 R08: ffffc90004916c70 R09: 0000000000000007
R10: ffffc90004916bf8 R11: ffffffff81ac3ae0 R12: 1ffff92000922d75
R13: ffffc90004916be0 R14: ffffc90004916ba8 R15: ffffffff8172c195
arch_stack_walk+0x11c/0x150 arch/x86/kernel/stacktrace.c:25
stack_trace_save+0x9c/0xe0 kernel/stacktrace.c:122
save_stack+0xf5/0x1f0 mm/page_owner.c:156
__set_page_owner+0x8d/0x4a0 mm/page_owner.c:329
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
pagetable_alloc_noprof include/linux/mm.h:2881 [inline]
__pte_alloc_one_noprof include/asm-generic/pgalloc.h:75 [inline]
pte_alloc_one+0x21/0x170 arch/x86/mm/pgtable.c:18
__pte_alloc+0x25/0x1a0 mm/memory.c:452
copy_pte_range mm/memory.c:1107 [inline]
copy_pmd_range+0x6a91/0x71d0 mm/memory.c:1261
copy_pud_range mm/memory.c:1298 [inline]
copy_p4d_range mm/memory.c:1322 [inline]
copy_page_range+0xc14/0x1270 mm/memory.c:1410
dup_mmap+0xf57/0x1ac0 mm/mmap.c:1834
dup_mm kernel/fork.c:1485 [inline]
copy_mm+0x13c/0x4b0 kernel/fork.c:1537
copy_process+0x1706/0x3c00 kernel/fork.c:2175
kernel_clone+0x21e/0x840 kernel/fork.c:2605
__do_sys_clone kernel/fork.c:2748 [inline]
__se_sys_clone kernel/fork.c:2732 [inline]
__x64_sys_clone+0x18b/0x1e0 kernel/fork.c:2732
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:0x7f6de5385453
Code: 1f 84 00 00 00 00 00 64 48 8b 04 25 10 00 00 00 45 31 c0 31 d2 31 f6 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 89 c2 85 c0 75 2c 64 48 8b 04 25 10 00 00
RSP: 002b:00007ffd8e619388 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f6de5385453
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000001
R10: 0000555569f9d7d0 R11: 0000000000000246 R12: 0000000000000000
R13: 00000000000927c0 R14: 0000000000075c54 R15: 00007ffd8e619520
Allocated by task 12859:
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:330 [inline]
__kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:356
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4191 [inline]
slab_alloc_node mm/slub.c:4240 [inline]
kmem_cache_alloc_noprof+0x1c1/0x3c0 mm/slub.c:4247
xfrm_state_alloc+0x24/0x2f0 net/xfrm/xfrm_state.c:733
__find_acq_core+0x8a7/0x1c00 net/xfrm/xfrm_state.c:1833
xfrm_find_acq+0x78/0xa0 net/xfrm/xfrm_state.c:2353
xfrm_alloc_userspi+0x6b3/0xc90 net/xfrm/xfrm_user.c:1863
xfrm_user_rcv_msg+0x7a0/0xab0 net/xfrm/xfrm_user.c:3501
netlink_rcv_skb+0x205/0x470 net/netlink/af_netlink.c:2552
xfrm_netlink_rcv+0x79/0x90 net/xfrm/xfrm_user.c:3523
netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
netlink_unicast+0x82c/0x9e0 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+0x21c/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 24:
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:243 [inline]
__kasan_slab_free+0x5b/0x80 mm/kasan/common.c:275
kasan_slab_free include/linux/kasan.h:233 [inline]
slab_free_hook mm/slub.c:2422 [inline]
slab_free mm/slub.c:4695 [inline]
kmem_cache_free+0x18f/0x400 mm/slub.c:4797
xfrm_state_free net/xfrm/xfrm_state.c:591 [inline]
xfrm_state_gc_destroy net/xfrm/xfrm_state.c:618 [inline]
xfrm_state_gc_task+0x52d/0x6b0 net/xfrm/xfrm_state.c:634
process_one_work kernel/workqueue.c:3236 [inline]
process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3319
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3400
kthread+0x70e/0x8a0 kernel/kthread.c:463
ret_from_fork+0x3fc/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 ffff8880557dc000
which belongs to the cache xfrm_state of size 928
The buggy address is located 816 bytes inside of
freed 928-byte region [ffff8880557dc000, ffff8880557dc3a0)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff8880557dddc0 pfn:0x557dc
head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801af783c0 0000000000000000 0000000000000001
raw: ffff8880557dddc0 00000000000f000c 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801af783c0 0000000000000000 0000000000000001
head: ffff8880557dddc0 00000000000f000c 00000000f5000000 0000000000000000
head: 00fff00000000002 ffffea000155f701 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 6059, tgid 6057 (syz.4.24), ts 100734439876, free_ts 100726235723
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:2492 [inline]
allocate_slab+0x8a/0x370 mm/slub.c:2660
new_slab mm/slub.c:2714 [inline]
___slab_alloc+0xbeb/0x1420 mm/slub.c:3901
__slab_alloc mm/slub.c:3992 [inline]
__slab_alloc_node mm/slub.c:4067 [inline]
slab_alloc_node mm/slub.c:4228 [inline]
kmem_cache_alloc_noprof+0x283/0x3c0 mm/slub.c:4247
xfrm_state_alloc+0x24/0x2f0 net/xfrm/xfrm_state.c:733
pfkey_msg2xfrm_state net/key/af_key.c:1122 [inline]
pfkey_add+0x6e4/0x2e00 net/key/af_key.c:1504
pfkey_process net/key/af_key.c:2848 [inline]
pfkey_sendmsg+0xbfe/0x1090 net/key/af_key.c:3699
sock_sendmsg_nosec net/socket.c:714 [inline]
__sock_sendmsg+0x21c/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
page last free pid 6059 tgid 6057 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
kasan_save_stack mm/kasan/common.c:48 [inline]
kasan_save_track+0x4f/0x80 mm/kasan/common.c:68
unpoison_slab_object mm/kasan/common.c:330 [inline]
__kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:356
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4191 [inline]
slab_alloc_node mm/slub.c:4240 [inline]
kmem_cache_alloc_noprof+0x1c1/0x3c0 mm/slub.c:4247
skb_clone+0x212/0x3a0 net/core/skbuff.c:2049
dev_queue_xmit_nit+0x416/0xcc0 net/core/dev.c:2554
xmit_one net/core/dev.c:3835 [inline]
dev_hard_start_xmit+0x1be/0x830 net/core/dev.c:3855
__dev_queue_xmit+0x1b8d/0x3b50 net/core/dev.c:4725
dev_queue_xmit include/linux/netdevice.h:3361 [inline]
__netlink_deliver_tap_skb net/netlink/af_netlink.c:307 [inline]
__netlink_deliver_tap+0x5ad/0x850 net/netlink/af_netlink.c:325
netlink_deliver_tap+0x19c/0x1b0 net/netlink/af_netlink.c:338
__netlink_sendskb net/netlink/af_netlink.c:1262 [inline]
netlink_sendskb+0x68/0x140 net/netlink/af_netlink.c:1271
netlink_unicast+0x397/0x9e0 net/netlink/af_netlink.c:1361
netlink_rcv_skb+0x28c/0x470 net/netlink/af_netlink.c:2558
netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
netlink_unicast+0x82c/0x9e0 net/netlink/af_netlink.c:1346
netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1896
Memory state around the buggy address:
ffff8880557dc200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880557dc280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880557dc300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880557dc380: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880557dc400: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
==================================================================
----------------
Code disassembly (best guess):
0: de 1b ficomps (%rbx)
2: 00 00 add %al,(%rax)
4: 41 8b 06 mov (%r14),%eax
7: 85 c0 test %eax,%eax
9: 0f 84 32 02 00 00 je 0x241
f: 89 84 24 84 00 00 00 mov %eax,0x84(%rsp)
16: 4c 89 bc 24 90 00 00 mov %r15,0x90(%rsp)
1d: 00
1e: e8 f2 57 34 00 call 0x345815
23: 4c 8d 3d 00 00 00 00 lea 0x0(%rip),%r15 # 0x2a
* 2a: 48 c7 c7 20 9f 13 8e mov $0xffffffff8e139f20,%rdi <-- trapping instruction
31: 31 f6 xor %esi,%esi
33: 31 d2 xor %edx,%edx
35: b9 02 00 00 00 mov $0x2,%ecx
3a: 45 31 c0 xor %r8d,%r8d
3d: 45 31 c9 xor %r9d,%r9d