====================================================== WARNING: possible circular locking dependency detected 6.10.0-rc3-syzkaller-00021-g2ef5971ff345 #0 Not tainted ------------------------------------------------------ syz-executor.0/8127 is trying to acquire lock: ffff888059485dc0 (mapping.invalidate_lock#10){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:846 [inline] ffff888059485dc0 (mapping.invalidate_lock#10){.+.+}-{3:3}, at: page_cache_ra_unbounded+0x12b/0x5a0 mm/readahead.c:225 but task is already holding lock: ffff88807dbaea18 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock_killable include/linux/mmap_lock.h:153 [inline] ffff88807dbaea18 (&mm->mmap_lock){++++}-{3:3}, at: __get_user_pages_locked mm/gup.c:1912 [inline] ffff88807dbaea18 (&mm->mmap_lock){++++}-{3:3}, at: __gup_longterm_locked+0x37d/0x2790 mm/gup.c:2556 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+0x232/0x390 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/0x1ad0 fs/ioctl.c:841 __do_sys_ioctl fs/ioctl.c:905 [inline] __se_sys_ioctl fs/ioctl.c:893 [inline] __x64_sys_ioctl+0x116/0x220 fs/ioctl.c:893 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 (&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/0xee0 fs/ntfs3/inode.c:599 do_mpage_readpage+0x660/0x17c0 fs/mpage.c:232 mpage_read_folio+0xa9/0x140 fs/mpage.c:399 ntfs_read_folio+0x157/0x1f0 fs/ntfs3/inode.c:737 filemap_read_folio+0xe5/0x2c0 mm/filemap.c:2355 filemap_fault+0x1446/0x2610 mm/filemap.c:3405 __do_fault+0x10a/0x490 mm/memory.c:4562 do_read_fault mm/memory.c:4926 [inline] do_fault mm/memory.c:5056 [inline] do_pte_missing mm/memory.c:3903 [inline] handle_pte_fault mm/memory.c:5380 [inline] __handle_mm_fault+0x39e2/0x53f0 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+0x2c01/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 aio_write+0x3bc/0x8d0 fs/aio.c:1642 __io_submit_one fs/aio.c:2014 [inline] io_submit_one+0x11b6/0x1df0 fs/aio.c:2061 __do_sys_io_submit fs/aio.c:2120 [inline] __se_sys_io_submit fs/aio.c:2090 [inline] __x64_sys_io_submit+0x19d/0x330 fs/aio.c:2090 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 (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] page_cache_ra_unbounded+0x12b/0x5a0 mm/readahead.c:225 do_page_cache_ra mm/readahead.c:303 [inline] page_cache_ra_order+0x6c6/0xa80 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:4562 do_read_fault mm/memory.c:4926 [inline] do_fault mm/memory.c:5056 [inline] do_pte_missing mm/memory.c:3903 [inline] handle_pte_fault mm/memory.c:5380 [inline] __handle_mm_fault+0x39e2/0x53f0 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:1921 [inline] __gup_longterm_locked+0x3e2/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+0x2c01/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 aio_write+0x3bc/0x8d0 fs/aio.c:1642 __io_submit_one fs/aio.c:2014 [inline] io_submit_one+0x11b6/0x1df0 fs/aio.c:2061 __do_sys_io_submit fs/aio.c:2120 [inline] __se_sys_io_submit fs/aio.c:2090 [inline] __x64_sys_io_submit+0x19d/0x330 fs/aio.c:2090 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: 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 *** 2 locks held by syz-executor.0/8127: #0: ffff888059485c20 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: inode_trylock include/linux/fs.h:811 [inline] #0: ffff888059485c20 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: ntfs_file_write_iter+0x2db/0x2050 fs/ntfs3/file.c:1102 #1: ffff88807dbaea18 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock_killable include/linux/mmap_lock.h:153 [inline] #1: ffff88807dbaea18 (&mm->mmap_lock){++++}-{3:3}, at: __get_user_pages_locked mm/gup.c:1912 [inline] #1: ffff88807dbaea18 (&mm->mmap_lock){++++}-{3:3}, at: __gup_longterm_locked+0x37d/0x2790 mm/gup.c:2556 stack backtrace: CPU: 0 PID: 8127 Comm: syz-executor.0 Not tainted 6.10.0-rc3-syzkaller-00021-g2ef5971ff345 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 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] page_cache_ra_unbounded+0x12b/0x5a0 mm/readahead.c:225 do_page_cache_ra mm/readahead.c:303 [inline] page_cache_ra_order+0x6c6/0xa80 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:4562 do_read_fault mm/memory.c:4926 [inline] do_fault mm/memory.c:5056 [inline] do_pte_missing mm/memory.c:3903 [inline] handle_pte_fault mm/memory.c:5380 [inline] __handle_mm_fault+0x39e2/0x53f0 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:1921 [inline] __gup_longterm_locked+0x3e2/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+0x2c01/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 aio_write+0x3bc/0x8d0 fs/aio.c:1642 __io_submit_one fs/aio.c:2014 [inline] io_submit_one+0x11b6/0x1df0 fs/aio.c:2061 __do_sys_io_submit fs/aio.c:2120 [inline] __se_sys_io_submit fs/aio.c:2090 [inline] __x64_sys_io_submit+0x19d/0x330 fs/aio.c:2090 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:0x7f83d4a7cea9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f83d58220c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000d1 RAX: ffffffffffffffda RBX: 00007f83d4bb3f80 RCX: 00007f83d4a7cea9 RDX: 0000000020000540 RSI: 000000000000003b RDI: 00007f83d57f9000 RBP: 00007f83d4aebff4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f83d4bb3f80 R15: 00007fffaad46558