==================================================================
BUG: KASAN: slab-use-after-free in __lock_acquire+0x11c/0x7f70 kernel/locking/lockdep.c:5012
Read of size 8 at addr ffff88807e56e340 by task udevd/5076
CPU: 0 PID: 5076 Comm: udevd Not tainted 6.5.0-rc5-syzkaller-00056-gcacc6e22932f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:364 [inline]
print_report+0x163/0x540 mm/kasan/report.c:475
kasan_report+0x175/0x1b0 mm/kasan/report.c:588
__lock_acquire+0x11c/0x7f70 kernel/locking/lockdep.c:5012
lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5761
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162
try_to_wake_up+0xb2/0x1160 kernel/sched/core.c:4229
call_timer_fn+0x178/0x580 kernel/time/timer.c:1700
expire_timers kernel/time/timer.c:1751 [inline]
__run_timers+0x64f/0x860 kernel/time/timer.c:2022
run_timer_softirq+0x67/0xf0 kernel/time/timer.c:2035
__do_softirq+0x2ab/0x908 kernel/softirq.c:553
invoke_softirq kernel/softirq.c:427 [inline]
__irq_exit_rcu+0xf1/0x1b0 kernel/softirq.c:632
irq_exit_rcu+0x9/0x20 kernel/softirq.c:644
sysvec_apic_timer_interrupt+0x95/0xb0 arch/x86/kernel/apic/apic.c:1109
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645
RIP: 0010:orc_ip arch/x86/kernel/unwind_orc.c:80 [inline]
RIP: 0010:__orc_find arch/x86/kernel/unwind_orc.c:102 [inline]
RIP: 0010:orc_find arch/x86/kernel/unwind_orc.c:227 [inline]
RIP: 0010:unwind_next_frame+0x480/0x2390 arch/x86/kernel/unwind_orc.c:494
Code: c1 48 c1 f9 02 48 c1 e8 3f 48 01 c8 48 83 e0 fe 49 8d 5c 45 00 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df 0f b6 04 08 <84> c0 75 27 48 63 03 48 01 d8 48 8d 4b 04 4c 39 f8 4c 0f 46 e9 48
RSP: 0018:ffffc90003d4f610 EFLAGS: 00000a02
RAX: 0000000000000000 RBX: ffffffff8eaa4368 RCX: dffffc0000000000
RDX: ffffffff8f18d258 RSI: 00000000000a0001 RDI: ffffffff813c8bc0
RBP: ffffffff8eaa4380 R08: 000000000000000c R09: ffffc90003d4f7d0
R10: ffffc90003d4f730 R11: fffff520007a9ee8 R12: ffffffff8eaa4354
R13: ffffffff8eaa4354 R14: ffffffff8eaa4354 R15: ffffffff8179ac36
arch_stack_walk+0x111/0x140 arch/x86/kernel/stacktrace.c:25
stack_trace_save+0x117/0x1c0 kernel/stacktrace.c:122
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:383
kmalloc include/linux/slab.h:582 [inline]
kzalloc include/linux/slab.h:703 [inline]
uevent_show+0x15d/0x310 drivers/base/core.c:2641
dev_attr_show+0x54/0xc0 drivers/base/core.c:2349
sysfs_kf_seq_show+0x331/0x4b0 fs/sysfs/file.c:59
seq_read_iter+0x43e/0xd10 fs/seq_file.c:230
call_read_iter include/linux/fs.h:1871 [inline]
new_sync_read fs/read_write.c:389 [inline]
vfs_read+0x795/0xb00 fs/read_write.c:470
ksys_read+0x1a0/0x2c0 fs/read_write.c:613
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f5376d16b6a
Code: 00 3d 00 00 41 00 75 0d 50 48 8d 3d 2d 08 0a 00 e8 ea 7d 01 00 31 c0 e9 07 ff ff ff 64 8b 04 25 18 00 00 00 85 c0 75 1b 0f 05 <48> 3d 00 f0 ff ff 76 6c 48 8b 15 8f a2 0d 00 f7 d8 64 89 02 48 83
RSP: 002b:00007ffd11c12058 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 0000561005c2d0f0 RCX: 00007f5376d16b6a
RDX: 0000000000001000 RSI: 0000561005c27930 RDI: 000000000000000b
RBP: 0000561005c2d0f0 R08: 000000000000000b R09: 0000000000000020
R10: 000000000000010f R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000003fff R14: 00007ffd11c12538 R15: 000000000000000a
Allocated by task 2:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
__kasan_slab_alloc+0x66/0x70 mm/kasan/common.c:328
kasan_slab_alloc include/linux/kasan.h:186 [inline]
slab_post_alloc_hook+0x6c/0x3b0 mm/slab.h:762
slab_alloc_node mm/slub.c:3470 [inline]
kmem_cache_alloc_node+0x149/0x330 mm/slub.c:3515
alloc_task_struct_node kernel/fork.c:173 [inline]
dup_task_struct+0x57/0x7d0 kernel/fork.c:1105
copy_process+0x5c8/0x4290 kernel/fork.c:2330
kernel_clone+0x222/0x800 kernel/fork.c:2912
kernel_thread+0x1bc/0x230 kernel/fork.c:2974
create_kthread kernel/kthread.c:412 [inline]
kthreadd+0x600/0x820 kernel/kthread.c:747
ret_from_fork+0x2e/0x60 arch/x86/kernel/process.c:145
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304
Freed by task 4470:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522
____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
kasan_slab_free include/linux/kasan.h:162 [inline]
slab_free_hook mm/slub.c:1792 [inline]
slab_free_freelist_hook mm/slub.c:1818 [inline]
slab_free mm/slub.c:3801 [inline]
kmem_cache_free+0x292/0x500 mm/slub.c:3823
rcu_do_batch kernel/rcu/tree.c:2135 [inline]
rcu_core+0xaaa/0x1740 kernel/rcu/tree.c:2399
__do_softirq+0x2ab/0x908 kernel/softirq.c:553
Last potentially related work creation:
kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xad/0xc0 mm/kasan/generic.c:492
__call_rcu_common kernel/rcu/tree.c:2649 [inline]
call_rcu+0x167/0xa70 kernel/rcu/tree.c:2763
context_switch kernel/sched/core.c:5384 [inline]
__schedule+0x187b/0x48f0 kernel/sched/core.c:6710
preempt_schedule_common+0x83/0xc0 kernel/sched/core.c:6879
preempt_schedule+0xdd/0xf0 kernel/sched/core.c:6903
preempt_schedule_thunk+0x1a/0x30 arch/x86/entry/thunk_64.S:45
unwind_next_frame+0x1a1f/0x2390 arch/x86/kernel/unwind_orc.c:672
arch_stack_walk+0x111/0x140 arch/x86/kernel/stacktrace.c:25
stack_trace_save+0x117/0x1c0 kernel/stacktrace.c:122
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
__kasan_slab_alloc+0x66/0x70 mm/kasan/common.c:328
kasan_slab_alloc include/linux/kasan.h:186 [inline]
slab_post_alloc_hook+0x6c/0x3b0 mm/slab.h:762
slab_alloc_node mm/slub.c:3470 [inline]
slab_alloc mm/slub.c:3478 [inline]
__kmem_cache_alloc_lru mm/slub.c:3485 [inline]
kmem_cache_alloc+0x123/0x300 mm/slub.c:3494
kmem_cache_zalloc include/linux/slab.h:693 [inline]
alloc_empty_file+0x9e/0x1d0 fs/file_table.c:206
path_openat+0xfa/0x3180 fs/namei.c:3779
do_filp_open+0x234/0x490 fs/namei.c:3820
do_sys_openat2+0x13e/0x1d0 fs/open.c:1407
do_sys_open fs/open.c:1422 [inline]
__do_sys_openat fs/open.c:1438 [inline]
__se_sys_openat fs/open.c:1433 [inline]
__x64_sys_openat+0x247/0x290 fs/open.c:1433
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Second to last potentially related work creation:
kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xad/0xc0 mm/kasan/generic.c:492
__call_rcu_common kernel/rcu/tree.c:2649 [inline]
call_rcu+0x167/0xa70 kernel/rcu/tree.c:2763
put_task_struct_rcu_user kernel/exit.c:232 [inline]
release_task+0x15ad/0x16f0 kernel/exit.c:282
wait_task_zombie kernel/exit.c:1210 [inline]
wait_consider_task+0x1a43/0x2e20 kernel/exit.c:1437
do_wait_thread kernel/exit.c:1500 [inline]
do_wait+0x312/0xb00 kernel/exit.c:1617
kernel_wait4+0x2a2/0x3e0 kernel/exit.c:1780
__do_sys_wait4 kernel/exit.c:1808 [inline]
__se_sys_wait4 kernel/exit.c:1804 [inline]
__x64_sys_wait4+0x134/0x1e0 kernel/exit.c:1804
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
The buggy address belongs to the object at ffff88807e56d940
which belongs to the cache task_struct of size 7360
The buggy address is located 2560 bytes inside of
freed 7360-byte region [ffff88807e56d940, ffff88807e56f600)
The buggy address belongs to the physical page:
page:ffffea0001f95a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7e568
head:ffffea0001f95a00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000010200 ffff888014674500 ffffea00009d5e00 dead000000000002
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (init), ts 24909211840, free_ts 22839638005
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1570
prep_new_page mm/page_alloc.c:1577 [inline]
get_page_from_freelist+0x31e8/0x3370 mm/page_alloc.c:3221
__alloc_pages+0x255/0x670 mm/page_alloc.c:4477
alloc_slab_page+0x6a/0x160 mm/slub.c:1862
allocate_slab mm/slub.c:2009 [inline]
new_slab+0x84/0x2f0 mm/slub.c:2062
___slab_alloc+0xade/0x1100 mm/slub.c:3215
__slab_alloc mm/slub.c:3314 [inline]
__slab_alloc_node mm/slub.c:3367 [inline]
slab_alloc_node mm/slub.c:3460 [inline]
kmem_cache_alloc_node+0x1e2/0x330 mm/slub.c:3515
alloc_task_struct_node kernel/fork.c:173 [inline]
dup_task_struct+0x57/0x7d0 kernel/fork.c:1105
copy_process+0x5c8/0x4290 kernel/fork.c:2330
kernel_clone+0x222/0x800 kernel/fork.c:2912
__do_sys_vfork+0xc3/0x120 kernel/fork.c:3017
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1161 [inline]
free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2348
free_unref_page+0x37/0x3f0 mm/page_alloc.c:2443
free_contig_range+0x9e/0x150 mm/page_alloc.c:6395
destroy_args+0x102/0x9a0 mm/debug_vm_pgtable.c:1029
debug_vm_pgtable+0x42a/0x4b0 mm/debug_vm_pgtable.c:1410
do_one_initcall+0x23d/0x7d0 init/main.c:1232
do_initcall_level+0x157/0x210 init/main.c:1294
do_initcalls+0x3f/0x80 init/main.c:1310
kernel_init_freeable+0x43b/0x5d0 init/main.c:1546
kernel_init+0x1d/0x2a0 init/main.c:1437
ret_from_fork+0x2e/0x60 arch/x86/kernel/process.c:145
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304
Memory state around the buggy address:
ffff88807e56e200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807e56e280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807e56e300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807e56e380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807e56e400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: c1 48 c1 f9 rorl $0xf9,-0x3f(%rax)
4: 02 48 c1 add -0x3f(%rax),%cl
7: e8 3f 48 01 c8 call 0xc801484b
c: 48 83 e0 fe and $0xfffffffffffffffe,%rax
10: 49 8d 5c 45 00 lea 0x0(%r13,%rax,2),%rbx
15: 48 89 d8 mov %rbx,%rax
18: 48 c1 e8 03 shr $0x3,%rax
1c: 48 b9 00 00 00 00 00 movabs $0xdffffc0000000000,%rcx
23: fc ff df
26: 0f b6 04 08 movzbl (%rax,%rcx,1),%eax
* 2a: 84 c0 test %al,%al <-- trapping instruction
2c: 75 27 jne 0x55
2e: 48 63 03 movslq (%rbx),%rax
31: 48 01 d8 add %rbx,%rax
34: 48 8d 4b 04 lea 0x4(%rbx),%rcx
38: 4c 39 f8 cmp %r15,%rax
3b: 4c 0f 46 e9 cmovbe %rcx,%r13
3f: 48 rex.W