====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc4-syzkaller #0 Not tainted ------------------------------------------------------ syz.3.15/3109 is trying to acquire lock: ffff88810b3f3918 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x92/0x100 mm/memory.c:6705 but task is already holding lock: ffff888103f3c278 (&q->debugfs_mutex){+.+.}-{3:3}, at: blk_trace_setup+0xa8/0x190 kernel/trace/blktrace.c:647 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&q->debugfs_mutex){+.+.}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 blk_mq_init_sched+0x39f/0x730 block/blk-mq-sched.c:473 elevator_init_mq+0x15f/0x240 block/elevator.c:605 add_disk_fwnode+0xfe/0xd20 block/genhd.c:413 sd_probe+0xa77/0x10c0 drivers/scsi/sd.c:4024 really_probe+0x2eb/0x960 drivers/base/dd.c:658 __driver_probe_device+0x138/0x310 drivers/base/dd.c:800 driver_probe_device+0x4b/0x3a0 drivers/base/dd.c:830 __driver_attach_async_helper+0x133/0x250 drivers/base/dd.c:1148 async_run_entry_fn+0x9e/0x3f0 kernel/async.c:129 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0x96c/0x1540 kernel/workqueue.c:3310 worker_thread+0x727/0xb10 kernel/workqueue.c:3391 kthread+0x2e0/0x380 kernel/kthread.c:389 ret_from_fork+0x32/0x60 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 -> #2 (&q->q_usage_counter(io)){++++}-{0:0}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 bio_queue_enter block/blk.h:75 [inline] blk_mq_submit_bio+0x3d0/0x1a00 block/blk-mq.c:3069 __submit_bio+0x1cc/0x410 block/blk-core.c:629 __submit_bio_noacct_mq block/blk-core.c:710 [inline] submit_bio_noacct_nocheck+0x422/0xdf0 block/blk-core.c:739 ext4_io_submit fs/ext4/page-io.c:377 [inline] io_submit_add_bh fs/ext4/page-io.c:418 [inline] ext4_bio_write_folio+0xd33/0x1540 fs/ext4/page-io.c:560 mpage_submit_folio+0x142/0x1a0 fs/ext4/inode.c:1921 mpage_map_and_submit_buffers fs/ext4/inode.c:2167 [inline] mpage_map_and_submit_extent fs/ext4/inode.c:2299 [inline] ext4_do_writepages+0x19ab/0x3090 fs/ext4/inode.c:2724 ext4_writepages+0x201/0x380 fs/ext4/inode.c:2813 do_writepages+0x357/0x880 mm/page-writeback.c:2683 __writeback_single_inode+0xf9/0xbe0 fs/fs-writeback.c:1658 writeback_sb_inodes+0x678/0x1020 fs/fs-writeback.c:1954 __writeback_inodes_wb+0x11c/0x1e0 fs/fs-writeback.c:2025 wb_writeback+0x366/0x800 fs/fs-writeback.c:2136 wb_check_background_flush fs/fs-writeback.c:2206 [inline] wb_do_writeback fs/fs-writeback.c:2294 [inline] wb_workfn+0xac5/0xec0 fs/fs-writeback.c:2321 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0x96c/0x1540 kernel/workqueue.c:3310 worker_thread+0x727/0xb10 kernel/workqueue.c:3391 kthread+0x2e0/0x380 kernel/kthread.c:389 ret_from_fork+0x32/0x60 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 -> #1 (jbd2_handle){++++}-{0:0}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 start_this_handle+0x1b1b/0x1d80 fs/jbd2/transaction.c:448 jbd2__journal_start+0x2a5/0x580 fs/jbd2/transaction.c:505 __ext4_journal_start_sb+0x182/0x410 fs/ext4/ext4_jbd2.c:112 __ext4_journal_start fs/ext4/ext4_jbd2.h:326 [inline] ext4_dirty_inode+0x8d/0x100 fs/ext4/inode.c:5981 __mark_inode_dirty+0x227/0xa30 fs/fs-writeback.c:2493 generic_update_time fs/inode.c:2043 [inline] inode_update_time fs/inode.c:2056 [inline] touch_atime+0x2e3/0x4e0 fs/inode.c:2128 file_accessed include/linux/fs.h:2528 [inline] ext4_file_mmap+0x13f/0x460 fs/ext4/file.c:797 call_mmap include/linux/fs.h:2172 [inline] mmap_region+0x1136/0x2250 mm/mmap.c:1447 do_mmap+0x708/0xc80 mm/mmap.c:496 vm_mmap_pgoff+0x202/0x350 mm/util.c:588 ksys_mmap_pgoff+0x41e/0x610 mm/mmap.c:542 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x210 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&mm->mmap_lock){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 __might_fault+0xab/0x100 mm/memory.c:6705 _inline_copy_from_user include/linux/uaccess.h:161 [inline] _copy_from_user+0x25/0xa0 lib/usercopy.c:18 copy_from_user include/linux/uaccess.h:203 [inline] __blk_trace_setup kernel/trace/blktrace.c:626 [inline] blk_trace_setup+0xc7/0x190 kernel/trace/blktrace.c:648 sg_ioctl_common drivers/scsi/sg.c:1121 [inline] sg_ioctl+0xafd/0x2b40 drivers/scsi/sg.c:1163 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl+0xa8/0xf0 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x210 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Chain exists of: &mm->mmap_lock --> &q->q_usage_counter(io) --> &q->debugfs_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&q->debugfs_mutex); lock(&q->q_usage_counter(io)); lock(&q->debugfs_mutex); rlock(&mm->mmap_lock); *** DEADLOCK *** 1 lock held by syz.3.15/3109: #0: ffff888103f3c278 (&q->debugfs_mutex){+.+.}-{3:3}, at: blk_trace_setup+0xa8/0x190 kernel/trace/blktrace.c:647 stack backtrace: CPU: 0 UID: 0 PID: 3109 Comm: syz.3.15 Not tainted 6.12.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x198/0x250 lib/dump_stack.c:120 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 __might_fault+0xab/0x100 mm/memory.c:6705 _inline_copy_from_user include/linux/uaccess.h:161 [inline] _copy_from_user+0x25/0xa0 lib/usercopy.c:18 copy_from_user include/linux/uaccess.h:203 [inline] __blk_trace_setup kernel/trace/blktrace.c:626 [inline] blk_trace_setup+0xc7/0x190 kernel/trace/blktrace.c:648 sg_ioctl_common drivers/scsi/sg.c:1121 [inline] sg_ioctl+0xafd/0x2b40 drivers/scsi/sg.c:1163 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl+0xa8/0xf0 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x210 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f11b677e719 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f11b74df038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f11b6935f80 RCX: 00007f11b677e719 RDX: 0000000000000000 RSI: 00000000c0481273 RDI: 0000000000000003 RBP: 00007f11b67f139e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f11b6935f80 R15: 00007ffde84963e8