====================================================== WARNING: possible circular locking dependency detected 6.4.0-rc7-next-20230623-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.4/19187 is trying to acquire lock: ffff888023ee27a0 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock include/linux/mmap_lock.h:142 [inline] ffff888023ee27a0 (&mm->mmap_lock){++++}-{3:3}, at: do_user_addr_fault+0xb60/0x1240 arch/x86/mm/fault.c:1413 but task is already holding lock: ffff888086156450 (&sb->s_type->i_mutex_key#32){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:771 [inline] ffff888086156450 (&sb->s_type->i_mutex_key#32){+.+.}-{3:3}, at: f2fs_file_write_iter+0x297/0x28b0 fs/f2fs/file.c:4744 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&sb->s_type->i_mutex_key#32){+.+.}-{3:3}: down_write+0x92/0x200 kernel/locking/rwsem.c:1573 inode_lock include/linux/fs.h:771 [inline] f2fs_file_mmap+0x154/0x290 fs/f2fs/file.c:527 call_mmap include/linux/fs.h:1876 [inline] mmap_region+0x6cf/0x2570 mm/mmap.c:2669 do_mmap+0x837/0xea0 mm/mmap.c:1373 vm_mmap_pgoff+0x1a4/0x3b0 mm/util.c:543 ksys_mmap_pgoff+0x42b/0x5b0 mm/mmap.c:1419 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 (&mm->mmap_lock){++++}-{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 kernel/locking/lockdep.c:5761 [inline] lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5726 down_read+0x9c/0x480 kernel/locking/rwsem.c:1520 mmap_read_lock include/linux/mmap_lock.h:142 [inline] do_user_addr_fault+0xb60/0x1240 arch/x86/mm/fault.c:1413 handle_page_fault arch/x86/mm/fault.c:1556 [inline] exc_page_fault+0x98/0x170 arch/x86/mm/fault.c:1612 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:4520 [inline] f2fs_file_write_iter+0x516/0x28b0 fs/f2fs/file.c:4756 call_write_iter include/linux/fs.h:1871 [inline] aio_write+0x350/0x7d0 fs/aio.c:1596 __io_submit_one fs/aio.c:1968 [inline] io_submit_one+0xf4c/0x1c50 fs/aio.c:2015 __do_sys_io_submit fs/aio.c:2074 [inline] __se_sys_io_submit fs/aio.c:2044 [inline] __x64_sys_io_submit+0x190/0x320 fs/aio.c:2044 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(&sb->s_type->i_mutex_key#32); lock(&mm->mmap_lock); lock(&sb->s_type->i_mutex_key#32); rlock(&mm->mmap_lock); *** DEADLOCK *** 1 lock held by syz-executor.4/19187: #0: ffff888086156450 (&sb->s_type->i_mutex_key#32){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:771 [inline] #0: ffff888086156450 (&sb->s_type->i_mutex_key#32){+.+.}-{3:3}, at: f2fs_file_write_iter+0x297/0x28b0 fs/f2fs/file.c:4744 stack backtrace: CPU: 1 PID: 19187 Comm: syz-executor.4 Not tainted 6.4.0-rc7-next-20230623-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/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 kernel/locking/lockdep.c:5761 [inline] lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5726 down_read+0x9c/0x480 kernel/locking/rwsem.c:1520 mmap_read_lock include/linux/mmap_lock.h:142 [inline] do_user_addr_fault+0xb60/0x1240 arch/x86/mm/fault.c:1413 handle_page_fault arch/x86/mm/fault.c:1556 [inline] exc_page_fault+0x98/0x170 arch/x86/mm/fault.c:1612 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0010:fault_in_readable+0x129/0x210 mm/gup.c:1928 Code: 91 c3 ff 48 39 dd 0f 84 ec 00 00 00 45 31 f6 eb 11 e8 bb 91 c3 ff 48 81 c3 00 10 00 00 48 39 eb 74 1d e8 aa 91 c3 ff 45 89 f7 <8a> 03 31 ff 44 89 fe 88 44 24 28 e8 b7 8d c3 ff 45 85 ff 74 d2 e8 RSP: 0018:ffffc90005a678f0 EFLAGS: 00050212 RAX: 00000000000015d6 RBX: 0000000020001000 RCX: ffffc9000c56b000 RDX: 0000000000040000 RSI: ffffffff81c179b6 RDI: 0000000000000005 RBP: 0000000020201000 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000075 R12: 0000000000200a00 R13: 0000000020000000 R14: 0000000000000000 R15: 0000000000000000 fault_in_iov_iter_readable+0x252/0x2c0 lib/iov_iter.c:216 f2fs_preallocate_blocks fs/f2fs/file.c:4520 [inline] f2fs_file_write_iter+0x516/0x28b0 fs/f2fs/file.c:4756 call_write_iter include/linux/fs.h:1871 [inline] aio_write+0x350/0x7d0 fs/aio.c:1596 __io_submit_one fs/aio.c:1968 [inline] io_submit_one+0xf4c/0x1c50 fs/aio.c:2015 __do_sys_io_submit fs/aio.c:2074 [inline] __se_sys_io_submit fs/aio.c:2044 [inline] __x64_sys_io_submit+0x190/0x320 fs/aio.c:2044 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:0x7f14f268c389 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:00007f14f3468168 EFLAGS: 00000246 ORIG_RAX: 00000000000000d1 RAX: ffffffffffffffda RBX: 00007f14f27abf80 RCX: 00007f14f268c389 RDX: 0000000020000540 RSI: 0000000000000008 RDI: 00007f14f3447000 RBP: 00007f14f26d7493 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc47ef3f8f R14: 00007f14f3468300 R15: 0000000000022000 ---------------- Code disassembly (best guess): 0: 91 xchg %eax,%ecx 1: c3 retq 2: ff 48 39 decl 0x39(%rax) 5: dd 0f fisttpll (%rdi) 7: 84 ec test %ch,%ah 9: 00 00 add %al,(%rax) b: 00 45 31 add %al,0x31(%rbp) e: f6 eb imul %bl 10: 11 e8 adc %ebp,%eax 12: bb 91 c3 ff 48 mov $0x48ffc391,%ebx 17: 81 c3 00 10 00 00 add $0x1000,%ebx 1d: 48 39 eb cmp %rbp,%rbx 20: 74 1d je 0x3f 22: e8 aa 91 c3 ff callq 0xffc391d1 27: 45 89 f7 mov %r14d,%r15d * 2a: 8a 03 mov (%rbx),%al <-- trapping instruction 2c: 31 ff xor %edi,%edi 2e: 44 89 fe mov %r15d,%esi 31: 88 44 24 28 mov %al,0x28(%rsp) 35: e8 b7 8d c3 ff callq 0xffc38df1 3a: 45 85 ff test %r15d,%r15d 3d: 74 d2 je 0x11 3f: e8 .byte 0xe8