==================================================================
BUG: KASAN: slab-use-after-free in __lock_acquire+0x41b9/0x5f30 kernel/locking/lockdep.c:4956
Read of size 8 at addr ffff88802359c580 by task syz-executor246/6718
CPU: 1 PID: 6718 Comm: syz-executor246 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:wait_on_buffer include/linux/buffer_head.h:397 [inline]
RIP: 0010:__nilfs_get_page_block fs/nilfs2/page.c:43 [inline]
RIP: 0010:nilfs_grab_buffer+0x2e8/0x690 fs/nilfs2/page.c:61
Code: 00 00 00 4c 89 e7 e8 87 10 aa fe 4c 89 e2 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 3f 03 00 00 49 8b 1c 24 <31> ff 48 c1 eb 02 83 e3 01 89 de e8 b8 05 57 fe 84 db 75 64 e8 cf
RSP: 0018:ffffc90006cef6e8 EFLAGS: 00000246
RAX: dffffc0000000000 RBX: 00000000000a0013 RCX: ffffffff832d19a9
RDX: 1ffff1100e8e9e00 RSI: 0000000000000008 RDI: ffff88807474f000
RBP: 00000000ffffffff R08: 0000000000000000 R09: ffffed100e8e9e00
R10: ffff88807474f007 R11: 0000000000094001 R12: ffff88807474f000
R13: ffffea000058b200 R14: dffffc0000000000 R15: 000000000000000c
nilfs_btnode_submit_block+0xa7/0x900 fs/nilfs2/btnode.c:81
__nilfs_btree_get_block+0x10a/0x6a0 fs/nilfs2/btree.c:480
nilfs_btree_get_block fs/nilfs2/btree.c:543 [inline]
nilfs_btree_do_lookup_last fs/nilfs2/btree.c:628 [inline]
nilfs_btree_last_key+0x2ff/0x6f0 fs/nilfs2/btree.c:1640
nilfs_bmap_do_truncate fs/nilfs2/bmap.c:275 [inline]
nilfs_bmap_truncate+0x159/0x300 fs/nilfs2/bmap.c:305
nilfs_truncate_bmap+0x14a/0x360 fs/nilfs2/inode.c:846
nilfs_evict_inode+0x1f9/0x530 fs/nilfs2/inode.c:951
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
dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:401
__dentry_kill+0x3c0/0x640 fs/dcache.c:607
dentry_kill fs/dcache.c:745 [inline]
dput+0x6ac/0xe10 fs/dcache.c:913
__fput+0x3cc/0xa90 fs/file_table.c:329
task_work_run+0x16f/0x270 kernel/task_work.c:179
exit_task_work include/linux/task_work.h:38 [inline]
do_exit+0xb0d/0x29f0 kernel/exit.c:871
do_group_exit+0xd4/0x2a0 kernel/exit.c:1021
__do_sys_exit_group kernel/exit.c:1032 [inline]
__se_sys_exit_group kernel/exit.c:1030 [inline]
__x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1030
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:0x7f6b56208579
Code: Unable to access opcode bytes at 0x7f6b5620854f.
RSP: 002b:00007ffc1c2cc9d8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007f6b5627f3f0 RCX: 00007f6b56208579
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffffffffffc0 R09: 00007ffc1c2cca50
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f6b5627f3f0
R13: 0000000000000001 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
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
schedule+0xde/0x1a0 kernel/sched/core.c:6745
nilfs_segctor_kill_thread fs/nilfs2/segment.c:2667 [inline]
nilfs_segctor_destroy fs/nilfs2/segment.c:2749 [inline]
nilfs_detach_log_writer+0x2cb/0xa10 fs/nilfs2/segment.c:2838
nilfs_put_super+0x43/0x1b0 fs/nilfs2/super.c:477
generic_shutdown_super+0x158/0x480 fs/super.c:500
kill_block_super+0xa1/0x100 fs/super.c:1407
deactivate_locked_super+0x98/0x160 fs/super.c:331
deactivate_super+0xb1/0xd0 fs/super.c:362
cleanup_mnt+0x2ae/0x3d0 fs/namespace.c:1177
task_work_run+0x16f/0x270 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204
__syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297
do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd
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
context_switch kernel/sched/core.c:5346 [inline]
__schedule+0x1d1d/0x5790 kernel/sched/core.c:6669
schedule+0xde/0x1a0 kernel/sched/core.c:6745
nilfs_segctor_kill_thread fs/nilfs2/segment.c:2667 [inline]
nilfs_segctor_destroy fs/nilfs2/segment.c:2749 [inline]
nilfs_detach_log_writer+0x2cb/0xa10 fs/nilfs2/segment.c:2838
nilfs_put_super+0x43/0x1b0 fs/nilfs2/super.c:477
generic_shutdown_super+0x158/0x480 fs/super.c:500
kill_block_super+0xa1/0x100 fs/super.c:1407
deactivate_locked_super+0x98/0x160 fs/super.c:331
deactivate_super+0xb1/0xd0 fs/super.c:362
cleanup_mnt+0x2ae/0x3d0 fs/namespace.c:1177
task_work_run+0x16f/0x270 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204
__syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297
do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd
The buggy address belongs to the object at ffff88802359bb80
which belongs to the cache task_struct of size 7360
The buggy address is located 2560 bytes inside of
freed 7360-byte region [ffff88802359bb80, ffff88802359d840)
The buggy address belongs to the physical page:
page:ffffea00008d6600 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88802359bb80 pfn:0x23598
head:ffffea00008d6600 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
ksm flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000010200 ffff888014279500 ffffea00009d1800 dead000000000003
raw: ffff88802359bb80 0000000080040003 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 4815, tgid 4815 (dhcpcd-run-hook), ts 51856713439, free_ts 51819782257
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
__do_sys_clone+0xba/0x100 kernel/fork.c:3057
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
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1302 [inline]
free_unref_page_prepare+0x4dd/0xb90 mm/page_alloc.c:2600
free_unref_page+0x33/0x370 mm/page_alloc.c:2695
__unfreeze_partials+0x17c/0x1a0 mm/slub.c:2636
qlink_free mm/kasan/quarantine.c:166 [inline]
qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185
kasan_quarantine_reduce+0x195/0x220 mm/kasan/quarantine.c:292
__kasan_slab_alloc+0x63/0x90 mm/kasan/common.c:305
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]
slab_alloc mm/slub.c:3459 [inline]
__kmem_cache_alloc_lru mm/slub.c:3466 [inline]
kmem_cache_alloc+0x17c/0x3b0 mm/slub.c:3475
getname_flags.part.0+0x50/0x4f0 fs/namei.c:140
getname_flags include/linux/audit.h:321 [inline]
getname+0x92/0xd0 fs/namei.c:219
do_sys_openat2+0xf5/0x4c0 fs/open.c:1350
do_sys_open fs/open.c:1372 [inline]
__do_sys_openat fs/open.c:1388 [inline]
__se_sys_openat fs/open.c:1383 [inline]
__x64_sys_openat+0x143/0x1f0 fs/open.c:1383
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
Memory state around the buggy address:
ffff88802359c480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88802359c500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88802359c580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88802359c600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88802359c680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 00 00 add %al,(%rax)
2: 00 4c 89 e7 add %cl,-0x19(%rcx,%rcx,4)
6: e8 87 10 aa fe callq 0xfeaa1092
b: 4c 89 e2 mov %r12,%rdx
e: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
15: fc ff df
18: 48 c1 ea 03 shr $0x3,%rdx
1c: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1)
20: 0f 85 3f 03 00 00 jne 0x365
26: 49 8b 1c 24 mov (%r12),%rbx
* 2a: 31 ff xor %edi,%edi <-- trapping instruction
2c: 48 c1 eb 02 shr $0x2,%rbx
30: 83 e3 01 and $0x1,%ebx
33: 89 de mov %ebx,%esi
35: e8 b8 05 57 fe callq 0xfe5705f2
3a: 84 db test %bl,%bl
3c: 75 64 jne 0xa2
3e: e8 .byte 0xe8
3f: cf iret