======================================================
WARNING: possible circular locking dependency detected
6.12.0-syzkaller-01892-g8f7c8b88bda4 #0 Not tainted
------------------------------------------------------
syz.7.496/8591 is trying to acquire lock:
ffff8880321b9f20 (&mm->mmap_lock){++++}-{4:4}, at: __might_fault mm/memory.c:6716 [inline]
ffff8880321b9f20 (&mm->mmap_lock){++++}-{4:4}, at: __might_fault+0xe3/0x190 mm/memory.c:6709
but task is already holding lock:
ffff88802565fe78 (&q->debugfs_mutex){+.+.}-{4:4}, at: blk_trace_setup+0x33/0x70 kernel/trace/blktrace.c:647
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #5 (&q->debugfs_mutex){+.+.}-{4:4}:
__mutex_lock_common kernel/locking/mutex.c:585 [inline]
__mutex_lock+0x19b/0xa60 kernel/locking/mutex.c:735
blk_mq_init_sched+0x42b/0x640 block/blk-mq-sched.c:473
elevator_init_mq+0x2cd/0x420 block/elevator.c:610
add_disk_fwnode+0x113/0x1300 block/genhd.c:413
sd_probe+0xa86/0x1000 drivers/scsi/sd.c:4024
call_driver_probe drivers/base/dd.c:579 [inline]
really_probe+0x23e/0xa90 drivers/base/dd.c:658
__driver_probe_device+0x1de/0x440 drivers/base/dd.c:800
driver_probe_device+0x4c/0x1b0 drivers/base/dd.c:830
__device_attach_driver+0x1df/0x310 drivers/base/dd.c:958
bus_for_each_drv+0x157/0x1e0 drivers/base/bus.c:459
__device_attach_async_helper+0x1d3/0x290 drivers/base/dd.c:987
async_run_entry_fn+0x9c/0x530 kernel/async.c:129
process_one_work+0x9c5/0x1ba0 kernel/workqueue.c:3229
process_scheduled_works kernel/workqueue.c:3310 [inline]
worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391
kthread+0x2c1/0x3a0 kernel/kthread.c:389
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
-> #4 (&q->q_usage_counter(queue)#51){++++}-{0:0}:
blk_queue_enter+0x50f/0x640 block/blk-core.c:328
blk_mq_alloc_request+0x59b/0x950 block/blk-mq.c:652
scsi_alloc_request drivers/scsi/scsi_lib.c:1222 [inline]
scsi_execute_cmd+0x1eb/0xf40 drivers/scsi/scsi_lib.c:304
read_capacity_16+0x213/0xe10 drivers/scsi/sd.c:2655
sd_read_capacity drivers/scsi/sd.c:2824 [inline]
sd_revalidate_disk.isra.0+0x1a06/0xa8d0 drivers/scsi/sd.c:3734
sd_probe+0x904/0x1000 drivers/scsi/sd.c:4010
call_driver_probe drivers/base/dd.c:579 [inline]
really_probe+0x23e/0xa90 drivers/base/dd.c:658
__driver_probe_device+0x1de/0x440 drivers/base/dd.c:800
driver_probe_device+0x4c/0x1b0 drivers/base/dd.c:830
__device_attach_driver+0x1df/0x310 drivers/base/dd.c:958
bus_for_each_drv+0x157/0x1e0 drivers/base/bus.c:459
__device_attach_async_helper+0x1d3/0x290 drivers/base/dd.c:987
async_run_entry_fn+0x9c/0x530 kernel/async.c:129
process_one_work+0x9c5/0x1ba0 kernel/workqueue.c:3229
process_scheduled_works kernel/workqueue.c:3310 [inline]
worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391
kthread+0x2c1/0x3a0 kernel/kthread.c:389
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
-> #3 (&q->limits_lock){+.+.}-{4:4}:
__mutex_lock_common kernel/locking/mutex.c:585 [inline]
__mutex_lock+0x19b/0xa60 kernel/locking/mutex.c:735
queue_limits_start_update include/linux/blkdev.h:945 [inline]
__nbd_set_size+0x2c0/0x730 drivers/block/nbd.c:351
nbd_set_size drivers/block/nbd.c:388 [inline]
nbd_start_device+0x8fd/0xd70 drivers/block/nbd.c:1456
nbd_start_device_ioctl drivers/block/nbd.c:1464 [inline]
__nbd_ioctl drivers/block/nbd.c:1539 [inline]
nbd_ioctl+0x21a/0xfd0 drivers/block/nbd.c:1579
blkdev_ioctl+0x276/0x6d0 block/ioctl.c:693
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:906 [inline]
__se_sys_ioctl fs/ioctl.c:892 [inline]
__x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #2 (&q->q_usage_counter(io)#57){++++}-{0:0}:
bio_queue_enter block/blk.h:75 [inline]
blk_mq_submit_bio+0x1fc4/0x24c0 block/blk-mq.c:3092
__submit_bio+0x384/0x540 block/blk-core.c:629
__submit_bio_noacct_mq block/blk-core.c:710 [inline]
submit_bio_noacct_nocheck+0x6fb/0xd70 block/blk-core.c:739
submit_bio_noacct+0x93a/0x1e10 block/blk-core.c:868
submit_bh fs/buffer.c:2825 [inline]
block_read_full_folio+0x812/0xa50 fs/buffer.c:2452
filemap_read_folio+0xc6/0x2a0 mm/filemap.c:2367
filemap_update_page mm/filemap.c:2451 [inline]
filemap_get_pages+0x1560/0x1be0 mm/filemap.c:2572
filemap_read+0x3ca/0xd70 mm/filemap.c:2647
blkdev_read_iter+0x187/0x480 block/fops.c:767
new_sync_read fs/read_write.c:484 [inline]
vfs_read+0x87f/0xbe0 fs/read_write.c:565
ksys_read+0x12b/0x250 fs/read_write.c:708
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #1 (mapping.invalidate_lock#2){++++}-{4:4}:
down_read+0x9a/0x330 kernel/locking/rwsem.c:1524
filemap_invalidate_lock_shared include/linux/fs.h:873 [inline]
filemap_fault+0x62e/0x2820 mm/filemap.c:3352
__do_fault+0x10a/0x490 mm/memory.c:4882
do_read_fault mm/memory.c:5297 [inline]
do_fault mm/memory.c:5431 [inline]
do_pte_missing+0xec5/0x3e70 mm/memory.c:3965
handle_pte_fault mm/memory.c:5766 [inline]
__handle_mm_fault+0x100a/0x2a10 mm/memory.c:5909
handle_mm_fault+0x3fa/0xaa0 mm/memory.c:6077
faultin_page mm/gup.c:1187 [inline]
__get_user_pages+0x8d9/0x3b50 mm/gup.c:1485
populate_vma_page_range+0x27f/0x3a0 mm/gup.c:1923
__mm_populate+0x1d6/0x380 mm/gup.c:2026
do_mlock+0x40a/0x7d0 mm/mlock.c:653
__do_sys_mlock mm/mlock.c:661 [inline]
__se_sys_mlock mm/mlock.c:659 [inline]
__x64_sys_mlock+0x59/0x80 mm/mlock.c:659
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (&mm->mmap_lock){++++}-{4:4}:
check_prev_add kernel/locking/lockdep.c:3161 [inline]
check_prevs_add kernel/locking/lockdep.c:3280 [inline]
validate_chain kernel/locking/lockdep.c:3904 [inline]
__lock_acquire+0x249e/0x3c40 kernel/locking/lockdep.c:5226
lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5849
__might_fault mm/memory.c:6716 [inline]
__might_fault+0x11b/0x190 mm/memory.c:6709
_inline_copy_from_user include/linux/uaccess.h:162 [inline]
_copy_from_user+0x29/0xd0 lib/usercopy.c:18
copy_from_user include/linux/uaccess.h:212 [inline]
__blk_trace_setup+0xa8/0x180 kernel/trace/blktrace.c:626
blk_trace_setup+0x47/0x70 kernel/trace/blktrace.c:648
sg_ioctl_common drivers/scsi/sg.c:1121 [inline]
sg_ioctl+0x65e/0x2750 drivers/scsi/sg.c:1163
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:906 [inline]
__se_sys_ioctl fs/ioctl.c:892 [inline]
__x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 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(queue)#51 --> &q->debugfs_mutex
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&q->debugfs_mutex);
lock(&q->q_usage_counter(queue)#51);
lock(&q->debugfs_mutex);
rlock(&mm->mmap_lock);
*** DEADLOCK ***
1 lock held by syz.7.496/8591:
#0: ffff88802565fe78 (&q->debugfs_mutex){+.+.}-{4:4}, at: blk_trace_setup+0x33/0x70 kernel/trace/blktrace.c:647
stack backtrace:
CPU: 1 UID: 0 PID: 8591 Comm: syz.7.496 Not tainted 6.12.0-syzkaller-01892-g8f7c8b88bda4 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
print_circular_bug+0x419/0x5d0 kernel/locking/lockdep.c:2074
check_noncircular+0x31a/0x400 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 kernel/locking/lockdep.c:3904 [inline]
__lock_acquire+0x249e/0x3c40 kernel/locking/lockdep.c:5226
lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5849
__might_fault mm/memory.c:6716 [inline]
__might_fault+0x11b/0x190 mm/memory.c:6709
_inline_copy_from_user include/linux/uaccess.h:162 [inline]
_copy_from_user+0x29/0xd0 lib/usercopy.c:18
copy_from_user include/linux/uaccess.h:212 [inline]
__blk_trace_setup+0xa8/0x180 kernel/trace/blktrace.c:626
blk_trace_setup+0x47/0x70 kernel/trace/blktrace.c:648
sg_ioctl_common drivers/scsi/sg.c:1121 [inline]
sg_ioctl+0x65e/0x2750 drivers/scsi/sg.c:1163
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:906 [inline]
__se_sys_ioctl fs/ioctl.c:892 [inline]
__x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f6d6277e819
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:00007f6d635ae038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f6d62935fa0 RCX: 00007f6d6277e819
RDX: 0000000020000540 RSI: 00000000c0481273 RDI: 0000000000000003
RBP: 00007f6d627f175e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f6d62935fa0 R15: 00007fff91121f08
syz.7.496: page allocation failure: order:0, mode:0xcc0(GFP_KERNEL), nodemask=(null),cpuset=/,mems_allowed=0-1
CPU: 1 UID: 0 PID: 8591 Comm: syz.7.496 Not tainted 6.12.0-syzkaller-01892-g8f7c8b88bda4 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x16c/0x1f0 lib/dump_stack.c:120
warn_alloc+0x24d/0x3a0 mm/page_alloc.c:3548
__alloc_pages_slowpath mm/page_alloc.c:4482 [inline]
__alloc_pages_noprof+0x159c/0x25a0 mm/page_alloc.c:4764
alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265
get_free_pages_noprof+0xc/0x40 mm/page_alloc.c:4798
kasan_populate_vmalloc_pte+0x2d/0x160 mm/kasan/shadow.c:304
apply_to_pte_range mm/memory.c:2817 [inline]
apply_to_pmd_range mm/memory.c:2861 [inline]
apply_to_pud_range mm/memory.c:2897 [inline]
apply_to_p4d_range mm/memory.c:2933 [inline]
__apply_to_page_range+0x5fd/0xd30 mm/memory.c:2967
alloc_vmap_area+0x93e/0x2a70 mm/vmalloc.c:2035
__get_vm_area_node+0x17e/0x2d0 mm/vmalloc.c:3116
get_vm_area_caller mm/vmalloc.c:3167 [inline]
vmap+0x15a/0x350 mm/vmalloc.c:3436
relay_alloc_buf kernel/relay.c:126 [inline]
relay_create_buf kernel/relay.c:162 [inline]
relay_open_buf.part.0+0x446/0xb90 kernel/relay.c:384
relay_open_buf kernel/relay.c:536 [inline]
relay_open+0x653/0xad0 kernel/relay.c:517
do_blk_trace_setup+0x4fd/0xb40 kernel/trace/blktrace.c:590
__blk_trace_setup+0xd8/0x180 kernel/trace/blktrace.c:630
blk_trace_setup+0x47/0x70 kernel/trace/blktrace.c:648
sg_ioctl_common drivers/scsi/sg.c:1121 [inline]
sg_ioctl+0x65e/0x2750 drivers/scsi/sg.c:1163
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:906 [inline]
__se_sys_ioctl fs/ioctl.c:892 [inline]
__x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f6d6277e819
Code: Unable to access opcode bytes at 0x7f6d6277e7ef.
RSP: 002b:00007f6d635ae038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f6d62935fa0 RCX: 00007f6d6277e819
RDX: 0000000020000540 RSI: 00000000c0481273 RDI: 0000000000000003
RBP: 00007f6d627f175e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f6d62935fa0 R15: 00007fff91121f08
Mem-Info:
active_anon:17 inactive_anon:0 isolated_anon:0
active_file:3 inactive_file:146 isolated_file:0
unevictable:1768 dirty:116 writeback:0
slab_reclaimable:10400 slab_unreclaimable:81854
mapped:5164 shmem:1767 pagetables:377
sec_pagetables:323 bounce:0
kernel_misc_reclaimable:0
free:5890 free_pcp:5483 free_cma:0
Node 0 active_anon:0kB inactive_anon:0kB active_file:192kB inactive_file:304kB unevictable:3536kB isolated(anon):0kB isolated(file):0kB mapped:20556kB dirty:464kB writeback:0kB shmem:3536kB shmem_thp:0kB shmem_pmdmapped:0kB anon_thp:0kB writeback_tmp:0kB kernel_stack:12304kB pagetables:1468kB sec_pagetables:1280kB all_unreclaimable? yes
Node 1 active_anon:68kB inactive_anon:0kB active_file:100kB inactive_file:0kB unevictable:3536kB isolated(anon):0kB isolated(file):0kB mapped:100kB dirty:0kB writeback:0kB shmem:3532kB shmem_thp:0kB shmem_pmdmapped:0kB anon_thp:0kB writeback_tmp:0kB kernel_stack:80kB pagetables:40kB sec_pagetables:12kB all_unreclaimable? yes
Node 0
DMA free:120kB boost:0kB min:340kB low:424kB high:508kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15992kB managed:15360kB mlocked:0kB bounce:0kB free_pcp:100kB local_pcp:0kB free_cma:0kB
lowmem_reserve[]:
0 1212
0
0
0
Node 0
DMA32 free:10928kB boost:14336kB min:41944kB low:48844kB high:55744kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB active_file:148kB inactive_file:348kB unevictable:3536kB writepending:464kB present:2080628kB managed:1269888kB mlocked:0kB bounce:0kB free_pcp:9472kB local_pcp:64kB free_cma:0kB
lowmem_reserve[]: 0
0
0
0 0
Node 1
Normal free:13068kB boost:0kB min:39632kB low:49540kB high:59448kB reserved_highatomic:0KB active_anon:68kB inactive_anon:0kB active_file:100kB inactive_file:0kB unevictable:3536kB writepending:0kB present:2097152kB managed:1781924kB mlocked:0kB bounce:0kB free_pcp:12336kB local_pcp:8kB free_cma:0kB
lowmem_reserve[]: 0
0
0
0 0
Node 0
DMA:
0*4kB
1*8kB
(U)
1*16kB
(U) 1*32kB
(U) 1*64kB
(U)
0*128kB
0*256kB
0*512kB
0*1024kB
0*2048kB
0*4096kB
= 120kB
Node 0 DMA32:
14*4kB
(UME) 69*8kB
(UME) 27*16kB
(UME)
59*32kB
(UME) 37*64kB
(UME)
18*128kB
(UME)
5*256kB
(M) 4*512kB
(UM) 0*1024kB
0*2048kB 0*4096kB
= 10928kB
Node 1
Normal:
6*4kB
(UME)
9*8kB
(UME)
7*16kB
(UM)
9*32kB
(UME)
10*64kB
(ME) 4*128kB
(ME)
3*256kB (UME) 3*512kB (ME) 1*1024kB
(U)
2*2048kB
(UM)
1*4096kB
(M)
= 13168kB
Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB
Node 0 hugepages_total=2 hugepages_free=2 hugepages_surp=0 hugepages_size=2048kB
Node 1 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB
Node 1 hugepages_total=2 hugepages_free=2 hugepages_surp=0 hugepages_size=2048kB
1909 total pagecache pages
0 pages in swap cache
Free swap = 110044kB
Total swap = 124996kB
1048443 pages RAM
0 pages HighMem/MovableOnly
281650 pages reserved
0 pages cma reserved