====================================================== WARNING: possible circular locking dependency detected 6.4.0-rc6-next-20230614-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.3/26888 is trying to acquire lock: ffff8880335ae298 (&sb->s_type->i_mutex_key#34){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:768 [inline] ffff8880335ae298 (&sb->s_type->i_mutex_key#34){+.+.}-{3:3}, at: f2fs_file_mmap+0x154/0x290 fs/f2fs/file.c:527 but task is already holding lock: ffff88807e692e68 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:110 [inline] ffff88807e692e68 (&mm->mmap_lock){++++}-{3:3}, at: vm_mmap_pgoff+0x158/0x3b0 mm/util.c:541 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&mm->mmap_lock){++++}-{3:3}: down_read+0x9c/0x480 kernel/locking/rwsem.c:1520 mmap_read_lock include/linux/mmap_lock.h:142 [inline] do_user_addr_fault+0xb3d/0x1210 arch/x86/mm/fault.c:1391 handle_page_fault arch/x86/mm/fault.c:1534 [inline] exc_page_fault+0x98/0x170 arch/x86/mm/fault.c:1590 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 fault_in_readable+0x129/0x210 mm/gup.c:1928 fault_in_iov_iter_readable+0x252/0x2c0 lib/iov_iter.c:216 f2fs_preallocate_blocks fs/f2fs/file.c:4508 [inline] f2fs_file_write_iter+0x516/0x2500 fs/f2fs/file.c:4744 call_write_iter include/linux/fs.h:1865 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x960/0xd70 fs/read_write.c:584 ksys_write+0x122/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (&sb->s_type->i_mutex_key#34){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3142 [inline] check_prevs_add kernel/locking/lockdep.c:3261 [inline] validate_chain kernel/locking/lockdep.c:3876 [inline] __lock_acquire+0x2e9d/0x5e20 kernel/locking/lockdep.c:5144 lock_acquire.part.0+0x11c/0x370 kernel/locking/lockdep.c:5761 down_write+0x92/0x200 kernel/locking/rwsem.c:1573 inode_lock include/linux/fs.h:768 [inline] f2fs_file_mmap+0x154/0x290 fs/f2fs/file.c:527 call_mmap include/linux/fs.h:1870 [inline] mmap_region+0x99c/0x2770 mm/mmap.c:2675 do_mmap+0x850/0xee0 mm/mmap.c:1367 vm_mmap_pgoff+0x1a2/0x3b0 mm/util.c:543 ksys_mmap_pgoff+0x42b/0x5b0 mm/mmap.c:1413 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_lock); lock(&sb->s_type->i_mutex_key#34); lock(&mm->mmap_lock); lock(&sb->s_type->i_mutex_key#34); *** DEADLOCK *** 1 lock held by syz-executor.3/26888: #0: ffff88807e692e68 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:110 [inline] #0: ffff88807e692e68 (&mm->mmap_lock){++++}-{3:3}, at: vm_mmap_pgoff+0x158/0x3b0 mm/util.c:541 stack backtrace: CPU: 1 PID: 26888 Comm: syz-executor.3 Not tainted 6.4.0-rc6-next-20230614-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 check_noncircular+0x2df/0x3b0 kernel/locking/lockdep.c:2195 check_prev_add kernel/locking/lockdep.c:3142 [inline] check_prevs_add kernel/locking/lockdep.c:3261 [inline] validate_chain kernel/locking/lockdep.c:3876 [inline] __lock_acquire+0x2e9d/0x5e20 kernel/locking/lockdep.c:5144 lock_acquire.part.0+0x11c/0x370 kernel/locking/lockdep.c:5761 down_write+0x92/0x200 kernel/locking/rwsem.c:1573 inode_lock include/linux/fs.h:768 [inline] f2fs_file_mmap+0x154/0x290 fs/f2fs/file.c:527 call_mmap include/linux/fs.h:1870 [inline] mmap_region+0x99c/0x2770 mm/mmap.c:2675 do_mmap+0x850/0xee0 mm/mmap.c:1367 vm_mmap_pgoff+0x1a2/0x3b0 mm/util.c:543 ksys_mmap_pgoff+0x42b/0x5b0 mm/mmap.c:1413 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fed9f48c199 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007feda0169168 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 00007fed9f5ac050 RCX: 00007fed9f48c199 RDX: 000000000000000b RSI: 0000000000b36000 RDI: 0000000020000000 RBP: 00007fed9f4e7ca1 R08: 0000000000000004 R09: 0000000000000000 R10: 0000000000028011 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffdd964349f R14: 00007feda0169300 R15: 0000000000022000