====================================================== WARNING: possible circular locking dependency detected 6.13.0-rc3-syzkaller-00301-gbcde95ce32b6 #0 Not tainted ------------------------------------------------------ syz-executor/20734 is trying to acquire lock: ffff888056caa040 (&ei->i_data_sem/3){++++}-{4:4}, at: ext4_map_blocks+0x2a7/0x1370 fs/ext4/inode.c:665 but task is already holding lock: ffff88814e53c958 (jbd2_handle){++++}-{0:0}, at: start_this_handle+0xf6c/0x1430 fs/jbd2/transaction.c:448 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #7 (jbd2_handle){++++}-{0:0}: start_this_handle+0xf92/0x1430 fs/jbd2/transaction.c:448 jbd2__journal_start+0x394/0x6a0 fs/jbd2/transaction.c:505 __ext4_journal_start_sb+0x19f/0x660 fs/ext4/ext4_jbd2.c:112 __ext4_journal_start fs/ext4/ext4_jbd2.h:326 [inline] ext4_dirty_inode+0xa1/0x130 fs/ext4/inode.c:6038 __mark_inode_dirty+0x1ef/0xe50 fs/fs-writeback.c:2515 generic_update_time+0xcf/0xf0 fs/inode.c:2112 inode_update_time fs/inode.c:2125 [inline] touch_atime+0x4ee/0x5d0 fs/inode.c:2197 file_accessed include/linux/fs.h:2539 [inline] ext4_file_mmap+0x4fc/0x6b0 fs/ext4/file.c:816 call_mmap include/linux/fs.h:2183 [inline] mmap_file mm/internal.h:124 [inline] __mmap_new_file_vma mm/vma.c:2291 [inline] __mmap_new_vma mm/vma.c:2355 [inline] __mmap_region+0x1826/0x2760 mm/vma.c:2456 mmap_region+0x270/0x320 mm/mmap.c:1348 do_mmap+0xc00/0xfc0 mm/mmap.c:496 vm_mmap_pgoff+0x1ba/0x360 mm/util.c:580 ksys_mmap_pgoff+0x32c/0x5c0 mm/mmap.c:542 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:89 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:82 [inline] __x64_sys_mmap+0x125/0x190 arch/x86/kernel/sys_x86_64.c:82 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 -> #6 (&mm->mmap_lock){++++}-{4:4}: __might_fault mm/memory.c:6751 [inline] __might_fault+0x11b/0x190 mm/memory.c:6744 _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_ioctl+0x163/0x290 kernel/trace/blktrace.c:740 blkdev_ioctl+0x109/0x6d0 block/ioctl.c:682 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+0x193/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 -> #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+0x241/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+0x15a/0x1e0 drivers/base/bus.c:459 __device_attach_async_helper+0x1d3/0x290 drivers/base/dd.c:987 async_run_entry_fn+0x9f/0x530 kernel/async.c:129 process_one_work+0x9c8/0x1ba0 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391 kthread+0x2c4/0x3a0 kernel/kthread.c:389 ret_from_fork+0x48/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)#50){++++}-{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+0x241/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+0x15a/0x1e0 drivers/base/bus.c:459 __device_attach_async_helper+0x1d3/0x290 drivers/base/dd.c:987 async_run_entry_fn+0x9f/0x530 kernel/async.c:129 process_one_work+0x9c8/0x1ba0 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391 kthread+0x2c4/0x3a0 kernel/kthread.c:389 ret_from_fork+0x48/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:947 [inline] loop_reconfigure_limits+0x407/0x8c0 drivers/block/loop.c:998 loop_set_block_size drivers/block/loop.c:1473 [inline] lo_simple_ioctl drivers/block/loop.c:1496 [inline] lo_ioctl+0x901/0x18b0 drivers/block/loop.c:1559 blkdev_ioctl+0x279/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+0x193/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)#24){++++}-{0:0}: bio_queue_enter block/blk.h:75 [inline] blk_mq_submit_bio+0x1fb6/0x24c0 block/blk-mq.c:3090 __submit_bio+0x384/0x540 block/blk-core.c:629 __submit_bio_noacct_mq block/blk-core.c:710 [inline] submit_bio_noacct_nocheck+0x698/0xd70 block/blk-core.c:739 submit_bio_noacct+0x93a/0x1e20 block/blk-core.c:868 __ext4_read_bh fs/ext4/super.c:181 [inline] ext4_read_bh_nowait+0x199/0x250 fs/ext4/super.c:193 ext4_read_block_bitmap_nowait+0xeac/0x1810 fs/ext4/balloc.c:551 ext4_mb_prefetch+0x292/0x370 fs/ext4/mballoc.c:2749 ext4_mb_regular_allocator+0x18d8/0x3f90 fs/ext4/mballoc.c:2898 ext4_mb_new_blocks+0x287f/0x4e30 fs/ext4/mballoc.c:6217 ext4_ext_map_blocks+0x1b80/0x5aa0 fs/ext4/extents.c:4379 ext4_map_create_blocks fs/ext4/inode.c:516 [inline] ext4_map_blocks+0x457/0x1370 fs/ext4/inode.c:702 _ext4_get_block+0x250/0x5a0 fs/ext4/inode.c:781 ext4_get_block_unwritten+0x29/0x110 fs/ext4/inode.c:814 ext4_block_write_begin+0x3f4/0xf20 fs/ext4/inode.c:1063 ext4_write_begin+0x5ed/0x1140 fs/ext4/inode.c:1217 ext4_da_write_begin+0x219/0x8f0 fs/ext4/inode.c:2925 generic_perform_write+0x2bd/0x920 mm/filemap.c:4055 ext4_buffered_write_iter+0x119/0x3c0 fs/ext4/file.c:299 ext4_file_write_iter+0x9e1/0x1be0 fs/ext4/file.c:717 do_iter_readv_writev+0x535/0x7f0 fs/read_write.c:820 vfs_writev+0x363/0xdd0 fs/read_write.c:1050 do_pwritev+0x1b1/0x270 fs/read_write.c:1146 __do_sys_pwritev2 fs/read_write.c:1204 [inline] __se_sys_pwritev2 fs/read_write.c:1195 [inline] __x64_sys_pwritev2+0xef/0x160 fs/read_write.c:1195 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 (&lg->lg_mutex){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:585 [inline] __mutex_lock+0x19b/0xa60 kernel/locking/mutex.c:735 ext4_mb_group_or_file fs/ext4/mballoc.c:5786 [inline] ext4_mb_initialize_context+0x814/0xdf0 fs/ext4/mballoc.c:5830 ext4_mb_new_blocks+0x963/0x4e30 fs/ext4/mballoc.c:6204 ext4_alloc_branch fs/ext4/indirect.c:340 [inline] ext4_ind_map_blocks+0x1941/0x28d0 fs/ext4/indirect.c:635 ext4_map_create_blocks fs/ext4/inode.c:518 [inline] ext4_map_blocks+0x6c8/0x1370 fs/ext4/inode.c:702 ext4_xattr_inode_write fs/ext4/xattr.c:1400 [inline] ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1602 [inline] ext4_xattr_inode_lookup_create+0xe6b/0x1aa0 fs/ext4/xattr.c:1574 ext4_xattr_ibody_set+0x1d9/0x5b0 fs/ext4/xattr.c:2269 ext4_xattr_set_handle+0x939/0x1420 fs/ext4/xattr.c:2446 ext4_xattr_set+0x14b/0x360 fs/ext4/xattr.c:2560 __vfs_setxattr+0x176/0x1e0 fs/xattr.c:200 __vfs_setxattr_noperm+0x127/0x660 fs/xattr.c:234 __vfs_setxattr_locked+0x182/0x260 fs/xattr.c:295 vfs_setxattr+0x146/0x360 fs/xattr.c:321 do_setxattr+0x142/0x170 fs/xattr.c:636 filename_setxattr+0x16d/0x1d0 fs/xattr.c:665 path_setxattrat+0x1e0/0x290 fs/xattr.c:713 __do_sys_lsetxattr fs/xattr.c:754 [inline] __se_sys_lsetxattr fs/xattr.c:750 [inline] __x64_sys_lsetxattr+0xc9/0x140 fs/xattr.c:750 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 (&ei->i_data_sem/3){++++}-{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 down_read+0x9a/0x330 kernel/locking/rwsem.c:1524 ext4_map_blocks+0x2a7/0x1370 fs/ext4/inode.c:665 ext4_append+0x1fb/0x560 fs/ext4/namei.c:75 ext4_init_new_dir+0x220/0x4c0 fs/ext4/namei.c:2988 ext4_mkdir+0x315/0xb70 fs/ext4/namei.c:3034 vfs_mkdir+0x580/0x860 fs/namei.c:4311 do_mkdirat+0x301/0x3a0 fs/namei.c:4334 __do_sys_mkdirat fs/namei.c:4349 [inline] __se_sys_mkdirat fs/namei.c:4347 [inline] __x64_sys_mkdirat+0x83/0xb0 fs/namei.c:4347 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: &ei->i_data_sem/3 --> &mm->mmap_lock --> jbd2_handle Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(jbd2_handle); lock(&mm->mmap_lock); lock(jbd2_handle); rlock(&ei->i_data_sem/3); *** DEADLOCK *** 3 locks held by syz-executor/20734: #0: ffff88814e538420 (sb_writers#4){.+.+}-{0:0}, at: filename_create+0x10d/0x530 fs/namei.c:4073 #1: ffff888056cad338 (&type->i_mutex_dir_key#3/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:853 [inline] #1: ffff888056cad338 (&type->i_mutex_dir_key#3/1){+.+.}-{4:4}, at: filename_create+0x1c2/0x530 fs/namei.c:4080 #2: ffff88814e53c958 (jbd2_handle){++++}-{0:0}, at: start_this_handle+0xf6c/0x1430 fs/jbd2/transaction.c:448 stack backtrace: CPU: 1 UID: 0 PID: 20734 Comm: syz-executor Not tainted 6.13.0-rc3-syzkaller-00301-gbcde95ce32b6 #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+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 down_read+0x9a/0x330 kernel/locking/rwsem.c:1524 ext4_map_blocks+0x2a7/0x1370 fs/ext4/inode.c:665 ext4_append+0x1fb/0x560 fs/ext4/namei.c:75 ext4_init_new_dir+0x220/0x4c0 fs/ext4/namei.c:2988 ext4_mkdir+0x315/0xb70 fs/ext4/namei.c:3034 vfs_mkdir+0x580/0x860 fs/namei.c:4311 do_mkdirat+0x301/0x3a0 fs/namei.c:4334 __do_sys_mkdirat fs/namei.c:4349 [inline] __se_sys_mkdirat fs/namei.c:4347 [inline] __x64_sys_mkdirat+0x83/0xb0 fs/namei.c:4347 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:0x7f0fae184597 Code: 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 02 01 00 00 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:00007ffd6e025298 EFLAGS: 00000206 ORIG_RAX: 0000000000000102 RAX: ffffffffffffffda RBX: 00007f0fae201e80 RCX: 00007f0fae184597 RDX: 00000000000001ff RSI: 00007f0fae201e80 RDI: 00000000ffffff9c RBP: 00007f0fae376738 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000008 R13: 0000000000000003 R14: 0000000000000009 R15: 0000000000000000