====================================================== WARNING: possible circular locking dependency detected 5.15.163-syzkaller #0 Not tainted ------------------------------------------------------ syz.4.2814/11013 is trying to acquire lock: ffff88813fe227e8 (&p->pi_lock){-.-.}-{2:2}, at: try_to_wake_up+0xae/0x1300 kernel/sched/core.c:4030 but task is already holding lock: ffff8880b9a35bb8 (lock#9){+.+.}-{2:2}, at: local_lock_acquire+0xd/0x170 include/linux/local_lock_internal.h:28 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (lock#9){+.+.}-{2:2}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 local_lock_acquire+0x29/0x170 include/linux/local_lock_internal.h:29 __mmap_lock_do_trace_acquire_returned+0x7c/0x340 mm/mmap_lock.c:237 __mmap_lock_trace_acquire_returned include/linux/mmap_lock.h:36 [inline] mmap_read_trylock include/linux/mmap_lock.h:137 [inline] stack_map_get_build_id_offset+0x612/0x930 kernel/bpf/stackmap.c:185 __bpf_get_stack+0x495/0x570 kernel/bpf/stackmap.c:496 ____bpf_get_stack_raw_tp kernel/trace/bpf_trace.c:1490 [inline] bpf_get_stack_raw_tp+0x1b2/0x220 kernel/trace/bpf_trace.c:1480 0xffffffffa003c32e bpf_dispatcher_nop_func include/linux/bpf.h:790 [inline] __bpf_prog_run include/linux/filter.h:628 [inline] bpf_prog_run include/linux/filter.h:635 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:1880 [inline] bpf_trace_run2+0x19e/0x340 kernel/trace/bpf_trace.c:1917 trace_tlb_flush+0xed/0x110 include/trace/events/tlb.h:38 switch_mm_irqs_off+0x748/0xa30 context_switch kernel/sched/core.c:5016 [inline] __schedule+0x1167/0x45b0 kernel/sched/core.c:6376 preempt_schedule_common+0x83/0xd0 kernel/sched/core.c:6552 preempt_schedule+0xd9/0xe0 kernel/sched/core.c:6577 preempt_schedule_thunk+0x16/0x18 arch/x86/entry/thunk_64.S:34 unwind_next_frame+0x144d/0x1fa0 arch/x86/kernel/unwind_orc.c:616 arch_stack_walk+0x10d/0x140 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x113/0x1c0 kernel/stacktrace.c:122 kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1705 [inline] slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731 slab_free mm/slub.c:3499 [inline] kfree+0xf1/0x270 mm/slub.c:4559 krealloc+0xa5/0xc0 push_jmp_history kernel/bpf/verifier.c:2125 [inline] is_state_visited kernel/bpf/verifier.c:11058 [inline] do_check+0x2633/0xf310 kernel/bpf/verifier.c:11198 do_check_common+0x844/0x1070 kernel/bpf/verifier.c:13482 do_check_main kernel/bpf/verifier.c:13545 [inline] bpf_check+0xcb80/0x12d00 kernel/bpf/verifier.c:14116 bpf_prog_load+0x12b3/0x1b60 kernel/bpf/syscall.c:2353 __sys_bpf+0x343/0x670 kernel/bpf/syscall.c:4651 __do_sys_bpf kernel/bpf/syscall.c:4755 [inline] __se_sys_bpf kernel/bpf/syscall.c:4753 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4753 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #1 (&rq->__lock){-.-.}-{2:2}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 _raw_spin_lock_nested+0x2d/0x40 kernel/locking/spinlock.c:368 raw_spin_rq_lock_nested+0x26/0x140 kernel/sched/core.c:475 raw_spin_rq_lock kernel/sched/sched.h:1326 [inline] rq_lock kernel/sched/sched.h:1621 [inline] task_fork_fair+0x5d/0x350 kernel/sched/fair.c:11495 sched_cgroup_fork+0x2d3/0x330 kernel/sched/core.c:4466 copy_process+0x224a/0x3ef0 kernel/fork.c:2320 kernel_clone+0x210/0x960 kernel/fork.c:2604 kernel_thread+0x168/0x1e0 kernel/fork.c:2656 rest_init+0x21/0x330 init/main.c:706 start_kernel+0x48c/0x540 init/main.c:1140 secondary_startup_64_no_verify+0xb1/0xbb -> #0 (&p->pi_lock){-.-.}-{2:2}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 try_to_wake_up+0xae/0x1300 kernel/sched/core.c:4030 rcu_read_unlock_special+0x3aa/0x520 kernel/rcu/tree_plugin.h:650 __rcu_read_unlock+0x92/0x100 kernel/rcu/tree_plugin.h:422 rcu_read_unlock include/linux/rcupdate.h:771 [inline] get_mem_cgroup_from_mm+0x179/0x260 mm/memcontrol.c:992 get_mm_memcg_path+0x1b/0x550 mm/mmap_lock.c:202 __mmap_lock_do_trace_acquire_returned+0x84/0x340 mm/mmap_lock.c:237 __mmap_lock_trace_acquire_returned include/linux/mmap_lock.h:36 [inline] mmap_read_trylock include/linux/mmap_lock.h:137 [inline] do_user_addr_fault arch/x86/mm/fault.c:1298 [inline] handle_page_fault arch/x86/mm/fault.c:1445 [inline] exc_page_fault+0x564/0x700 arch/x86/mm/fault.c:1501 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 __get_user_nocheck_1+0x6/0x10 arch/x86/lib/getuser.S:103 fault_in_readable+0x172/0x2e0 mm/gup.c:1801 fault_in_iov_iter_readable+0x14a/0x1d0 lib/iov_iter.c:460 generic_perform_write+0x1c9/0x5b0 mm/filemap.c:3775 __generic_file_write_iter+0x243/0x4f0 mm/filemap.c:3912 generic_file_write_iter+0xa7/0x1b0 mm/filemap.c:3944 call_write_iter include/linux/fs.h:2172 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xacd/0xe50 fs/read_write.c:594 ksys_write+0x1a2/0x2c0 fs/read_write.c:647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 other info that might help us debug this: Chain exists of: &p->pi_lock --> &rq->__lock --> lock#9 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(lock#9); lock(&rq->__lock); lock(lock#9); lock(&p->pi_lock); *** DEADLOCK *** 6 locks held by syz.4.2814/11013: #0: ffff88801ea1f9f0 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x2cb/0x380 fs/file.c:1088 #1: ffff88801fbfe460 (sb_writers#3){.+.+}-{0:0}, at: vfs_write+0x29a/0xe50 fs/read_write.c:590 #2: ffff88807d97ec30 (&sb->s_type->i_mutex_key#8){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline] #2: ffff88807d97ec30 (&sb->s_type->i_mutex_key#8){+.+.}-{3:3}, at: generic_file_write_iter+0x7c/0x1b0 mm/filemap.c:3941 #3: ffff88807f15dc28 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline] #3: ffff88807f15dc28 (&mm->mmap_lock){++++}-{3:3}, at: do_user_addr_fault arch/x86/mm/fault.c:1298 [inline] #3: ffff88807f15dc28 (&mm->mmap_lock){++++}-{3:3}, at: handle_page_fault arch/x86/mm/fault.c:1445 [inline] #3: ffff88807f15dc28 (&mm->mmap_lock){++++}-{3:3}, at: exc_page_fault+0x181/0x700 arch/x86/mm/fault.c:1501 #4: ffff8880b9a35bb8 (lock#9){+.+.}-{2:2}, at: local_lock_acquire+0xd/0x170 include/linux/local_lock_internal.h:28 #5: ffffffff8c91fb20 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x0/0x30 stack backtrace: CPU: 0 PID: 11013 Comm: syz.4.2814 Not tainted 5.15.163-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 try_to_wake_up+0xae/0x1300 kernel/sched/core.c:4030 rcu_read_unlock_special+0x3aa/0x520 kernel/rcu/tree_plugin.h:650 __rcu_read_unlock+0x92/0x100 kernel/rcu/tree_plugin.h:422 rcu_read_unlock include/linux/rcupdate.h:771 [inline] get_mem_cgroup_from_mm+0x179/0x260 mm/memcontrol.c:992 get_mm_memcg_path+0x1b/0x550 mm/mmap_lock.c:202 __mmap_lock_do_trace_acquire_returned+0x84/0x340 mm/mmap_lock.c:237 __mmap_lock_trace_acquire_returned include/linux/mmap_lock.h:36 [inline] mmap_read_trylock include/linux/mmap_lock.h:137 [inline] do_user_addr_fault arch/x86/mm/fault.c:1298 [inline] handle_page_fault arch/x86/mm/fault.c:1445 [inline] exc_page_fault+0x564/0x700 arch/x86/mm/fault.c:1501 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 RIP: 0010:__get_user_nocheck_1+0x6/0x10 arch/x86/lib/getuser.S:124 Code: d0 73 64 48 19 d2 48 21 d0 0f 01 cb 48 8b 10 31 c0 0f 01 ca c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 0f 01 cb 0f ae e8 <0f> b6 10 31 c0 0f 01 ca c3 90 0f 01 cb 0f ae e8 0f b7 10 31 c0 0f RSP: 0018:ffffc90002ef79b8 EFLAGS: 00050287 RAX: 000000002001b000 RBX: 000000002001a140 RCX: 0000000000040000 RDX: ffffc90004e71000 RSI: 000000000000f768 RDI: 000000000000f769 RBP: ffffc90002ef7a78 R08: ffffffff81b72a86 R09: fffff940002fcf87 R10: 0000000000000000 R11: dffffc0000000001 R12: 00000000ffffffff R13: 000000002001b000 R14: 000000002001c000 R15: 0000000000000000 fault_in_readable+0x172/0x2e0 mm/gup.c:1801 fault_in_iov_iter_readable+0x14a/0x1d0 lib/iov_iter.c:460 generic_perform_write+0x1c9/0x5b0 mm/filemap.c:3775 __generic_file_write_iter+0x243/0x4f0 mm/filemap.c:3912 generic_file_write_iter+0xa7/0x1b0 mm/filemap.c:3944 call_write_iter include/linux/fs.h:2172 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xacd/0xe50 fs/read_write.c:594 ksys_write+0x1a2/0x2c0 fs/read_write.c:647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7f715b9a8b59 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f715a429048 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f715bb38f60 RCX: 00007f715b9a8b59 RDX: 00000000fffffdef RSI: 0000000020000140 RDI: 000000000000000d RBP: 00007f715ba17e5d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f715bb38f60 R15: 00007ffd78e96c08 ---------------- Code disassembly (best guess): 0: d0 73 64 shlb 0x64(%rbx) 3: 48 19 d2 sbb %rdx,%rdx 6: 48 21 d0 and %rdx,%rax 9: 0f 01 cb stac c: 48 8b 10 mov (%rax),%rdx f: 31 c0 xor %eax,%eax 11: 0f 01 ca clac 14: c3 ret 15: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1) 1c: 00 00 00 1f: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) 24: 0f 01 cb stac 27: 0f ae e8 lfence * 2a: 0f b6 10 movzbl (%rax),%edx <-- trapping instruction 2d: 31 c0 xor %eax,%eax 2f: 0f 01 ca clac 32: c3 ret 33: 90 nop 34: 0f 01 cb stac 37: 0f ae e8 lfence 3a: 0f b7 10 movzwl (%rax),%edx 3d: 31 c0 xor %eax,%eax 3f: 0f .byte 0xf