================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x78/0x2000 kernel/locking/lockdep.c:5060 Read of size 8 at addr ffff8880619be418 by task kworker/u8:12/2911 CPU: 0 PID: 2911 Comm: kworker/u8:12 Not tainted 6.10.0-rc2-next-20240607-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Workqueue: btrfs-delalloc btrfs_work_helper Call Trace: __dump_stack lib/dump_stack.c:91 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:117 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/0x2000 kernel/locking/lockdep.c:5060 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5817 __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:4055 submit_compressed_extents+0xdf/0x1460 fs/btrfs/inode.c:1613 run_ordered_work fs/btrfs/async-thread.c:288 [inline] btrfs_work_helper+0x980/0xc50 fs/btrfs/async-thread.c:324 process_one_work kernel/workqueue.c:3248 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3329 worker_thread+0x86d/0xd50 kernel/workqueue.c:3409 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:144 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 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:3941 [inline] slab_alloc_node mm/slub.c:4001 [inline] kmem_cache_alloc_node_noprof+0x16b/0x320 mm/slub.c:4044 alloc_task_struct_node kernel/fork.c:176 [inline] dup_task_struct+0x57/0x8c0 kernel/fork.c:1102 copy_process+0x5d1/0x3dc0 kernel/fork.c:2201 kernel_clone+0x226/0x8f0 kernel/fork.c:2778 kernel_thread+0x1bc/0x240 kernel/fork.c:2840 create_kthread kernel/kthread.c:412 [inline] kthreadd+0x60d/0x810 kernel/kthread.c:765 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:144 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Freed by task 24072: 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:2196 [inline] slab_free mm/slub.c:4437 [inline] kmem_cache_free+0x145/0x350 mm/slub.c:4512 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:2564 [inline] rcu_core+0xafd/0x1830 kernel/rcu/tree.c:2838 handle_softirqs+0x2c4/0x970 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:3101 [inline] call_rcu+0x167/0xa70 kernel/rcu/tree.c:3205 context_switch kernel/sched/core.c:5195 [inline] __schedule+0x17f0/0x4a20 kernel/sched/core.c:6529 preempt_schedule_irq+0xfb/0x1c0 kernel/sched/core.c:6851 irqentry_exit+0x5e/0x90 kernel/entry/common.c:354 asm_sysvec_reschedule_ipi+0x1a/0x20 arch/x86/include/asm/idtentry.h:707 The buggy address belongs to the object at ffff8880619bda00 which belongs to the cache task_struct of size 7424 The buggy address is located 2584 bytes inside of freed 7424-byte region [ffff8880619bda00, ffff8880619bf700) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x619b8 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff888029d8b9c1 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 00fff00000000040 ffff888015eed500 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000040004 00000001fdffffff ffff888029d8b9c1 head: 00fff00000000040 ffff888015eed500 0000000000000000 dead000000000001 head: 0000000000000000 0000000000040004 00000001fdffffff ffff888029d8b9c1 head: 00fff00000000003 ffffea0001866e01 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 8740, tgid 8740 (syz-executor.1), ts 358762345273, free_ts 358758278205 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1470 prep_new_page mm/page_alloc.c:1478 [inline] get_page_from_freelist+0x2cbd/0x2d70 mm/page_alloc.c:3457 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4715 __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:2265 allocate_slab+0x5a/0x2f0 mm/slub.c:2428 new_slab mm/slub.c:2481 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3667 __slab_alloc+0x58/0xa0 mm/slub.c:3757 __slab_alloc_node mm/slub.c:3810 [inline] slab_alloc_node mm/slub.c:3989 [inline] kmem_cache_alloc_node_noprof+0x1fe/0x320 mm/slub.c:4044 alloc_task_struct_node kernel/fork.c:176 [inline] dup_task_struct+0x57/0x8c0 kernel/fork.c:1102 copy_process+0x5d1/0x3dc0 kernel/fork.c:2201 kernel_clone+0x226/0x8f0 kernel/fork.c:2778 __do_sys_clone3 kernel/fork.c:3079 [inline] __se_sys_clone3+0x2cb/0x350 kernel/fork.c:3063 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 8740 tgid 8740 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1089 [inline] free_unref_page+0xd22/0xea0 mm/page_alloc.c:2621 discard_slab mm/slub.c:2527 [inline] __put_partials+0xeb/0x130 mm/slub.c:2995 put_cpu_partial+0x17c/0x250 mm/slub.c:3070 __slab_free+0x2ea/0x3d0 mm/slub.c:4307 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x9e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3941 [inline] slab_alloc_node mm/slub.c:4001 [inline] __do_kmalloc_node mm/slub.c:4121 [inline] __kmalloc_noprof+0x1a3/0x400 mm/slub.c:4135 kmalloc_noprof include/linux/slab.h:664 [inline] kzalloc_noprof include/linux/slab.h:778 [inline] tomoyo_encode2 security/tomoyo/realpath.c:45 [inline] tomoyo_encode+0x26f/0x540 security/tomoyo/realpath.c:80 tomoyo_path_perm+0x3ca/0x740 security/tomoyo/file.c:831 tomoyo_path_symlink+0xde/0x120 security/tomoyo/tomoyo.c:212 security_path_symlink+0xe3/0x140 security/security.c:1876 do_symlinkat+0x136/0x3a0 fs/namei.c:4524 __do_sys_symlinkat fs/namei.c:4542 [inline] __se_sys_symlinkat fs/namei.c:4539 [inline] __x64_sys_symlinkat+0x95/0xb0 fs/namei.c:4539 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff8880619be300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880619be380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880619be400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880619be480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880619be500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================