====================================================== WARNING: possible circular locking dependency detected 6.10.0-rc4-syzkaller-00217-g35bb670d65fc #0 Not tainted ------------------------------------------------------ syz-executor.3/9529 is trying to acquire lock: ffff888059d75dc0 (mapping.invalidate_lock#10){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:846 [inline] ffff888059d75dc0 (mapping.invalidate_lock#10){.+.+}-{3:3}, at: filemap_fault+0x275/0x2610 mm/filemap.c:3301 but task is already holding lock: ffff88801be48b18 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:163 [inline] ffff88801be48b18 (&mm->mmap_lock){++++}-{3:3}, at: get_mmap_lock_carefully mm/memory.c:5715 [inline] ffff88801be48b18 (&mm->mmap_lock){++++}-{3:3}, at: lock_mm_and_find_vma+0x35/0x6a0 mm/memory.c:5775 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&mm->mmap_lock){++++}-{3:3}: __might_fault mm/memory.c:6233 [inline] __might_fault+0x11b/0x190 mm/memory.c:6226 _copy_to_user+0x2b/0xc0 lib/usercopy.c:41 copy_to_user include/linux/uaccess.h:191 [inline] fiemap_fill_next_extent+0x205/0x350 fs/ioctl.c:145 ni_fiemap+0x444/0xc10 fs/ntfs3/frecord.c:2065 ntfs_fiemap+0xc9/0x120 fs/ntfs3/file.c:1215 ioctl_fiemap fs/ioctl.c:220 [inline] do_vfs_ioctl+0x404/0x1a90 fs/ioctl.c:841 __do_compat_sys_ioctl+0x149/0x330 fs/ioctl.c:1001 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e -> #1 (&ni->file.run_lock#3){++++}-{3:3}: down_read+0x9a/0x330 kernel/locking/rwsem.c:1526 attr_data_get_block+0x18b/0x1b70 fs/ntfs3/attrib.c:902 ntfs_get_block_vbo+0x282/0xef0 fs/ntfs3/inode.c:599 do_mpage_readpage+0x660/0x17c0 fs/mpage.c:232 mpage_readahead+0x344/0x590 fs/mpage.c:381 ntfs_readahead+0x1f7/0x250 fs/ntfs3/inode.c:767 read_pages+0x1a8/0xd80 mm/readahead.c:160 page_cache_ra_unbounded+0x2d8/0x5a0 mm/readahead.c:273 do_page_cache_ra mm/readahead.c:303 [inline] page_cache_ra_order+0x6e5/0xae0 mm/readahead.c:547 do_sync_mmap_readahead mm/filemap.c:3175 [inline] filemap_fault+0x12ee/0x2610 mm/filemap.c:3313 __do_fault+0x10a/0x490 mm/memory.c:4556 do_read_fault mm/memory.c:4920 [inline] do_fault mm/memory.c:5050 [inline] do_pte_missing mm/memory.c:3897 [inline] handle_pte_fault mm/memory.c:5380 [inline] __handle_mm_fault+0x39f1/0x52a0 mm/memory.c:5523 handle_mm_fault+0x476/0xa00 mm/memory.c:5688 faultin_page mm/gup.c:1290 [inline] __get_user_pages+0x473/0x1490 mm/gup.c:1589 __get_user_pages_locked mm/gup.c:1857 [inline] __gup_longterm_locked+0x243/0x2790 mm/gup.c:2556 gup_fast_fallback+0x1545/0x25d0 mm/gup.c:3473 pin_user_pages_fast+0xa8/0x100 mm/gup.c:3579 iov_iter_extract_user_pages lib/iov_iter.c:1583 [inline] iov_iter_extract_pages+0x388/0x18a0 lib/iov_iter.c:1646 dio_refill_pages fs/direct-io.c:173 [inline] dio_get_page fs/direct-io.c:214 [inline] do_direct_IO fs/direct-io.c:916 [inline] __blockdev_direct_IO+0x2c00/0x3d50 fs/direct-io.c:1249 blockdev_direct_IO include/linux/fs.h:3185 [inline] ntfs_direct_IO+0x275/0x470 fs/ntfs3/inode.c:803 generic_file_direct_write+0x139/0x3a0 mm/filemap.c:3940 __generic_file_write_iter+0x121/0x240 mm/filemap.c:4096 ntfs_file_write_iter+0xf8a/0x2050 fs/ntfs3/file.c:1129 new_sync_write fs/read_write.c:497 [inline] vfs_write+0x6b6/0x1140 fs/read_write.c:590 ksys_write+0x12f/0x260 fs/read_write.c:643 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e -> #0 (mapping.invalidate_lock#10){.+.+}-{3:3}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719 down_read+0x9a/0x330 kernel/locking/rwsem.c:1526 filemap_invalidate_lock_shared include/linux/fs.h:846 [inline] filemap_fault+0x275/0x2610 mm/filemap.c:3301 __do_fault+0x10a/0x490 mm/memory.c:4556 do_read_fault mm/memory.c:4920 [inline] do_fault mm/memory.c:5050 [inline] do_pte_missing mm/memory.c:3897 [inline] handle_pte_fault mm/memory.c:5380 [inline] __handle_mm_fault+0x39f1/0x52a0 mm/memory.c:5523 handle_mm_fault+0x476/0xa00 mm/memory.c:5688 do_user_addr_fault+0x2e5/0xe50 arch/x86/mm/fault.c:1389 handle_page_fault arch/x86/mm/fault.c:1481 [inline] exc_page_fault+0x5c/0xc0 arch/x86/mm/fault.c:1539 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 fault_in_readable+0x106/0x200 mm/gup.c:2341 fault_in_iov_iter_readable+0x101/0x2c0 lib/iov_iter.c:94 generic_perform_write+0x1cc/0x620 mm/filemap.c:4005 __generic_file_write_iter+0x1fd/0x240 mm/filemap.c:4110 ntfs_file_write_iter+0xf8a/0x2050 fs/ntfs3/file.c:1129 new_sync_write fs/read_write.c:497 [inline] vfs_write+0x6b6/0x1140 fs/read_write.c:590 ksys_write+0x12f/0x260 fs/read_write.c:643 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e other info that might help us debug this: Chain exists of: mapping.invalidate_lock#10 --> &ni->file.run_lock#3 --> &mm->mmap_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(&mm->mmap_lock); lock(&ni->file.run_lock#3); lock(&mm->mmap_lock); rlock(mapping.invalidate_lock#10); *** DEADLOCK *** 4 locks held by syz-executor.3/9529: #0: ffff88801dc819c8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0xeb/0x180 fs/file.c:1191 #1: ffff8880602c8420 (sb_writers#12){.+.+}-{0:0}, at: ksys_write+0x12f/0x260 fs/read_write.c:643 #2: ffff888059d75c20 (&sb->s_type->i_mutex_key#21){+.+.}-{3:3}, at: inode_trylock include/linux/fs.h:811 [inline] #2: ffff888059d75c20 (&sb->s_type->i_mutex_key#21){+.+.}-{3:3}, at: ntfs_file_write_iter+0x2db/0x2050 fs/ntfs3/file.c:1102 #3: ffff88801be48b18 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:163 [inline] #3: ffff88801be48b18 (&mm->mmap_lock){++++}-{3:3}, at: get_mmap_lock_carefully mm/memory.c:5715 [inline] #3: ffff88801be48b18 (&mm->mmap_lock){++++}-{3:3}, at: lock_mm_and_find_vma+0x35/0x6a0 mm/memory.c:5775 stack backtrace: CPU: 1 PID: 9529 Comm: syz-executor.3 Not tainted 6.10.0-rc4-syzkaller-00217-g35bb670d65fc #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719 down_read+0x9a/0x330 kernel/locking/rwsem.c:1526 filemap_invalidate_lock_shared include/linux/fs.h:846 [inline] filemap_fault+0x275/0x2610 mm/filemap.c:3301 __do_fault+0x10a/0x490 mm/memory.c:4556 do_read_fault mm/memory.c:4920 [inline] do_fault mm/memory.c:5050 [inline] do_pte_missing mm/memory.c:3897 [inline] handle_pte_fault mm/memory.c:5380 [inline] __handle_mm_fault+0x39f1/0x52a0 mm/memory.c:5523 handle_mm_fault+0x476/0xa00 mm/memory.c:5688 do_user_addr_fault+0x2e5/0xe50 arch/x86/mm/fault.c:1389 handle_page_fault arch/x86/mm/fault.c:1481 [inline] exc_page_fault+0x5c/0xc0 arch/x86/mm/fault.c:1539 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 RIP: 0010:fault_in_readable+0x106/0x200 mm/gup.c:2341 Code: ff 0f 00 00 31 c0 4c 89 eb 48 81 e5 00 f0 ff ff 4c 39 ed 48 0f 42 e8 e8 78 27 bc ff 48 39 dd 0f 84 e4 00 00 00 e8 6a 27 bc ff <44> 8a 3b e8 62 27 bc ff 48 81 c3 00 10 00 00 44 88 7c 24 20 48 39 RSP: 0018:ffffc90006f77980 EFLAGS: 00050283 RAX: 000000000001f5f7 RBX: 0000000020007000 RCX: ffffc90002ed7000 RDX: 0000000000040000 RSI: ffffffff81d26886 RDI: 0000000000000007 RBP: 0000000020008000 R08: 0000000000000007 R09: 0000000000000000 R10: 0000000000000601 R11: 0000000000000004 R12: 0000000000001000 R13: 0000000020006601 R14: 1ffff92000deef30 R15: 0000000000000600 fault_in_iov_iter_readable+0x101/0x2c0 lib/iov_iter.c:94 generic_perform_write+0x1cc/0x620 mm/filemap.c:4005 __generic_file_write_iter+0x1fd/0x240 mm/filemap.c:4110 ntfs_file_write_iter+0xf8a/0x2050 fs/ntfs3/file.c:1129 new_sync_write fs/read_write.c:497 [inline] vfs_write+0x6b6/0x1140 fs/read_write.c:590 ksys_write+0x12f/0x260 fs/read_write.c:643 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf72c6579 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f5eb85ac EFLAGS: 00000292 ORIG_RAX: 0000000000000004 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000020000600 RDX: 00000000ffffff52 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 ---------------- Code disassembly (best guess): 0: ff 0f decl (%rdi) 2: 00 00 add %al,(%rax) 4: 31 c0 xor %eax,%eax 6: 4c 89 eb mov %r13,%rbx 9: 48 81 e5 00 f0 ff ff and $0xfffffffffffff000,%rbp 10: 4c 39 ed cmp %r13,%rbp 13: 48 0f 42 e8 cmovb %rax,%rbp 17: e8 78 27 bc ff call 0xffbc2794 1c: 48 39 dd cmp %rbx,%rbp 1f: 0f 84 e4 00 00 00 je 0x109 25: e8 6a 27 bc ff call 0xffbc2794 * 2a: 44 8a 3b mov (%rbx),%r15b <-- trapping instruction 2d: e8 62 27 bc ff call 0xffbc2794 32: 48 81 c3 00 10 00 00 add $0x1000,%rbx 39: 44 88 7c 24 20 mov %r15b,0x20(%rsp) 3e: 48 rex.W 3f: 39 .byte 0x39