====================================================== WARNING: possible circular locking dependency detected 5.15.166-syzkaller #0 Not tainted ------------------------------------------------------ syz.2.627/5862 is trying to acquire lock: ffff8880622ad660 (mapping.invalidate_lock#5){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:844 [inline] ffff8880622ad660 (mapping.invalidate_lock#5){.+.+}-{3:3}, at: filemap_fault+0x708/0x1470 mm/filemap.c:3081 but task is already holding lock: ffff88807dea7128 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline] ffff88807dea7128 (&mm->mmap_lock){++++}-{3:3}, at: do_user_addr_fault arch/x86/mm/fault.c:1298 [inline] ffff88807dea7128 (&mm->mmap_lock){++++}-{3:3}, at: handle_page_fault arch/x86/mm/fault.c:1445 [inline] ffff88807dea7128 (&mm->mmap_lock){++++}-{3:3}, at: exc_page_fault+0x181/0x700 arch/x86/mm/fault.c:1501 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&mm->mmap_lock){++++}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __might_fault+0xb4/0x110 mm/memory.c:5327 _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 ni_fiemap+0x9ae/0x1230 fs/ntfs3/frecord.c:1996 ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1224 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 -> #1 (&ni->file.run_lock){.+.+}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 down_read+0x45/0x2e0 kernel/locking/rwsem.c:1498 attr_data_get_block+0x26a/0x24e0 fs/ntfs3/attrib.c:831 ntfs_get_block_vbo+0x3bc/0x1070 fs/ntfs3/inode.c:591 do_mpage_readpage+0x6c8/0x1f70 fs/mpage.c:231 mpage_readahead+0x427/0x9b0 fs/mpage.c:389 read_pages+0x159/0x8e0 mm/readahead.c:130 page_cache_ra_unbounded+0x7b0/0x930 mm/readahead.c:239 page_cache_sync_readahead include/linux/pagemap.h:833 [inline] filemap_get_pages mm/filemap.c:2551 [inline] filemap_read+0x71c/0x2980 mm/filemap.c:2634 __kernel_read+0x5ac/0xa60 fs/read_write.c:443 integrity_kernel_read+0xac/0xf0 security/integrity/iint.c:228 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:485 [inline] ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline] ima_calc_file_hash+0xa5d/0x1c00 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x37e/0x800 security/integrity/ima/ima_api.c:255 process_measurement+0x1363/0x21c0 security/integrity/ima/ima_main.c:351 ima_file_check+0xf3/0x180 security/integrity/ima/ima_main.c:533 do_open fs/namei.c:3610 [inline] path_openat+0x2748/0x2f20 fs/namei.c:3742 do_filp_open+0x21c/0x460 fs/namei.c:3769 do_sys_openat2+0x13b/0x4f0 fs/open.c:1253 do_sys_open fs/open.c:1269 [inline] __do_sys_openat fs/open.c:1285 [inline] __se_sys_openat fs/open.c:1280 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1280 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 (mapping.invalidate_lock#5){.+.+}-{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 filemap_invalidate_lock_shared include/linux/fs.h:844 [inline] filemap_fault+0x708/0x1470 mm/filemap.c:3081 __do_fault+0x139/0x340 mm/memory.c:3898 do_shared_fault mm/memory.c:4288 [inline] do_fault mm/memory.c:4366 [inline] handle_pte_fault mm/memory.c:4620 [inline] __handle_mm_fault mm/memory.c:4755 [inline] handle_mm_fault+0x275d/0x5960 mm/memory.c:4853 do_user_addr_fault arch/x86/mm/fault.c:1357 [inline] handle_page_fault arch/x86/mm/fault.c:1445 [inline] exc_page_fault+0x271/0x700 arch/x86/mm/fault.c:1501 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 other info that might help us debug this: Chain exists of: mapping.invalidate_lock#5 --> &ni->file.run_lock --> &mm->mmap_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_lock); lock(&ni->file.run_lock); lock(&mm->mmap_lock); lock(mapping.invalidate_lock#5); *** DEADLOCK *** 1 lock held by syz.2.627/5862: #0: ffff88807dea7128 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline] #0: ffff88807dea7128 (&mm->mmap_lock){++++}-{3:3}, at: do_user_addr_fault arch/x86/mm/fault.c:1298 [inline] #0: ffff88807dea7128 (&mm->mmap_lock){++++}-{3:3}, at: handle_page_fault arch/x86/mm/fault.c:1445 [inline] #0: ffff88807dea7128 (&mm->mmap_lock){++++}-{3:3}, at: exc_page_fault+0x181/0x700 arch/x86/mm/fault.c:1501 stack backtrace: CPU: 0 PID: 5862 Comm: syz.2.627 Not tainted 5.15.166-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/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 filemap_invalidate_lock_shared include/linux/fs.h:844 [inline] filemap_fault+0x708/0x1470 mm/filemap.c:3081 __do_fault+0x139/0x340 mm/memory.c:3898 do_shared_fault mm/memory.c:4288 [inline] do_fault mm/memory.c:4366 [inline] handle_pte_fault mm/memory.c:4620 [inline] __handle_mm_fault mm/memory.c:4755 [inline] handle_mm_fault+0x275d/0x5960 mm/memory.c:4853 do_user_addr_fault arch/x86/mm/fault.c:1357 [inline] handle_page_fault arch/x86/mm/fault.c:1445 [inline] exc_page_fault+0x271/0x700 arch/x86/mm/fault.c:1501 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 RIP: 0033:0x7fed0c9ef96b Code: fa 10 73 2d 83 fa 08 73 46 83 fa 04 73 16 83 fa 01 7c 10 8a 0e 74 0a 0f b7 74 16 fe 66 89 74 17 fe 88 0f c3 8b 4c 16 fc 8b 36 <89> 4c 17 fc 89 37 c3 c5 fa 6f 06 c5 fa 6f 4c 16 f0 c5 fa 7f 07 c5 RSP: 002b:00007ffe93bc90e8 EFLAGS: 00010202 RAX: 0000000020001b80 RBX: 0000000000000004 RCX: 0000000064697072 RDX: 0000000000000005 RSI: 0000000069707267 RDI: 0000000020001b80 RBP: 00007fed0cbe1a80 R08: 00007fed0c8aa000 R09: 0000000000000001 R10: 0000000000000001 R11: 0000000000000009 R12: 0000000000031256 R13: 00007ffe93bc91f0 R14: 0000000000000032 R15: fffffffffffffffe