============================================ WARNING: possible recursive locking detected 6.12.0-rc5-syzkaller-g6c52d4da1c74 #0 Not tainted -------------------------------------------- syz.6.512/8156 is trying to acquire lock: ffffc90003e890d8 (&rb->spinlock){-.-.}-{2:2}, at: __bpf_ringbuf_reserve+0x1ea/0x600 kernel/bpf/ringbuf.c:427 but task is already holding lock: ffffc90003c790d8 (&rb->spinlock){-.-.}-{2:2}, at: __bpf_ringbuf_reserve+0x1ea/0x600 kernel/bpf/ringbuf.c:427 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&rb->spinlock); lock(&rb->spinlock); *** DEADLOCK *** May be due to missing lock nesting notation 6 locks held by syz.6.512/8156: #0: ffff8880683178a8 (&ctx->mutex){+.+.}-{3:3}, at: perf_event_ctx_lock_nested+0x416/0x590 kernel/events/core.c:1317 #1: ffffffff8e9a2ee8 (bpf_event_mutex){+.+.}-{3:3}, at: perf_event_attach_bpf_prog+0xdf/0x3d0 kernel/trace/bpf_trace.c:2179 #2: ffff8880b863ea98 (&rq->__lock){-.-.}-{2:2}, at: raw_spin_rq_lock_nested+0x2a/0x140 kernel/sched/core.c:598 #3: ffffffff8e937da0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:337 [inline] #3: ffffffff8e937da0 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline] #3: ffffffff8e937da0 (rcu_read_lock){....}-{1:2}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2315 [inline] #3: ffffffff8e937da0 (rcu_read_lock){....}-{1:2}, at: bpf_trace_run2+0x1fc/0x540 kernel/trace/bpf_trace.c:2357 #4: ffffc90003c790d8 (&rb->spinlock){-.-.}-{2:2}, at: __bpf_ringbuf_reserve+0x1ea/0x600 kernel/bpf/ringbuf.c:427 #5: ffffffff8e937da0 (rcu_read_lock){....}-{1:2}, at: trace_call_bpf+0xbc/0x8a0 stack backtrace: CPU: 0 UID: 0 PID: 8156 Comm: syz.6.512 Not tainted 6.12.0-rc5-syzkaller-g6c52d4da1c74 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_deadlock_bug+0x483/0x620 kernel/locking/lockdep.c:3037 check_deadlock kernel/locking/lockdep.c:3089 [inline] validate_chain+0x15e2/0x5920 kernel/locking/lockdep.c:3891 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162 __bpf_ringbuf_reserve+0x1ea/0x600 kernel/bpf/ringbuf.c:427 ____bpf_ringbuf_output kernel/bpf/ringbuf.c:553 [inline] bpf_ringbuf_output+0x67/0x1e0 kernel/bpf/ringbuf.c:543 bpf_prog_224b060aaa884769+0x47/0x4b bpf_dispatcher_nop_func include/linux/bpf.h:1265 [inline] __bpf_prog_run include/linux/filter.h:701 [inline] bpf_prog_run include/linux/filter.h:708 [inline] bpf_prog_run_array include/linux/bpf.h:2131 [inline] trace_call_bpf+0x369/0x8a0 kernel/trace/bpf_trace.c:146 perf_trace_run_bpf_submit+0x82/0x180 kernel/events/core.c:10416 perf_trace_lock+0x388/0x490 include/trace/events/lock.h:50 trace_lock_release include/trace/events/lock.h:69 [inline] lock_release+0x9cc/0xa30 kernel/locking/lockdep.c:5836 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:149 [inline] _raw_spin_unlock_irqrestore+0x79/0x140 kernel/locking/spinlock.c:194 __bpf_ringbuf_reserve+0x4ad/0x600 kernel/bpf/ringbuf.c:453 ____bpf_ringbuf_output kernel/bpf/ringbuf.c:553 [inline] bpf_ringbuf_output+0x67/0x1e0 kernel/bpf/ringbuf.c:543 bpf_prog_814d03a72b62c18f+0x50/0x54 bpf_dispatcher_nop_func include/linux/bpf.h:1265 [inline] __bpf_prog_run include/linux/filter.h:701 [inline] bpf_prog_run include/linux/filter.h:708 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2316 [inline] bpf_trace_run2+0x2ec/0x540 kernel/trace/bpf_trace.c:2357 trace_tlb_flush+0x118/0x140 include/trace/events/tlb.h:38 switch_mm_irqs_off+0x77a/0xa70 context_switch kernel/sched/core.c:5312 [inline] __schedule+0x1124/0x4bd0 kernel/sched/core.c:6690 preempt_schedule_notrace+0x100/0x140 kernel/sched/core.c:6962 preempt_schedule_notrace_thunk+0x1a/0x30 arch/x86/entry/thunk.S:13 trace_lock_release include/trace/events/lock.h:69 [inline] lock_release+0x9f0/0xa30 kernel/locking/lockdep.c:5836 __mutex_unlock_slowpath+0xe2/0x750 kernel/locking/mutex.c:912 perf_event_attach_bpf_prog+0x30b/0x3d0 kernel/trace/bpf_trace.c:2202 _perf_ioctl kernel/events/core.c:6088 [inline] perf_ioctl+0x7e4/0x25e0 kernel/events/core.c:6148 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893 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 RIP: 0033:0x7fc2ed37e719 Code: Unable to access opcode bytes at 0x7fc2ed37e6ef. RSP: 002b:00007fc2ed1f9038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fc2ed535f80 RCX: 00007fc2ed37e719 RDX: 000000000000000a RSI: 0000000040042408 RDI: 0000000000000008 RBP: 00007fc2ed3f139e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fc2ed535f80 R15: 00007ffc46ae7f48