syzbot


possible deadlock in refcount_dec_and_mutex_lock (2)

Status: upstream: reported C repro on 2026/03/07 06:53
Subsystems: perf
[Documentation on labels]
Reported-by: syzbot+196a82fd904572696b3c@syzkaller.appspotmail.com
First crash: 4d00h, last: 2d03h
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] perf: Fix deadlock in perf_mmap() 4 (4) 2026/03/10 04:45
[syzbot] [perf?] possible deadlock in refcount_dec_and_mutex_lock (2) 3 (6) 2026/03/09 06:40
Similar bugs (3)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in refcount_dec_and_mutex_lock nbd 4 1 2362d 2358d 0/29 auto-closed as invalid on 2019/11/20 04:39
linux-4.19 possible deadlock in refcount_dec_and_mutex_lock 4 C done done 5 2263d 2319d 1/1 fixed on 2020/01/28 16:29
linux-4.14 possible deadlock in refcount_dec_and_mutex_lock 4 C done 10 2266d 2338d 1/1 fixed on 2020/01/25 22:00
Last patch testing requests (2)
Created Duration User Patch Repo Result
2026/03/09 06:22 17m wangqing7171@gmail.com patch upstream error
2026/03/09 05:57 19m wangqing7171@gmail.com patch upstream error

Sample crash report:
R10: 0000000000000013 R11: 0000000000000246 R12: 0000000000000002
R13: 00007ff784215fac R14: 00007ff784215fa0 R15: 00007ff784215fa0
 </TASK>
============================================
WARNING: possible recursive locking detected
syzkaller #0 Not tainted
--------------------------------------------
syz.0.17/5460 is trying to acquire lock:
ffff88801f26c9e0 (&event->mmap_mutex){+.+.}-{4:4}, at: refcount_dec_and_mutex_lock+0x30/0xa0 lib/refcount.c:118

but task is already holding lock:
ffff88801f26c9e0 (&event->mmap_mutex){+.+.}-{4:4}, at: class_mutex_constructor include/linux/mutex.h:253 [inline]
ffff88801f26c9e0 (&event->mmap_mutex){+.+.}-{4:4}, at: perf_mmap+0x1bb/0x4b0 kernel/events/core.c:7453

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&event->mmap_mutex);
  lock(&event->mmap_mutex);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

2 locks held by syz.0.17/5460:
 #0: ffff888011a94080 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:554 [inline]
 #0: ffff888011a94080 (&mm->mmap_lock){++++}-{4:4}, at: vm_mmap_pgoff+0x234/0x4f0 mm/util.c:579
 #1: ffff88801f26c9e0 (&event->mmap_mutex){+.+.}-{4:4}, at: class_mutex_constructor include/linux/mutex.h:253 [inline]
 #1: ffff88801f26c9e0 (&event->mmap_mutex){+.+.}-{4:4}, at: perf_mmap+0x1bb/0x4b0 kernel/events/core.c:7453

stack backtrace:
CPU: 0 UID: 0 PID: 5460 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_deadlock_bug+0x279/0x290 kernel/locking/lockdep.c:3041
 check_deadlock kernel/locking/lockdep.c:3093 [inline]
 validate_chain kernel/locking/lockdep.c:3895 [inline]
 __lock_acquire+0x253f/0x2cf0 kernel/locking/lockdep.c:5237
 lock_acquire+0xf0/0x2e0 kernel/locking/lockdep.c:5868
 __mutex_lock_common kernel/locking/mutex.c:614 [inline]
 __mutex_lock+0x19f/0x1300 kernel/locking/mutex.c:776
 refcount_dec_and_mutex_lock+0x30/0xa0 lib/refcount.c:118
 perf_mmap_close+0x953/0xf90 kernel/events/core.c:7064
 perf_mmap+0x418/0x4b0 kernel/events/core.c:7488
 vfs_mmap include/linux/fs.h:2070 [inline]
 mmap_file mm/internal.h:167 [inline]
 __mmap_new_file_vma mm/vma.c:2468 [inline]
 __mmap_new_vma mm/vma.c:2532 [inline]
 __mmap_region mm/vma.c:2759 [inline]
 mmap_region+0x18fe/0x2240 mm/vma.c:2837
 do_mmap+0xc39/0x10c0 mm/mmap.c:559
 vm_mmap_pgoff+0x2c9/0x4f0 mm/util.c:581
 ksys_mmap_pgoff+0x51e/0x760 mm/mmap.c:605
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7ff783f9c799
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffeef4c8518 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 00007ff784215fa0 RCX: 00007ff783f9c799
RDX: 0000000001000008 RSI: 0000000000002000 RDI: 0000200000ffe000
RBP: 00007ffeef4c8580 R08: 0000000000000003 R09: 0000000000000000
R10: 0000000000000013 R11: 0000000000000246 R12: 0000000000000002
R13: 00007ff784215fac R14: 00007ff784215fa0 R15: 00007ff784215fa0
 </TASK>

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/03/06 18:41 upstream 5ee8dbf54602 41d8037d .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in refcount_dec_and_mutex_lock
2026/03/06 18:11 upstream 5ee8dbf54602 41d8037d .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in refcount_dec_and_mutex_lock
2026/03/08 14:16 upstream c23719abc330 5cb44a80 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in refcount_dec_and_mutex_lock
2026/03/06 17:43 upstream 5ee8dbf54602 41d8037d .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in refcount_dec_and_mutex_lock
* Struck through repros no longer work on HEAD.