==================================================================
BUG: KASAN: slab-use-after-free in __hlist_del include/linux/list.h:982 [inline]
BUG: KASAN: slab-use-after-free in hlist_del_rcu include/linux/rculist.h:560 [inline]
BUG: KASAN: slab-use-after-free in __xfrm_state_delete+0x9e5/0xa30 net/xfrm/xfrm_state.c:830
Write of size 8 at addr ffff88806e718470 by task swapper/2/0
CPU: 2 UID: 0 PID: 0 Comm: swapper/2 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0xcd/0x630 mm/kasan/report.c:482
kasan_report+0xe0/0x110 mm/kasan/report.c:595
__hlist_del include/linux/list.h:982 [inline]
hlist_del_rcu include/linux/rculist.h:560 [inline]
__xfrm_state_delete+0x9e5/0xa30 net/xfrm/xfrm_state.c:830
xfrm_timer_handler+0x86c/0xf10 net/xfrm/xfrm_state.c:716
__run_hrtimer kernel/time/hrtimer.c:1761 [inline]
__hrtimer_run_queues+0x202/0xad0 kernel/time/hrtimer.c:1825
hrtimer_run_softirq+0x17d/0x350 kernel/time/hrtimer.c:1842
handle_softirqs+0x216/0x8e0 kernel/softirq.c:579
__do_softirq kernel/softirq.c:613 [inline]
invoke_softirq kernel/softirq.c:453 [inline]
__irq_exit_rcu+0x109/0x170 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+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1050
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:82
Code: 2d 64 02 e9 13 0a 03 00 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa eb 07 0f 00 2d 53 65 18 00 fb f4 cc cc cc cc 66 2e 0f 1f 84 00 00 00 00 00 66 90 90 90 90 90 90
RSP: 0018:ffffc9000047fdf8 EFLAGS: 00000286
RAX: 00000000000f1369 RBX: 0000000000000002 RCX: ffffffff8b91ab29
RDX: 0000000000000000 RSI: ffffffff8de4f58a RDI: ffffffff8c163800
RBP: ffffed1003bdf910 R08: 0000000000000001 R09: ffffed1005686655
R10: ffff88802b4332ab R11: 0000000000000000 R12: 0000000000000002
R13: ffff88801defc880 R14: ffffffff90abac90 R15: 0000000000000000
arch_safe_halt arch/x86/include/asm/paravirt.h:107 [inline]
default_idle+0x13/0x20 arch/x86/kernel/process.c:757
default_idle_call+0x6d/0xb0 kernel/sched/idle.c:122
cpuidle_idle_call kernel/sched/idle.c:190 [inline]
do_idle+0x391/0x510 kernel/sched/idle.c:330
cpu_startup_entry+0x4f/0x60 kernel/sched/idle.c:428
start_secondary+0x21d/0x2b0 arch/x86/kernel/smpboot.c:315
common_startup_64+0x13e/0x148
Allocated by task 6822:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
unpoison_slab_object mm/kasan/common.c:330 [inline]
__kasan_slab_alloc+0x89/0x90 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+0x1cb/0x3b0 mm/slub.c:4247
xfrm_state_alloc+0x23/0x5c0 net/xfrm/xfrm_state.c:733
__find_acq_core+0xb59/0x2900 net/xfrm/xfrm_state.c:1833
xfrm_find_acq+0x7b/0xa0 net/xfrm/xfrm_state.c:2353
xfrm_alloc_userspi+0x58e/0xbb0 net/xfrm/xfrm_user.c:1863
xfrm_user_rcv_msg+0x4fb/0xb60 net/xfrm/xfrm_user.c:3501
netlink_rcv_skb+0x155/0x420 net/netlink/af_netlink.c:2552
xfrm_netlink_rcv+0x71/0x90 net/xfrm/xfrm_user.c:3523
netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
netlink_unicast+0x5aa/0x870 net/netlink/af_netlink.c:1346
netlink_sendmsg+0x8d1/0xdd0 net/netlink/af_netlink.c:1896
sock_sendmsg_nosec net/socket.c:714 [inline]
__sock_sendmsg net/socket.c:729 [inline]
____sys_sendmsg+0xa95/0xc70 net/socket.c:2614
___sys_sendmsg+0x134/0x1d0 net/socket.c:2668
__sys_sendmsg+0x16d/0x220 net/socket.c:2700
do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline]
__do_fast_syscall_32+0x7c/0x300 arch/x86/entry/syscall_32.c:306
do_fast_syscall_32+0x32/0x80 arch/x86/entry/syscall_32.c:331
entry_SYSENTER_compat_after_hwframe+0x84/0x8e
Freed by task 10:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:576
poison_slab_object mm/kasan/common.c:243 [inline]
__kasan_slab_free+0x60/0x70 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+0x2d1/0x4d0 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+0x50a/0x770 net/xfrm/xfrm_state.c:634
process_one_work+0x9cf/0x1b70 kernel/workqueue.c:3236
process_scheduled_works kernel/workqueue.c:3319 [inline]
worker_thread+0x6c8/0xf10 kernel/workqueue.c:3400
kthread+0x3c5/0x780 kernel/kthread.c:463
ret_from_fork+0x56d/0x730 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 ffff88806e718440
which belongs to the cache xfrm_state of size 928
The buggy address is located 48 bytes inside of
freed 928-byte region [ffff88806e718440, ffff88806e7187e0)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88806e719100 pfn:0x6e718
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 04fff00000000040 ffff888040f09040 dead000000000122 0000000000000000
raw: ffff88806e719100 00000000801e0019 00000000f5000000 0000000000000000
head: 04fff00000000040 ffff888040f09040 dead000000000122 0000000000000000
head: ffff88806e719100 00000000801e0019 00000000f5000000 0000000000000000
head: 04fff00000000003 ffffea0001b9c601 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 6776, tgid 6775 (syz.3.309), ts 60230555359, free_ts 59841563079
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1851
prep_new_page mm/page_alloc.c:1859 [inline]
get_page_from_freelist+0x132b/0x38e0 mm/page_alloc.c:3858
__alloc_frozen_pages_noprof+0x261/0x23f0 mm/page_alloc.c:5148
alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2416
alloc_slab_page mm/slub.c:2492 [inline]
allocate_slab mm/slub.c:2660 [inline]
new_slab+0x247/0x330 mm/slub.c:2714
___slab_alloc+0xcf2/0x1750 mm/slub.c:3901
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3992
__slab_alloc_node mm/slub.c:4067 [inline]
slab_alloc_node mm/slub.c:4228 [inline]
kmem_cache_alloc_noprof+0xef/0x3b0 mm/slub.c:4247
xfrm_state_alloc+0x23/0x5c0 net/xfrm/xfrm_state.c:733
__find_acq_core+0xb59/0x2900 net/xfrm/xfrm_state.c:1833
xfrm_find_acq+0x7b/0xa0 net/xfrm/xfrm_state.c:2353
xfrm_alloc_userspi+0x58e/0xbb0 net/xfrm/xfrm_user.c:1863
xfrm_user_rcv_msg+0x4fb/0xb60 net/xfrm/xfrm_user.c:3501
netlink_rcv_skb+0x155/0x420 net/netlink/af_netlink.c:2552
xfrm_netlink_rcv+0x71/0x90 net/xfrm/xfrm_user.c:3523
netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
netlink_unicast+0x5aa/0x870 net/netlink/af_netlink.c:1346
page last free pid 5971 tgid 5971 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1395 [inline]
__free_frozen_pages+0x7d5/0x10f0 mm/page_alloc.c:2895
discard_slab mm/slub.c:2758 [inline]
__put_partials+0x165/0x1c0 mm/slub.c:3223
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x4d/0x120 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x195/0x1e0 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:340
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]
__kmalloc_cache_noprof+0x1f1/0x3e0 mm/slub.c:4402
kmalloc_noprof include/linux/slab.h:905 [inline]
kzalloc_noprof include/linux/slab.h:1039 [inline]
kernfs_fop_open+0x244/0xda0 fs/kernfs/file.c:641
do_dentry_open+0x97f/0x1530 fs/open.c:965
vfs_open+0x82/0x3f0 fs/open.c:1095
do_open fs/namei.c:3887 [inline]
path_openat+0x1de4/0x2cb0 fs/namei.c:4046
do_filp_open+0x20b/0x470 fs/namei.c:4073
do_sys_openat2+0x11b/0x1d0 fs/open.c:1435
do_sys_open fs/open.c:1450 [inline]
__do_sys_openat fs/open.c:1466 [inline]
__se_sys_openat fs/open.c:1461 [inline]
__x64_sys_openat+0x174/0x210 fs/open.c:1461
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff88806e718300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88806e718380: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88806e718400: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
^
ffff88806e718480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88806e718500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess), 1 bytes skipped:
0: 64 02 e9 fs add %cl,%ch
3: 13 0a adc (%rdx),%ecx
5: 03 00 add (%rax),%eax
7: 0f 1f 00 nopl (%rax)
a: 90 nop
b: 90 nop
c: 90 nop
d: 90 nop
e: 90 nop
f: 90 nop
10: 90 nop
11: 90 nop
12: 90 nop
13: 90 nop
14: 90 nop
15: 90 nop
16: 90 nop
17: 90 nop
18: 90 nop
19: 90 nop
1a: f3 0f 1e fa endbr64
1e: eb 07 jmp 0x27
20: 0f 00 2d 53 65 18 00 verw 0x186553(%rip) # 0x18657a
27: fb sti
28: f4 hlt
* 29: c3 ret <-- trapping instruction
2a: cc int3
2b: cc int3
2c: cc int3
2d: cc int3
2e: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1)
35: 00 00 00
38: 66 90 xchg %ax,%ax
3a: 90 nop
3b: 90 nop
3c: 90 nop
3d: 90 nop
3e: 90 nop