====================================================== WARNING: possible circular locking dependency detected 5.15.0-rc4-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.2/20377 is trying to acquire lock: ffff88807a1e6a28 (&mm->mmap_lock#2){++++}-{3:3}, at: __might_fault+0x8a/0x160 mm/memory.c:5261 but task is already holding lock: ffff8880b9e379b8 (&cpuctx_mutex){+.+.}-{3:3}, at: perf_event_ctx_lock_nested+0x18f/0x320 kernel/events/core.c:1357 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&cpuctx_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:596 [inline] __mutex_lock+0x131/0x12f0 kernel/locking/mutex.c:729 perf_event_init_cpu+0x146/0x350 kernel/events/core.c:13295 perf_event_init+0x37d/0x3d3 kernel/events/core.c:13342 start_kernel+0x23f/0x35c init/main.c:1055 secondary_startup_64_no_verify+0xb0/0xbb -> #2 (pmus_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:596 [inline] __mutex_lock+0x131/0x12f0 kernel/locking/mutex.c:729 perf_event_init_cpu+0xae/0x350 kernel/events/core.c:13289 cpuhp_invoke_callback+0x2f0/0x830 kernel/cpu.c:190 cpuhp_invoke_callback_range kernel/cpu.c:665 [inline] cpuhp_up_callbacks kernel/cpu.c:693 [inline] _cpu_up+0x2f8/0x5f0 kernel/cpu.c:1368 cpu_up kernel/cpu.c:1404 [inline] cpu_up+0x95/0x100 kernel/cpu.c:1376 bringup_nonboot_cpus+0xab/0xd0 kernel/cpu.c:1470 smp_init+0x23/0x106 kernel/smp.c:1092 kernel_init_freeable+0x3a0/0x605 init/main.c:1606 kernel_init+0x14/0x120 init/main.c:1505 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 -> #1 (cpu_hotplug_lock){++++}-{0:0}: percpu_down_read include/linux/percpu-rwsem.h:51 [inline] cpus_read_lock+0x39/0xc0 kernel/cpu.c:308 wake_up_all_idle_cpus+0xc/0x50 kernel/smp.c:1173 cpu_latency_qos_apply kernel/power/qos.c:249 [inline] cpu_latency_qos_remove_request.part.0+0x81/0x210 kernel/power/qos.c:328 snd_pcm_hw_params+0x115e/0x1780 sound/core/pcm_native.c:784 snd_pcm_oss_change_params_locked+0x132f/0x3050 sound/core/oss/pcm_oss.c:947 snd_pcm_oss_change_params sound/core/oss/pcm_oss.c:1091 [inline] snd_pcm_oss_mmap+0x391/0x4a0 sound/core/oss/pcm_oss.c:2910 call_mmap include/linux/fs.h:2168 [inline] mmap_region+0xb0f/0x1480 mm/mmap.c:1787 do_mmap+0x5ca/0xd80 mm/mmap.c:1575 vm_mmap_pgoff+0x163/0x210 mm/util.c:519 ksys_mmap_pgoff+0x3b5/0x5f0 mm/mmap.c:1624 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #0 (&mm->mmap_lock#2){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3051 [inline] check_prevs_add kernel/locking/lockdep.c:3174 [inline] validate_chain kernel/locking/lockdep.c:3789 [inline] __lock_acquire+0x2985/0x5410 kernel/locking/lockdep.c:5015 lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590 __might_fault mm/memory.c:5262 [inline] __might_fault+0xe8/0x160 mm/memory.c:5247 _copy_to_user+0x20/0xc0 lib/usercopy.c:28 copy_to_user include/linux/uaccess.h:200 [inline] perf_read_group kernel/events/core.c:5329 [inline] __perf_read kernel/events/core.c:5396 [inline] perf_read+0x5ef/0x7e0 kernel/events/core.c:5415 do_loop_readv_writev fs/read_write.c:750 [inline] do_loop_readv_writev fs/read_write.c:737 [inline] do_iter_read+0x3f0/0x6a0 fs/read_write.c:792 vfs_readv+0xc3/0x130 fs/read_write.c:910 do_readv+0x10b/0x280 fs/read_write.c:947 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae other info that might help us debug this: Chain exists of: &mm->mmap_lock#2 --> pmus_lock --> &cpuctx_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&cpuctx_mutex); lock(pmus_lock); lock(&cpuctx_mutex); lock(&mm->mmap_lock#2); *** DEADLOCK *** 1 lock held by syz-executor.2/20377: #0: ffff8880b9e379b8 (&cpuctx_mutex){+.+.}-{3:3}, at: perf_event_ctx_lock_nested+0x18f/0x320 kernel/events/core.c:1357 stack backtrace: CPU: 0 PID: 20377 Comm: syz-executor.2 Not tainted 5.15.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x57/0x7d lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2131 check_prev_add kernel/locking/lockdep.c:3051 [inline] check_prevs_add kernel/locking/lockdep.c:3174 [inline] validate_chain kernel/locking/lockdep.c:3789 [inline] __lock_acquire+0x2985/0x5410 kernel/locking/lockdep.c:5015 lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590 __might_fault mm/memory.c:5262 [inline] __might_fault+0xe8/0x160 mm/memory.c:5247 _copy_to_user+0x20/0xc0 lib/usercopy.c:28 copy_to_user include/linux/uaccess.h:200 [inline] perf_read_group kernel/events/core.c:5329 [inline] __perf_read kernel/events/core.c:5396 [inline] perf_read+0x5ef/0x7e0 kernel/events/core.c:5415 do_loop_readv_writev fs/read_write.c:750 [inline] do_loop_readv_writev fs/read_write.c:737 [inline] do_iter_read+0x3f0/0x6a0 fs/read_write.c:792 vfs_readv+0xc3/0x130 fs/read_write.c:910 do_readv+0x10b/0x280 fs/read_write.c:947 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f5ad76f4a39 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:00007f5ad6e49188 EFLAGS: 00000246 ORIG_RAX: 0000000000000013 RAX: ffffffffffffffda RBX: 00007f5ad77f8020 RCX: 00007f5ad76f4a39 RDX: 0000000000000001 RSI: 00000000200002c0 RDI: 0000000000000007 RBP: 00007f5ad774ec5f R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff1c0c392f R14: 00007f5ad6e49300 R15: 0000000000022000