possible deadlock in ring_buffer_map (2)

Status: auto-obsoleted due to no activity on 2026/11/29 18:24
Subsystems: trace
Labels: prio:low
[Documentation on labels]
First crash: 94d, last: 94d
▶ ▼ ✨ AI Jobs (1)
ID Workflow Result Correct Bug Created Started Finished Revision
ca6de2ce assessment-security DenialOfService: ✅ Exploitable: ❌ FilesystemTrigger: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: ❌ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ possible deadlock in ring_buffer_map (2) 2026/09/02 01:00 2026/09/02 01:00 2026/09/02 01:28 587f6b29
▶ ▼ Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ring_buffer_map trace 4 1 434d 430d 0/30 auto-obsoleted due to no activity on 2026/01/03 21:46

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Tainted: G             L     
------------------------------------------------------
syz.0.6362/24449 is trying to acquire lock:
ffffffff8ee8f980 (fs_reclaim){+.+.}-{0:0}, at: might_alloc include/linux/sched/mm.h:316 [inline]
ffffffff8ee8f980 (fs_reclaim){+.+.}-{0:0}, at: slab_pre_alloc_hook mm/slub.c:4636 [inline]
ffffffff8ee8f980 (fs_reclaim){+.+.}-{0:0}, at: slab_alloc_node mm/slub.c:4974 [inline]
ffffffff8ee8f980 (fs_reclaim){+.+.}-{0:0}, at: __do_kmalloc_node mm/slub.c:5413 [inline]
ffffffff8ee8f980 (fs_reclaim){+.+.}-{0:0}, at: __kmalloc_noprof+0xbc/0x720 mm/slub.c:5439

but task is already holding lock:
ffff88801b0a51f8 (&cpu_buffer->mapping_lock){+.+.}-{4:4}, at: class_mutex_constructor include/linux/mutex.h:253 [inline]
ffff88801b0a51f8 (&cpu_buffer->mapping_lock){+.+.}-{4:4}, at: ring_buffer_map+0x10f/0x560 kernel/trace/ring_buffer.c:7785

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #8 (&cpu_buffer->mapping_lock){+.+.}-{4:4}:
       __mutex_lock_common kernel/locking/mutex.c:646 [inline]
       __mutex_lock+0x19d/0x1550 kernel/locking/mutex.c:821
       class_mutex_constructor include/linux/mutex.h:253 [inline]
       ring_buffer_map+0x10f/0x560 kernel/trace/ring_buffer.c:7785
       tracing_buffers_mmap+0xf2/0x160 kernel/trace/trace.c:7462
       vfs_mmap include/linux/fs.h:2064 [inline]
       mmap_file mm/internal.h:238 [inline]
       __mmap_new_file_vma mm/vma.c:2595 [inline]
       __mmap_new_vma mm/vma.c:2668 [inline]
       __mmap_region mm/vma.c:2879 [inline]
       mmap_region+0x193b/0x2240 mm/vma.c:2964
       do_mmap+0xe0a/0x1300 mm/mmap.c:573
       vm_mmap_pgoff+0x272/0x4e0 mm/util.c:581
       ksys_mmap_pgoff+0x4dc/0x760 mm/mmap.c:619
       do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
       do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #7 (&mm->mmap_lock){++++}-{4:4}:
       __might_fault+0xcb/0x130 mm/memory.c:7482
       _copy_from_iter+0x100/0x1660 lib/iov_iter.c:271
       copy_from_iter include/linux/uio.h:228 [inline]
       copy_from_iter_full include/linux/uio.h:245 [inline]
       skb_do_copy_data_nocache include/net/sock.h:2327 [inline]
       skb_copy_to_page_nocache include/net/sock.h:2353 [inline]
       tcp_sendmsg_locked+0x26c2/0x5640 net/ipv4/tcp.c:1311
       tcp_sendmsg+0x2f/0x50 net/ipv4/tcp.c:1452
       sock_sendmsg_nosec+0x10e/0x180 net/socket.c:801
       __sock_sendmsg net/socket.c:815 [inline]
       sock_write_iter+0x2de/0x3e0 net/socket.c:1266
       new_sync_write fs/read_write.c:595 [inline]
       vfs_write+0x612/0xba0 fs/read_write.c:687
       ksys_write+0x150/0x270 fs/read_write.c:739
       do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
       do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #6 (sk_lock-AF_INET){+.+.}-{0:0}:
       lock_sock_nested+0x41/0x100 net/core/sock.c:3827
       lock_sock include/net/sock.h:1713 [inline]
       inet_shutdown+0x6a/0x390 net/ipv4/af_inet.c:913
       nbd_mark_nsock_dead+0x2cb/0x550 drivers/block/nbd.c:319
       recv_work+0x1cee/0x1e10 drivers/block/nbd.c:1030
       process_one_work kernel/workqueue.c:3387 [inline]
       process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3470
       worker_thread+0xa47/0xfb0 kernel/workqueue.c:3551
       kthread+0x38b/0x480 kernel/kthread.c:436
       ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #5 (&nsock->tx_lock){+.+.}-{4:4}:
       __mutex_lock_common kernel/locking/mutex.c:646 [inline]
       __mutex_lock+0x19d/0x1550 kernel/locking/mutex.c:821
       nbd_handle_cmd drivers/block/nbd.c:1143 [inline]
       nbd_queue_rq+0x373/0xff0 drivers/block/nbd.c:1207
       blk_mq_dispatch_rq_list+0x499/0x1990 block/blk-mq.c:2117
       __blk_mq_do_dispatch_sched block/blk-mq-sched.c:168 [inline]
       blk_mq_do_dispatch_sched block/blk-mq-sched.c:182 [inline]
       __blk_mq_sched_dispatch_requests+0xd36/0x1580 block/blk-mq-sched.c:307
       blk_mq_sched_dispatch_requests+0xd7/0x190 block/blk-mq-sched.c:329
       blk_mq_run_work_fn+0x16c/0x300 block/blk-mq.c:2532
       process_one_work kernel/workqueue.c:3387 [inline]
       process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3470
       worker_thread+0xa47/0xfb0 kernel/workqueue.c:3551
       kthread+0x38b/0x480 kernel/kthread.c:436
       ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #4 (&cmd->lock){+.+.}-{4:4}:
       __mutex_lock_common kernel/locking/mutex.c:646 [inline]
       __mutex_lock+0x19d/0x1550 kernel/locking/mutex.c:821
       nbd_queue_rq+0xc1/0xff0 drivers/block/nbd.c:1199
       blk_mq_dispatch_rq_list+0x499/0x1990 block/blk-mq.c:2117
       __blk_mq_do_dispatch_sched block/blk-mq-sched.c:168 [inline]
       blk_mq_do_dispatch_sched block/blk-mq-sched.c:182 [inline]
       __blk_mq_sched_dispatch_requests+0xd36/0x1580 block/blk-mq-sched.c:307
       blk_mq_sched_dispatch_requests+0xd7/0x190 block/blk-mq-sched.c:329
       blk_mq_run_work_fn+0x16c/0x300 block/blk-mq.c:2532
       process_one_work kernel/workqueue.c:3387 [inline]
       process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3470
       worker_thread+0xa47/0xfb0 kernel/workqueue.c:3551
       kthread+0x38b/0x480 kernel/kthread.c:436
       ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #3 (set->srcu){.+.+}-{0:0}:
       srcu_lock_sync include/linux/srcu.h:210 [inline]
       __synchronize_srcu+0xc9/0x2f0 kernel/rcu/srcutree.c:1462
       elevator_switch+0x1e8/0x7b0 block/elevator.c:576
       elevator_change+0x2fa/0x480 block/elevator.c:681
       elevator_set_default+0x375/0x440 block/elevator.c:754
       blk_register_queue+0x3f3/0x4e0 block/blk-sysfs.c:992
       __add_disk+0x6cb/0xe30 block/genhd.c:524
       add_disk_fwnode+0x100/0x3a0 block/genhd.c:593
       add_disk include/linux/blkdev.h:798 [inline]
       nbd_dev_add+0x733/0xb60 drivers/block/nbd.c:2026
       nbd_init+0x168/0x1f0 drivers/block/nbd.c:2743
       do_one_initcall+0x250/0x870 init/main.c:1357
       do_initcall_level+0x10a/0x1a0 init/main.c:1419
       do_initcalls+0x59/0xa0 init/main.c:1435
       kernel_init_freeable+0x29d/0x3e0 init/main.c:1670
       kernel_init+0x22/0x1d0 init/main.c:1560
       ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #2 (&q->elevator_lock){+.+.}-{4:4}:
       __mutex_lock_common kernel/locking/mutex.c:646 [inline]
       __mutex_lock+0x19d/0x1550 kernel/locking/mutex.c:821
       elevator_change+0x1af/0x480 block/elevator.c:679
       elv_iosched_store+0x504/0x630 block/elevator.c:826
       queue_attr_store+0x207/0x2b0 block/blk-sysfs.c:906
       kernfs_fop_write_iter+0x3a4/0x540 fs/kernfs/file.c:345
       iter_file_splice_write+0xa31/0x1240 fs/splice.c:736
       do_splice_from fs/splice.c:936 [inline]
       direct_splice_actor+0x101/0x160 fs/splice.c:1159
       splice_direct_to_actor+0x57b/0xcb0 fs/splice.c:1103
       do_splice_direct_actor fs/splice.c:1202 [inline]
       do_splice_direct+0x195/0x290 fs/splice.c:1228
       do_sendfile+0x52e/0x7c0 fs/read_write.c:1371
       __do_sys_sendfile64 fs/read_write.c:1432 [inline]
       __se_sys_sendfile64+0x144/0x1a0 fs/read_write.c:1418
       do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
       do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&q->q_usage_counter(io)#17){++++}-{0:0}:
       blk_alloc_queue+0x544/0x690 block/blk-core.c:504
       blk_mq_alloc_queue block/blk-mq.c:4420 [inline]
       __blk_mq_alloc_disk+0x194/0x390 block/blk-mq.c:4467
       loop_add+0x480/0xb40 drivers/block/loop.c:2071
       loop_init+0xd7/0x160 drivers/block/loop.c:2310
       do_one_initcall+0x250/0x870 init/main.c:1357
       do_initcall_level+0x10a/0x1a0 init/main.c:1419
       do_initcalls+0x59/0xa0 init/main.c:1435
       kernel_init_freeable+0x29d/0x3e0 init/main.c:1670
       kernel_init+0x22/0x1d0 init/main.c:1560
       ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #0 (fs_reclaim){+.+.}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3181 [inline]
       check_prevs_add kernel/locking/lockdep.c:3300 [inline]
       validate_chain kernel/locking/lockdep.c:3924 [inline]
       __lock_acquire+0x15ff/0x2e50 kernel/locking/lockdep.c:5254
       lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5908
       __fs_reclaim_acquire mm/page_alloc.c:4375 [inline]
       fs_reclaim_acquire+0x71/0x100 mm/page_alloc.c:4389
       might_alloc include/linux/sched/mm.h:316 [inline]
       slab_pre_alloc_hook mm/slub.c:4636 [inline]
       slab_alloc_node mm/slub.c:4974 [inline]
       __do_kmalloc_node mm/slub.c:5413 [inline]
       __kmalloc_noprof+0xbc/0x720 mm/slub.c:5439
       _kmalloc_noprof include/linux/slab.h:995 [inline]
       _kzalloc_noprof include/linux/slab.h:1312 [inline]
       __rb_map_vma+0x424/0x9d0 kernel/trace/ring_buffer.c:7713
       ring_buffer_map+0x153/0x560 kernel/trace/ring_buffer.c:7788
       tracing_buffers_mmap+0xf2/0x160 kernel/trace/trace.c:7462
       vfs_mmap include/linux/fs.h:2064 [inline]
       mmap_file mm/internal.h:238 [inline]
       __mmap_new_file_vma mm/vma.c:2595 [inline]
       __mmap_new_vma mm/vma.c:2668 [inline]
       __mmap_region mm/vma.c:2879 [inline]
       mmap_region+0x193b/0x2240 mm/vma.c:2964
       do_mmap+0xe0a/0x1300 mm/mmap.c:573
       vm_mmap_pgoff+0x272/0x4e0 mm/util.c:581
       ksys_mmap_pgoff+0x4dc/0x760 mm/mmap.c:619
       do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
       do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  fs_reclaim --> &mm->mmap_lock --> &cpu_buffer->mapping_lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&cpu_buffer->mapping_lock);
                               lock(&mm->mmap_lock);
                               lock(&cpu_buffer->mapping_lock);
  lock(fs_reclaim);

 *** DEADLOCK ***

locks held by syz.0.6362/24449: 2, last CPU#0:
 #0: ffff8880294769b8 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:562 [inline]
 #0: ffff8880294769b8 (&mm->mmap_lock){++++}-{4:4}, at: vm_mmap_pgoff+0x1dd/0x4e0 mm/util.c:579
 #1: ffff88801b0a51f8 (&cpu_buffer->mapping_lock){+.+.}-{4:4}, at: class_mutex_constructor include/linux/mutex.h:253 [inline]
 #1: ffff88801b0a51f8 (&cpu_buffer->mapping_lock){+.+.}-{4:4}, at: ring_buffer_map+0x10f/0x560 kernel/trace/ring_buffer.c:7785

stack backtrace:
CPU: 0 UID: 0 PID: 24449 Comm: syz.0.6362 Tainted: G             L      syzkaller #0 PREEMPT(full) 
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2059
 check_noncircular+0x12f/0x150 kernel/locking/lockdep.c:2191
 check_prev_add kernel/locking/lockdep.c:3181 [inline]
 check_prevs_add kernel/locking/lockdep.c:3300 [inline]
 validate_chain kernel/locking/lockdep.c:3924 [inline]
 __lock_acquire+0x15ff/0x2e50 kernel/locking/lockdep.c:5254
 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5908
 __fs_reclaim_acquire mm/page_alloc.c:4375 [inline]
 fs_reclaim_acquire+0x71/0x100 mm/page_alloc.c:4389
 might_alloc include/linux/sched/mm.h:316 [inline]
 slab_pre_alloc_hook mm/slub.c:4636 [inline]
 slab_alloc_node mm/slub.c:4974 [inline]
 __do_kmalloc_node mm/slub.c:5413 [inline]
 __kmalloc_noprof+0xbc/0x720 mm/slub.c:5439
 _kmalloc_noprof include/linux/slab.h:995 [inline]
 _kzalloc_noprof include/linux/slab.h:1312 [inline]
 __rb_map_vma+0x424/0x9d0 kernel/trace/ring_buffer.c:7713
 ring_buffer_map+0x153/0x560 kernel/trace/ring_buffer.c:7788
 tracing_buffers_mmap+0xf2/0x160 kernel/trace/trace.c:7462
 vfs_mmap include/linux/fs.h:2064 [inline]
 mmap_file mm/internal.h:238 [inline]
 __mmap_new_file_vma mm/vma.c:2595 [inline]
 __mmap_new_vma mm/vma.c:2668 [inline]
 __mmap_region mm/vma.c:2879 [inline]
 mmap_region+0x193b/0x2240 mm/vma.c:2964
 do_mmap+0xe0a/0x1300 mm/mmap.c:573
 vm_mmap_pgoff+0x272/0x4e0 mm/util.c:581
 ksys_mmap_pgoff+0x4dc/0x760 mm/mmap.c:619
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fadbdb9e159
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:00007fadbe9d1028 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 00007fadbde25fa0 RCX: 00007fadbdb9e159
RDX: 0000000000000001 RSI: 0000000000003000 RDI: 0000200000ffd000
RBP: 00007fadbdc35024 R08: 0000000000000003 R09: 0000000000000000
R10: 0000000000000011 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fadbde26038 R14: 00007fadbde25fa0 R15: 00007ffee08a93e8
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/08/31 18:23 upstream cee9395acd80 316d9396 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ring_buffer_map
* Struck through repros no longer work on HEAD.