Call Trace: ====================================================== WARNING: possible circular locking dependency detected 5.18.0-rc3-next-20220422 #1 Not tainted ------------------------------------------------------ syz-executor.7/28764 is trying to acquire lock: ffffffff851f6b58 ((console_sem).lock){-.-.}-{2:2}, at: down_trylock+0xe/0x60 but task is already holding lock: ffff8880461b6820 (&ctx->lock){-.-.}-{2:2}, at: __perf_event_task_sched_in+0x29c/0x6e0 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&ctx->lock){-.-.}-{2:2}: _raw_spin_lock+0x2a/0x40 __perf_event_task_sched_out+0x537/0x1970 __schedule+0xec4/0x2450 schedule+0xd2/0x1f0 exit_to_user_mode_prepare+0x114/0x1a0 syscall_exit_to_user_mode+0x19/0x40 do_syscall_64+0x48/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #2 (&rq->__lock){-.-.}-{2:2}: _raw_spin_lock_nested+0x30/0x40 raw_spin_rq_lock_nested+0x1e/0x30 task_fork_fair+0x63/0x4d0 sched_cgroup_fork+0x343/0x490 copy_process+0x4082/0x6db0 kernel_clone+0xe7/0xa60 kernel_thread+0xb5/0xf0 rest_init+0x24/0x250 arch_call_rest_init+0xf/0x14 start_kernel+0x4cd/0x4ee secondary_startup_64_no_verify+0xe0/0xeb -> #1 (&p->pi_lock){-.-.}-{2:2}: _raw_spin_lock_irqsave+0x39/0x50 try_to_wake_up+0xa5/0x1060 up+0x75/0xb0 __up_console_sem+0x6e/0x80 console_unlock+0x603/0xd40 vprintk_emit+0x1b4/0x550 devkmsg_emit.constprop.0+0xbb/0xf0 devkmsg_write.cold+0x83/0xd9 do_iter_readv_writev+0x3d8/0x650 do_iter_write+0x187/0x6f0 vfs_writev+0x1aa/0x630 do_writev+0x133/0x2f0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #0 ((console_sem).lock){-.-.}-{2:2}: __lock_acquire+0x2c2f/0x6120 lock_acquire+0x1a2/0x530 _raw_spin_lock_irqsave+0x39/0x50 down_trylock+0xe/0x60 __down_trylock_console_sem+0x3b/0xd0 vprintk_emit+0x162/0x550 vprintk+0x80/0x90 _printk+0xba/0xed show_trace_log_lvl+0x57/0x2bb ex_handler_msr+0x311/0x3a0 fixup_exception+0x307/0xff0 gp_try_fixup_and_notify.constprop.0+0x1e/0x120 exc_general_protection+0xe4/0x210 asm_exc_general_protection+0x1e/0x30 x86_pmu_enable_event+0x15f/0x2f0 amd_pmu_enable_all+0x12c/0x1a0 x86_pmu_enable+0x580/0xd90 __perf_event_task_sched_in+0x56b/0x6e0 finish_task_switch.isra.0+0x45c/0x870 __schedule+0x895/0x2450 schedule+0xd2/0x1f0 exit_to_user_mode_prepare+0x114/0x1a0 syscall_exit_to_user_mode+0x19/0x40 do_syscall_64+0x48/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae other info that might help us debug this: Chain exists of: (console_sem).lock --> &rq->__lock --> &ctx->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ctx->lock); lock(&rq->__lock); lock(&ctx->lock); lock((console_sem).lock); *** DEADLOCK *** 2 locks held by syz-executor.7/28764: #0: ffff88806ce3f220 (&cpuctx_lock){-.-.}-{2:2}, at: __perf_event_task_sched_in+0x28b/0x6e0 #1: ffff8880461b6820 (&ctx->lock){-.-.}-{2:2}, at: __perf_event_task_sched_in+0x29c/0x6e0 stack backtrace: CPU: 0 PID: 28764 Comm: syz-executor.7 Not tainted 5.18.0-rc3-next-20220422 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: dump_stack_lvl+0x8b/0xb3 check_noncircular+0x25f/0x2e0 __lock_acquire+0x2c2f/0x6120 lock_acquire+0x1a2/0x530 _raw_spin_lock_irqsave+0x39/0x50 down_trylock+0xe/0x60 __down_trylock_console_sem+0x3b/0xd0 vprintk_emit+0x162/0x550 vprintk+0x80/0x90 _printk+0xba/0xed show_trace_log_lvl+0x57/0x2bb ex_handler_msr+0x311/0x3a0 fixup_exception+0x307/0xff0 gp_try_fixup_and_notify.constprop.0+0x1e/0x120 exc_general_protection+0xe4/0x210 asm_exc_general_protection+0x1e/0x30 RIP: 0010:x86_pmu_enable_event+0x15f/0x2f0 Code: 81 cc 00 00 40 00 48 c1 ea 03 4d 21 ec 80 3c 02 00 0f 85 79 01 00 00 48 8b 9b 70 01 00 00 4c 89 e2 44 89 e0 48 c1 ea 20 89 d9 <0f> 30 66 90 e8 08 1d 43 00 5b 5d 41 5c 41 5d 41 5e 41 5f e9 f9 1c RSP: 0018:ffff8880451e7bb0 EFLAGS: 00010016 RAX: 0000000000530076 RBX: 00000000c0010200 RCX: 00000000c0010200 RDX: 0000000000000100 RSI: ffffffff81010364 RDI: ffff888044af9e30 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001 R10: ffffffff81010357 R11: 0000000000000000 R12: 0000010000530076 R13: fffffdffffffffff R14: fffffbfff0b1cc0d R15: 0000000000000000 amd_pmu_enable_all+0x12c/0x1a0 x86_pmu_enable+0x580/0xd90 __perf_event_task_sched_in+0x56b/0x6e0 finish_task_switch.isra.0+0x45c/0x870 __schedule+0x895/0x2450 schedule+0xd2/0x1f0 exit_to_user_mode_prepare+0x114/0x1a0 syscall_exit_to_user_mode+0x19/0x40 do_syscall_64+0x48/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fadbbbb1b19 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffef8de3d18 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: 0000000000000001 RBX: 0000000000000000 RCX: 00007fadbbbb1b19 RDX: 00000000000f4240 RSI: 0000000000000081 RDI: 00007fadbbcc4f68 RBP: 00007fadbbcc4f60 R08: 00007fadbbcc10a0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fadbbccbb78 R13: 00007ffef8de3e20 R14: 00007fadbbcc4f60 R15: 0000000000359770 amd_pmu_enable_all+0x12c/0x1a0 x86_pmu_enable+0x580/0xd90 __perf_event_task_sched_in+0x56b/0x6e0 finish_task_switch.isra.0+0x45c/0x870 __schedule+0x895/0x2450 schedule+0xd2/0x1f0 exit_to_user_mode_prepare+0x114/0x1a0 syscall_exit_to_user_mode+0x19/0x40 do_syscall_64+0x48/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fadbbbb1b19 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffef8de3d18 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: 0000000000000001 RBX: 0000000000000000 RCX: 00007fadbbbb1b19 RDX: 00000000000f4240 RSI: 0000000000000081 RDI: 00007fadbbcc4f68 RBP: 00007fadbbcc4f60 R08: 00007fadbbcc10a0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fadbbccbb78 R13: 00007ffef8de3e20 R14: 00007fadbbcc4f60 R15: 0000000000359770 Call Trace: amd_pmu_enable_all+0x12c/0x1a0 x86_pmu_enable+0x580/0xd90 __perf_event_task_sched_out+0x782/0x1970 __schedule+0xec4/0x2450 schedule+0xd2/0x1f0 exit_to_user_mode_prepare+0x114/0x1a0 syscall_exit_to_user_mode+0x19/0x40 do_syscall_64+0x48/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fadbbbb1b19 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffef8de3d18 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: 0000000000000001 RBX: 0000000000000000 RCX: 00007fadbbbb1b19 RDX: 00000000000f4240 RSI: 0000000000000081 RDI: 00007fadbbcc4f68 RBP: 00007fadbbcc4f60 R08: 00007fadbbcc10a0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fadbbccbb78 R13: 00007ffef8de3e20 R14: 00007fadbbcc4f60 R15: 0000000000359770 Call Trace: x86_pmu_stop+0x149/0x330 x86_pmu_del+0x1be/0x610 event_sched_out+0x2ed/0xe10 __perf_remove_from_context+0x87/0xbe0 event_function+0x297/0x3d0 remote_function+0x125/0x1b0 flush_smp_call_function_queue+0x1df/0x5a0 __sysvec_call_function_single+0x92/0x3a0 sysvec_call_function_single+0x89/0xc0 asm_sysvec_call_function_single+0x12/0x20 RIP: 0010:__kasan_check_read+0x4/0x10 Code: 0f 0b 48 83 c4 60 5b 5d 41 5c c3 48 05 00 80 00 00 48 89 fb 48 39 c7 0f 82 8d b5 8e 02 eb e1 cc cc cc cc cc cc cc 48 8b 0c 24 <89> f6 31 d2 e9 c3 f9 ff ff 0f 1f 00 48 8b 0c 24 89 f6 ba 01 00 00 RSP: 0018:ffff888045c0f730 EFLAGS: 00000293 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff81679af5 RDX: ffff88804275b600 RSI: 0000000000000008 RDI: ffffea0000dae5c0 RBP: ffffea0000dae5c0 R08: 0000000000000000 R09: ffffffff858e84d7 R10: ffffffff816cd5f0 R11: 0000000000000001 R12: ffffea0000dae5c8 R13: 00007ff0a1d98000 R14: ffff888016f5ecb8 R15: dffffc0000000000 unmap_page_range+0xeb5/0x27c0 unmap_single_vma+0x196/0x360 unmap_vmas+0x18f/0x320 exit_mmap+0x192/0x460 mmput+0xc8/0x380 do_exit+0xa0a/0x27e0 do_group_exit+0xd2/0x2f0 get_signal+0x2303/0x2350 arch_do_signal_or_restart+0x88/0x1a40 exit_to_user_mode_prepare+0x131/0x1a0 syscall_exit_to_user_mode+0x19/0x40 do_syscall_64+0x48/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7ff0a3ac0b19 Code: Unable to access opcode bytes at RIP 0x7ff0a3ac0aef. RSP: 002b:00007ff0a1036218 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: 0000000000000001 RBX: 00007ff0a3bd3f68 RCX: 00007ff0a3ac0b19 RDX: 00000000000f4240 RSI: 0000000000000081 RDI: 00007ff0a3bd3f6c RBP: 00007ff0a3bd3f60 R08: 000000000000000e R09: 0000000000000000 R10: 0000000000000003 R11: 0000000000000246 R12: 00007ff0a3bd3f6c R13: 00007ffff689f00f R14: 00007ff0a1036300 R15: 0000000000022000 ---------------- Code disassembly (best guess): 0: 81 cc 00 00 40 00 or $0x400000,%esp 6: 48 c1 ea 03 shr $0x3,%rdx a: 4d 21 ec and %r13,%r12 d: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) 11: 0f 85 79 01 00 00 jne 0x190 17: 48 8b 9b 70 01 00 00 mov 0x170(%rbx),%rbx 1e: 4c 89 e2 mov %r12,%rdx 21: 44 89 e0 mov %r12d,%eax 24: 48 c1 ea 20 shr $0x20,%rdx 28: 89 d9 mov %ebx,%ecx * 2a: 0f 30 wrmsr <-- trapping instruction 2c: 66 90 xchg %ax,%ax 2e: e8 08 1d 43 00 callq 0x431d3b 33: 5b pop %rbx 34: 5d pop %rbp 35: 41 5c pop %r12 37: 41 5d pop %r13 39: 41 5e pop %r14 3b: 41 5f pop %r15 3d: e9 .byte 0xe9 3e: f9 stc 3f: 1c .byte 0x1c