==================================================================
BUG: KASAN: slab-use-after-free in __lock_acquire+0x41b9/0x5f30 kernel/locking/lockdep.c:4956
Read of size 8 at addr ffff8880176727c0 by task udevd/5063
CPU: 1 PID: 5063 Comm: udevd Not tainted 6.4.0-rc2-next-20230515-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351
print_report mm/kasan/report.c:462 [inline]
kasan_report+0x11c/0x130 mm/kasan/report.c:571
__lock_acquire+0x41b9/0x5f30 kernel/locking/lockdep.c:4956
lock_acquire.part.0+0x11c/0x370 kernel/locking/lockdep.c:5705
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162
try_to_wake_up+0xab/0x1a50 kernel/sched/core.c:4191
call_timer_fn+0x1a0/0x580 kernel/time/timer.c:1700
expire_timers+0x234/0x330 kernel/time/timer.c:1751
__run_timers kernel/time/timer.c:2022 [inline]
__run_timers kernel/time/timer.c:1995 [inline]
run_timer_softirq+0x326/0x910 kernel/time/timer.c:2035
__do_softirq+0x1d4/0x905 kernel/softirq.c:553
invoke_softirq kernel/softirq.c:427 [inline]
__irq_exit_rcu kernel/softirq.c:632 [inline]
irq_exit_rcu+0xb7/0x120 kernel/softirq.c:644
sysvec_apic_timer_interrupt+0x97/0xc0 arch/x86/kernel/apic/apic.c:1106
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645
RIP: 0010:__sanitizer_cov_trace_pc+0x0/0x70 kernel/kcov.c:200
Code: 26 b9 8e 02 66 0f 1f 44 00 00 f3 0f 1e fa 48 8b be a8 01 00 00 e8 b0 ff ff ff 31 c0 c3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 0f 1e fa 65 8b 05 0d 98 7f 7e 89 c1 48 8b 34 24 81 e1 00 01 00
RSP: 0018:ffffc90003d7fa10 EFLAGS: 00000293
RAX: 0000000000000000 RBX: 0000000000000200 RCX: 0000000000000000
RDX: ffff888023509dc0 RSI: ffffffff81f529a1 RDI: 0000000000000007
RBP: ffffc90003d7fb20 R08: 0000000000000007 R09: 0000000000000000
R10: 0000000000000200 R11: 0000000000094001 R12: 0000000000000000
R13: ffff88807a5ac790 R14: dffffc0000000000 R15: dffffc0000000000
__seqprop_spinlock_sequence include/linux/seqlock.h:275 [inline]
read_seqbegin include/linux/seqlock.h:836 [inline]
read_seqbegin_or_lock include/linux/seqlock.h:1140 [inline]
prepend_path+0x1d7/0xf20 fs/d_path.c:165
d_absolute_path+0xf3/0x1a0 fs/d_path.c:233
tomoyo_get_absolute_path security/tomoyo/realpath.c:101 [inline]
tomoyo_realpath_from_path+0x269/0x600 security/tomoyo/realpath.c:271
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_number_perm+0x21a/0x570 security/tomoyo/file.c:723
security_file_ioctl+0x54/0xb0 security/security.c:2608
__do_sys_ioctl fs/ioctl.c:864 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__x64_sys_ioctl+0xb7/0x210 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f8c85179d49
Code: 5c c3 48 8d 44 24 08 48 89 54 24 e0 48 89 44 24 c0 48 8d 44 24 d0 48 89 44 24 c8 b8 10 00 00 00 c7 44 24 b8 10 00 00 00 0f 05 <41> 89 c0 3d 00 f0 ff ff 76 10 48 8b 15 ae 60 0d 00 f7 d8 41 83 c8
RSP: 002b:00007fff0027b848 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007f8c85179d49
RDX: 0000000000000000 RSI: 0000000000005331 RDI: 0000000000000009
RBP: 00005619b65673e0 R08: 0000000000000000 R09: 838a76f204d714ce
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000009
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000001
Allocated by task 2:
kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
__kasan_slab_alloc+0x7f/0x90 mm/kasan/common.c:328
kasan_slab_alloc include/linux/kasan.h:186 [inline]
slab_post_alloc_hook mm/slab.h:711 [inline]
slab_alloc_node mm/slub.c:3451 [inline]
kmem_cache_alloc_node+0x185/0x3e0 mm/slub.c:3496
alloc_task_struct_node kernel/fork.c:173 [inline]
dup_task_struct kernel/fork.c:1104 [inline]
copy_process+0x3c0/0x7600 kernel/fork.c:2329
kernel_clone+0xeb/0x890 kernel/fork.c:2914
kernel_thread+0xc0/0x100 kernel/fork.c:2976
create_kthread kernel/kthread.c:402 [inline]
kthreadd+0x50c/0x790 kernel/kthread.c:737
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
Freed by task 5986:
kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:521
____kasan_slab_free mm/kasan/common.c:236 [inline]
____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200
kasan_slab_free include/linux/kasan.h:162 [inline]
slab_free_hook mm/slub.c:1781 [inline]
slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807
slab_free mm/slub.c:3786 [inline]
kmem_cache_free+0xe9/0x480 mm/slub.c:3808
put_task_struct include/linux/sched/task.h:126 [inline]
delayed_put_task_struct+0x1f5/0x280 kernel/exit.c:226
rcu_do_batch kernel/rcu/tree.c:2135 [inline]
rcu_core+0x802/0x1bc0 kernel/rcu/tree.c:2399
__do_softirq+0x1d4/0x905 kernel/softirq.c:553
Last potentially related work creation:
kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
__kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:491
__call_rcu_common.constprop.0+0x99/0x790 kernel/rcu/tree.c:2649
put_task_struct_rcu_user+0x87/0xc0 kernel/exit.c:232
context_switch kernel/sched/core.c:5346 [inline]
__schedule+0x1d1d/0x5790 kernel/sched/core.c:6669
preempt_schedule_common+0x45/0xb0 kernel/sched/core.c:6838
preempt_schedule_thunk+0x1a/0x20 arch/x86/entry/thunk_64.S:34
__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:160 [inline]
_raw_spin_unlock_irq+0x40/0x50 kernel/locking/spinlock.c:202
wq_worker_sleeping+0x1f2/0x260 kernel/workqueue.c:934
sched_submit_work kernel/sched/core.c:6709 [inline]
schedule+0x14b/0x1a0 kernel/sched/core.c:6742
nilfs_segctor_sync+0x2b5/0x300 fs/nilfs2/segment.c:2216
nilfs_construct_segment fs/nilfs2/segment.c:2276 [inline]
nilfs_transaction_commit+0x591/0x9a0 fs/nilfs2/segment.c:285
nilfs_evict_inode+0x3a3/0x530 fs/nilfs2/inode.c:963
evict+0x2ed/0x6b0 fs/inode.c:665
iput_final fs/inode.c:1747 [inline]
iput fs/inode.c:1773 [inline]
iput+0x4a7/0x7a0 fs/inode.c:1759
nilfs_dispose_list+0x497/0x6e0 fs/nilfs2/segment.c:816
process_one_work+0x99a/0x15e0 kernel/workqueue.c:2407
worker_thread+0x67d/0x10c0 kernel/workqueue.c:2554
kthread+0x344/0x440 kernel/kthread.c:379
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
Second to last potentially related work creation:
kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
__kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:491
__call_rcu_common.constprop.0+0x99/0x790 kernel/rcu/tree.c:2649
put_task_struct_rcu_user+0x87/0xc0 kernel/exit.c:232
release_task+0xcc8/0x1870 kernel/exit.c:282
wait_task_zombie kernel/exit.c:1207 [inline]
wait_consider_task+0x306d/0x3ce0 kernel/exit.c:1434
do_wait_thread kernel/exit.c:1497 [inline]
do_wait+0x799/0xc30 kernel/exit.c:1614
kernel_wait4+0x150/0x260 kernel/exit.c:1777
__do_sys_wait4+0x13f/0x150 kernel/exit.c:1805
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
The buggy address belongs to the object at ffff888017671dc0
which belongs to the cache task_struct of size 7360
The buggy address is located 2560 bytes inside of
freed 7360-byte region [ffff888017671dc0, ffff888017673a80)
The buggy address belongs to the physical page:
page:ffffea00005d9c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x17670
head:ffffea00005d9c00 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 ffff888014279500 ffffea0000b32a00 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 2, tgid 2 (kthreadd), ts 2154235121, free_ts 0
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1731
prep_new_page mm/page_alloc.c:1738 [inline]
get_page_from_freelist+0xf67/0x2a80 mm/page_alloc.c:3539
__alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4805
alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279
alloc_slab_page mm/slub.c:1851 [inline]
allocate_slab+0x28e/0x380 mm/slub.c:1998
new_slab mm/slub.c:2051 [inline]
___slab_alloc+0xa91/0x1400 mm/slub.c:3192
__slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3291
__slab_alloc_node mm/slub.c:3344 [inline]
slab_alloc_node mm/slub.c:3441 [inline]
kmem_cache_alloc_node+0x138/0x3e0 mm/slub.c:3496
alloc_task_struct_node kernel/fork.c:173 [inline]
dup_task_struct kernel/fork.c:1104 [inline]
copy_process+0x3c0/0x7600 kernel/fork.c:2329
kernel_clone+0xeb/0x890 kernel/fork.c:2914
kernel_thread+0xc0/0x100 kernel/fork.c:2976
create_kthread kernel/kthread.c:402 [inline]
kthreadd+0x50c/0x790 kernel/kthread.c:737
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
page_owner free stack trace missing
Memory state around the buggy address:
ffff888017672680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888017672700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888017672780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888017672800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888017672880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess), 2 bytes skipped:
0: 8e 02 mov (%rdx),%es
2: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)
8: f3 0f 1e fa endbr64
c: 48 8b be a8 01 00 00 mov 0x1a8(%rsi),%rdi
13: e8 b0 ff ff ff callq 0xffffffc8
18: 31 c0 xor %eax,%eax
1a: c3 retq
1b: 66 66 2e 0f 1f 84 00 data16 nopw %cs:0x0(%rax,%rax,1)
22: 00 00 00 00
26: 66 90 xchg %ax,%ax
* 28: f3 0f 1e fa endbr64 <-- trapping instruction
2c: 65 8b 05 0d 98 7f 7e mov %gs:0x7e7f980d(%rip),%eax # 0x7e7f9840
33: 89 c1 mov %eax,%ecx
35: 48 8b 34 24 mov (%rsp),%rsi
39: 81 .byte 0x81
3a: e1 00 loope 0x3c
3c: 01 00 add %eax,(%rax)