================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x78/0x1fd0 kernel/locking/lockdep.c:5005 Read of size 8 at addr ffff88802fadc618 by task syz-executor130/5333 CPU: 0 PID: 5333 Comm: syz-executor130 Not tainted 6.9.0-rc7-next-20240508-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 __lock_acquire+0x78/0x1fd0 kernel/locking/lockdep.c:5005 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162 class_raw_spinlock_irqsave_constructor include/linux/spinlock.h:553 [inline] try_to_wake_up+0xb0/0x1470 kernel/sched/core.c:4262 call_timer_fn+0x18e/0x650 kernel/time/timer.c:1792 expire_timers kernel/time/timer.c:1843 [inline] __run_timers kernel/time/timer.c:2417 [inline] __run_timer_base+0x66a/0x8e0 kernel/time/timer.c:2428 run_timer_base kernel/time/timer.c:2437 [inline] run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2447 handle_softirqs+0x2d6/0x990 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637 irq_exit_rcu+0x9/0x30 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:shmem_write_begin+0x5/0x4d0 mm/shmem.c:2727 Code: ff e8 8f a3 bc ff e9 58 fa ff ff e8 85 a3 bc ff e9 c0 fe ff ff 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 55 <48> 89 e5 41 57 41 56 41 55 41 54 53 48 83 e4 e0 48 81 ec 80 00 00 RSP: 0018:ffffc90003c67af0 EFLAGS: 00000246 RAX: 1ffffffff17a838d RBX: 0000000000000000 RCX: 0000000000001000 RDX: 00000000001a5000 RSI: ffff88801517d8f8 RDI: ffff88802241fb80 RBP: ffffc90003c67c60 R08: ffffc90003c67bc0 R09: ffffc90003c67be0 R10: dffffc0000000000 R11: ffffffff81d97570 R12: ffffc90003c67d70 R13: dffffc0000000000 R14: 00000000001a5000 R15: 0000000000001000 generic_perform_write+0x322/0x640 mm/filemap.c:4016 shmem_file_write_iter+0xfc/0x120 mm/shmem.c:2919 new_sync_write fs/read_write.c:497 [inline] vfs_write+0xa72/0xc90 fs/read_write.c:590 ksys_write+0x1a0/0x2c0 fs/read_write.c:643 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7feba200f610 Code: 40 00 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 80 3d 91 5a 07 00 00 74 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 48 83 ec 28 48 89 RSP: 002b:00007ffd7d62fde8 EFLAGS: 00000202 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007ffd7d62fe00 RCX: 00007feba200f610 RDX: 0000000000200000 RSI: 00007feb99a00000 RDI: 0000000000000003 RBP: 00007feb99a00000 R08: 0000000000000f21 R09: 0000000000000f1d R10: 0000000020001e42 R11: 0000000000000202 R12: 00007ffd7d62ff9c R13: 00007ffd7d62fe40 R14: 0000000000000003 R15: 0000000000200000 Allocated by task 2: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:312 [inline] __kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:338 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3940 [inline] slab_alloc_node mm/slub.c:4000 [inline] kmem_cache_alloc_node_noprof+0x16b/0x320 mm/slub.c:4043 alloc_task_struct_node kernel/fork.c:176 [inline] dup_task_struct+0x57/0x8c0 kernel/fork.c:1107 copy_process+0x5d1/0x3dc0 kernel/fork.c:2220 kernel_clone+0x226/0x8f0 kernel/fork.c:2797 kernel_thread+0x1bc/0x240 kernel/fork.c:2859 create_kthread kernel/kthread.c:412 [inline] kthreadd+0x60d/0x810 kernel/kthread.c:765 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Freed by task 1023: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xe0/0x150 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2195 [inline] slab_free mm/slub.c:4436 [inline] kmem_cache_free+0x145/0x350 mm/slub.c:4511 put_task_struct include/linux/sched/task.h:138 [inline] delayed_put_task_struct+0x125/0x2f0 kernel/exit.c:228 rcu_do_batch kernel/rcu/tree.c:2535 [inline] rcu_core+0xafd/0x1830 kernel/rcu/tree.c:2809 handle_softirqs+0x2d6/0x990 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637 irq_exit_rcu+0x9/0x30 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 Last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47 __kasan_record_aux_stack+0xac/0xc0 mm/kasan/generic.c:541 __call_rcu_common kernel/rcu/tree.c:3072 [inline] call_rcu+0x167/0xa70 kernel/rcu/tree.c:3176 context_switch kernel/sched/core.c:5411 [inline] __schedule+0x17f0/0x4a50 kernel/sched/core.c:6745 preempt_schedule_common+0x84/0xd0 kernel/sched/core.c:6924 preempt_schedule+0xe1/0xf0 kernel/sched/core.c:6948 preempt_schedule_thunk+0x1a/0x30 arch/x86/entry/thunk.S:12 unwind_next_frame+0x2124/0x2a00 arch/x86/kernel/unwind_orc.c:672 arch_stack_walk+0x151/0x1b0 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x118/0x1d0 kernel/stacktrace.c:122 kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xe0/0x150 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2195 [inline] slab_free mm/slub.c:4436 [inline] kmem_cache_free+0x145/0x350 mm/slub.c:4511 nilfs_btree_delete+0xffe/0x11c0 fs/nilfs2/btree.c:1611 nilfs_bmap_do_delete fs/nilfs2/bmap.c:184 [inline] nilfs_bmap_do_truncate fs/nilfs2/bmap.c:272 [inline] nilfs_bmap_truncate+0x319/0x590 fs/nilfs2/bmap.c:305 nilfs_truncate_bmap+0x207/0x3d0 fs/nilfs2/inode.c:841 nilfs_evict_inode+0x21c/0x500 fs/nilfs2/inode.c:946 evict+0x2a8/0x630 fs/inode.c:667 nilfs_dispose_list+0x51d/0x5c0 fs/nilfs2/segment.c:820 process_one_work kernel/workqueue.c:3231 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 worker_thread+0x86d/0xd70 kernel/workqueue.c:3393 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 The buggy address belongs to the object at ffff88802fadbc00 which belongs to the cache task_struct of size 7424 The buggy address is located 2584 bytes inside of freed 7424-byte region [ffff88802fadbc00, ffff88802fadd900) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2fad8 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffefff(slab) raw: 00fff00000000040 ffff888015eed500 ffffea000064aa00 dead000000000002 raw: 0000000000000000 0000000000040004 00000001ffffefff 0000000000000000 head: 00fff00000000040 ffff888015eed500 ffffea000064aa00 dead000000000002 head: 0000000000000000 0000000000040004 00000001ffffefff 0000000000000000 head: 00fff00000000003 ffffea0000beb601 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 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 11, tgid 11 (kworker/u8:0), ts 19502184088, free_ts 0 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1468 prep_new_page mm/page_alloc.c:1476 [inline] get_page_from_freelist+0x2ce2/0x2d90 mm/page_alloc.c:3438 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4696 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x5f/0x120 mm/slub.c:2264 allocate_slab+0x5a/0x2e0 mm/slub.c:2427 new_slab mm/slub.c:2480 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3666 __slab_alloc+0x58/0xa0 mm/slub.c:3756 __slab_alloc_node mm/slub.c:3809 [inline] slab_alloc_node mm/slub.c:3988 [inline] kmem_cache_alloc_node_noprof+0x1fe/0x320 mm/slub.c:4043 alloc_task_struct_node kernel/fork.c:176 [inline] dup_task_struct+0x57/0x8c0 kernel/fork.c:1107 copy_process+0x5d1/0x3dc0 kernel/fork.c:2220 kernel_clone+0x226/0x8f0 kernel/fork.c:2797 user_mode_thread+0x132/0x1a0 kernel/fork.c:2875 call_usermodehelper_exec_work+0x5c/0x230 kernel/umh.c:172 process_one_work kernel/workqueue.c:3231 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 worker_thread+0x86d/0xd70 kernel/workqueue.c:3393 kthread+0x2f0/0x390 kernel/kthread.c:389 page_owner free stack trace missing Memory state around the buggy address: ffff88802fadc500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802fadc580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88802fadc600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802fadc680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802fadc700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 1 bytes skipped: 0: e8 8f a3 bc ff call 0xffbca394 5: e9 58 fa ff ff jmp 0xfffffa62 a: e8 85 a3 bc ff call 0xffbca394 f: e9 c0 fe ff ff jmp 0xfffffed4 14: 90 nop 15: 90 nop 16: 90 nop 17: 90 nop 18: 90 nop 19: 90 nop 1a: 90 nop 1b: 90 nop 1c: 90 nop 1d: 90 nop 1e: 90 nop 1f: 90 nop 20: 90 nop 21: 90 nop 22: 90 nop 23: 90 nop 24: f3 0f 1e fa endbr64 28: 55 push %rbp * 29: 48 89 e5 mov %rsp,%rbp <-- trapping instruction 2c: 41 57 push %r15 2e: 41 56 push %r14 30: 41 55 push %r13 32: 41 54 push %r12 34: 53 push %rbx 35: 48 83 e4 e0 and $0xffffffffffffffe0,%rsp 39: 48 rex.W 3a: 81 .byte 0x81 3b: ec in (%dx),%al 3c: 80 00 00 addb $0x0,(%rax)