====================================================== WARNING: possible circular locking dependency detected 5.15.175-syzkaller #0 Not tainted ------------------------------------------------------ syz.0.1772/8977 is trying to acquire lock: ffff8880713b22e0 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_read_virt_blocks+0x2b3/0xa10 fs/ocfs2/extent_map.c:976 but task is already holding lock: ffff88802a4f8990 (jbd2_handle){++++}-{0:0}, at: start_this_handle+0x12b9/0x1570 fs/jbd2/transaction.c:462 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (jbd2_handle){++++}-{0:0} : lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 start_this_handle+0x12e1/0x1570 fs/jbd2/transaction.c:464 jbd2__journal_start+0x2d1/0x5c0 fs/jbd2/transaction.c:521 __ext4_journal_start_sb+0x175/0x370 fs/ext4/ext4_jbd2.c:105 __ext4_journal_start fs/ext4/ext4_jbd2.h:326 [inline] ext4_dirty_inode+0x8b/0x100 fs/ext4/inode.c:6007 __mark_inode_dirty+0x2fd/0xd60 fs/fs-writeback.c:2464 generic_update_time fs/inode.c:1856 [inline] inode_update_time fs/inode.c:1869 [inline] touch_atime+0x3fa/0x680 fs/inode.c:1941 file_accessed include/linux/fs.h:2523 [inline] ext4_file_mmap+0x18e/0x370 fs/ext4/file.c:763 call_mmap include/linux/fs.h:2179 [inline] mmap_file+0x5a/0xb0 mm/util.c:1092 __mmap_region mm/mmap.c:1784 [inline] mmap_region+0x1035/0x1870 mm/mmap.c:2921 do_mmap+0x78d/0xe00 mm/mmap.c:1574 vm_mmap_pgoff+0x1ca/0x2d0 mm/util.c:551 ksys_mmap_pgoff+0x559/0x780 mm/mmap.c:1623 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #1 (&mm->mmap_lock){++++}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __might_fault+0xb4/0x110 mm/memory.c:5355 _copy_to_user+0x28/0x130 lib/usercopy.c:35 copy_to_user include/linux/uaccess.h:200 [inline] fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144 ocfs2_fiemap_inline fs/ocfs2/extent_map.c:725 [inline] ocfs2_fiemap+0xc1d/0xf80 fs/ocfs2/extent_map.c:762 ioctl_fiemap fs/ioctl.c:219 [inline] do_vfs_ioctl+0x1934/0x2b70 fs/ioctl.c:814 __do_sys_ioctl fs/ioctl.c:872 [inline] __se_sys_ioctl+0x81/0x160 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #0 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 down_read+0x45/0x2e0 kernel/locking/rwsem.c:1498 ocfs2_read_virt_blocks+0x2b3/0xa10 fs/ocfs2/extent_map.c:976 ocfs2_read_dir_block+0x102/0x5b0 fs/ocfs2/dir.c:508 ocfs2_dir_foreach_blk_el fs/ocfs2/dir.c:1829 [inline] ocfs2_dir_foreach_blk+0x2a8/0x1ba0 fs/ocfs2/dir.c:1915 ocfs2_dir_foreach fs/ocfs2/dir.c:1925 [inline] ocfs2_empty_dir+0x1d1/0x8c0 fs/ocfs2/dir.c:2139 ocfs2_rename+0x25d5/0x3ea0 fs/ocfs2/namei.c:1499 vfs_rename+0xd32/0x10f0 fs/namei.c:4832 do_renameat2+0xe0f/0x1700 fs/namei.c:4985 __do_sys_rename fs/namei.c:5031 [inline] __se_sys_rename fs/namei.c:5029 [inline] __x64_sys_rename+0x82/0x90 fs/namei.c:5029 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 other info that might help us debug this: Chain exists of: &ocfs2_file_ip_alloc_sem_key --> &mm->mmap_lock --> jbd2_handle Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(jbd2_handle); lock(&mm->mmap_lock); lock(jbd2_handle); lock(&ocfs2_file_ip_alloc_sem_key); *** DEADLOCK *** 7 locks held by syz.0.1772/8977: #0: ffff88807e34e460 (sb_writers#34){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:377 #1: ffff8880712e5108 (&type->i_mutex_dir_key#23/1){+.+.}-{3:3}, at: do_renameat2+0x67e/0x1700 fs/namei.c:4924 #2: ffff8880713b2648 (&sb->s_type->i_mutex_key#39){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline] #2: ffff8880713b2648 (&sb->s_type->i_mutex_key#39){+.+.}-{3:3}, at: vfs_rename+0x814/0x10f0 fs/namei.c:4797 #3: ffff8880712e6d88 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline] #3: ffff8880712e6d88 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]){+.+.}-{3:3}, at: ocfs2_lookup_lock_orphan_dir+0xfe/0x340 fs/ocfs2/namei.c:2116 #4: ffff88807e34e650 (sb_internal#4){.+.+}-{0:0}, at: ocfs2_rename+0x1e36/0x3ea0 fs/ocfs2/namei.c:1488 #5: ffff888060f20ce8 (&journal->j_trans_barrier){.+.+}-{3:3}, at: ocfs2_start_trans+0x3b7/0x6f0 fs/ocfs2/journal.c:352 #6: ffff88802a4f8990 (jbd2_handle){++++}-{0:0}, at: start_this_handle+0x12b9/0x1570 fs/jbd2/transaction.c:462 stack backtrace: CPU: 1 PID: 8977 Comm: syz.0.1772 Not tainted 5.15.175-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 down_read+0x45/0x2e0 kernel/locking/rwsem.c:1498 ocfs2_read_virt_blocks+0x2b3/0xa10 fs/ocfs2/extent_map.c:976 ocfs2_read_dir_block+0x102/0x5b0 fs/ocfs2/dir.c:508 ocfs2_dir_foreach_blk_el fs/ocfs2/dir.c:1829 [inline] ocfs2_dir_foreach_blk+0x2a8/0x1ba0 fs/ocfs2/dir.c:1915 ocfs2_dir_foreach fs/ocfs2/dir.c:1925 [inline] ocfs2_empty_dir+0x1d1/0x8c0 fs/ocfs2/dir.c:2139 ocfs2_rename+0x25d5/0x3ea0 fs/ocfs2/namei.c:1499 vfs_rename+0xd32/0x10f0 fs/namei.c:4832 do_renameat2+0xe0f/0x1700 fs/namei.c:4985 __do_sys_rename fs/namei.c:5031 [inline] __se_sys_rename fs/namei.c:5029 [inline] __x64_sys_rename+0x82/0x90 fs/namei.c:5029 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7f9af53d0d29 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:00007f9af3241038 EFLAGS: 00000246 ORIG_RAX: 0000000000000052 RAX: ffffffffffffffda RBX: 00007f9af55c0fa0 RCX: 00007f9af53d0d29 RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000020000200 RBP: 00007f9af544caa8 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f9af55c0fa0 R15: 00007ffc8aa151e8