================================================================== BUG: KASAN: slab-use-after-free in __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] BUG: KASAN: slab-use-after-free in _raw_spin_lock_irqsave+0xa7/0xf0 kernel/locking/spinlock.c:162 Read of size 1 at addr ffff888037ed0a28 by task kworker/u4:5/1035 CPU: 0 UID: 0 PID: 1035 Comm: kworker/u4:5 Not tainted 6.16.0-rc3-syzkaller-g7595b66ae9de #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: btrfs-qgroup-rescan btrfs_work_helper Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0xd2/0x2b0 mm/kasan/report.c:521 kasan_report+0x118/0x150 mm/kasan/report.c:634 __kasan_check_byte+0x2a/0x40 mm/kasan/common.c:557 kasan_check_byte include/linux/kasan.h:399 [inline] lock_acquire+0x8d/0x360 kernel/locking/lockdep.c:5845 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xa7/0xf0 kernel/locking/spinlock.c:162 class_raw_spinlock_irqsave_constructor include/linux/spinlock.h:557 [inline] try_to_wake_up+0x6e/0x1290 kernel/sched/core.c:4226 __btrfs_end_transaction+0x4c1/0x640 fs/btrfs/transaction.c:1097 btrfs_qgroup_rescan_worker+0x1a66/0x1be0 fs/btrfs/qgroup.c:3909 btrfs_work_helper+0x39c/0xc20 fs/btrfs/async-thread.c:312 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402 kthread+0x70e/0x8a0 kernel/kthread.c:464 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 2: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:319 [inline] __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:345 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4148 [inline] slab_alloc_node mm/slub.c:4197 [inline] kmem_cache_alloc_node_noprof+0x1bb/0x3c0 mm/slub.c:4249 alloc_task_struct_node kernel/fork.c:183 [inline] dup_task_struct+0x52/0x860 kernel/fork.c:869 copy_process+0x54b/0x3c00 kernel/fork.c:1999 kernel_clone+0x21e/0x870 kernel/fork.c:2599 kernel_thread+0x10c/0x160 kernel/fork.c:2661 create_kthread kernel/kthread.c:487 [inline] kthreadd+0x575/0x770 kernel/kthread.c:847 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Freed by task 15: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x62/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2381 [inline] slab_free mm/slub.c:4643 [inline] kmem_cache_free+0x18f/0x400 mm/slub.c:4745 put_task_struct include/linux/sched/task.h:145 [inline] delayed_put_task_struct+0x11f/0x2f0 kernel/exit.c:230 rcu_do_batch kernel/rcu/tree.c:2576 [inline] rcu_core+0xca8/0x1710 kernel/rcu/tree.c:2832 handle_softirqs+0x286/0x870 kernel/softirq.c:579 run_ksoftirqd+0x9b/0x100 kernel/softirq.c:968 smpboot_thread_fn+0x53f/0xa60 kernel/smpboot.c:164 kthread+0x70e/0x8a0 kernel/kthread.c:464 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Last potentially related work creation: kasan_save_stack+0x3e/0x60 mm/kasan/common.c:47 kasan_record_aux_stack+0xbd/0xd0 mm/kasan/generic.c:548 __call_rcu_common kernel/rcu/tree.c:3094 [inline] call_rcu+0x157/0x9c0 kernel/rcu/tree.c:3214 context_switch kernel/sched/core.c:5399 [inline] __schedule+0x16fd/0x4d00 kernel/sched/core.c:6785 __schedule_loop kernel/sched/core.c:6863 [inline] schedule+0x165/0x360 kernel/sched/core.c:6878 schedule_timeout+0x9a/0x270 kernel/time/sleep_timeout.c:75 do_wait_for_common kernel/sched/completion.c:95 [inline] __wait_for_common kernel/sched/completion.c:116 [inline] wait_for_common kernel/sched/completion.c:127 [inline] wait_for_completion+0x2bf/0x5d0 kernel/sched/completion.c:148 kthread_stop+0x194/0x5f0 kernel/kthread.c:791 close_ctree+0x56e/0xd60 fs/btrfs/disk-io.c:4377 generic_shutdown_super+0x132/0x2c0 fs/super.c:643 kill_anon_super+0x3b/0x70 fs/super.c:1282 btrfs_kill_super+0x41/0x50 fs/btrfs/super.c:2095 deactivate_locked_super+0xbc/0x130 fs/super.c:474 cleanup_mnt+0x425/0x4c0 fs/namespace.c:1417 task_work_run+0x1d1/0x260 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop+0xec/0x110 kernel/entry/common.c:114 exit_to_user_mode_prepare include/linux/entry-common.h:330 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:414 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline] do_syscall_64+0x2bd/0x3b0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888037ed0000 which belongs to the cache task_struct of size 9024 The buggy address is located 2600 bytes inside of freed 9024-byte region [ffff888037ed0000, ffff888037ed2340) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x37ed0 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff8880441a2001 anon flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000040 ffff888030407500 0000000000000000 dead000000000001 raw: 0000000000000000 0000000080030003 00000000f5000000 ffff8880441a2001 head: 04fff00000000040 ffff888030407500 0000000000000000 dead000000000001 head: 0000000000000000 0000000080030003 00000000f5000000 ffff8880441a2001 head: 04fff00000000003 ffffea0000dfb401 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 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 1038, tgid 1038 (kworker/u4:6), ts 20996644879, free_ts 0 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1704 prep_new_page mm/page_alloc.c:1712 [inline] get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3669 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:4959 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2419 alloc_slab_page mm/slub.c:2451 [inline] allocate_slab+0x8a/0x3b0 mm/slub.c:2619 new_slab mm/slub.c:2673 [inline] ___slab_alloc+0xbfc/0x1480 mm/slub.c:3859 __slab_alloc mm/slub.c:3949 [inline] __slab_alloc_node mm/slub.c:4024 [inline] slab_alloc_node mm/slub.c:4185 [inline] kmem_cache_alloc_node_noprof+0x280/0x3c0 mm/slub.c:4249 alloc_task_struct_node kernel/fork.c:183 [inline] dup_task_struct+0x52/0x860 kernel/fork.c:869 copy_process+0x54b/0x3c00 kernel/fork.c:1999 kernel_clone+0x21e/0x870 kernel/fork.c:2599 user_mode_thread+0xdd/0x140 kernel/fork.c:2677 call_usermodehelper_exec_work+0x5c/0x230 kernel/umh.c:171 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402 kthread+0x70e/0x8a0 kernel/kthread.c:464 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148 page_owner free stack trace missing Memory state around the buggy address: ffff888037ed0900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888037ed0980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888037ed0a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888037ed0a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888037ed0b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================