====================================================== WARNING: possible circular locking dependency detected 5.15.118-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.2/24024 is trying to acquire lock: ffff8880780d2a20 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:842 [inline] ffff8880780d2a20 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: filemap_fault+0x708/0x1470 mm/filemap.c:3072 but task is already holding lock: ffff888024414028 (&mm->mmap_lock#2){++++}-{3:3}, at: mmap_read_lock include/linux/mmap_lock.h:117 [inline] ffff888024414028 (&mm->mmap_lock#2){++++}-{3:3}, at: __mm_populate+0x190/0x4a0 mm/gup.c:1618 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&mm->mmap_lock#2){++++}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622 __might_fault+0xb4/0x110 mm/memory.c:5311 _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:1990 ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1225 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+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb -> #1 (&ni->file.run_lock){++++}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622 down_read+0x45/0x2e0 kernel/locking/rwsem.c:1488 attr_data_get_block+0x26a/0x24e0 fs/ntfs3/attrib.c:828 ntfs_get_block_vbo+0x3bc/0x1070 fs/ntfs3/inode.c:586 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:199 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+0x293/0x530 security/integrity/ima/ima_api.c:254 process_measurement+0x1038/0x1d60 security/integrity/ima/ima_main.c:337 ima_file_check+0xf3/0x180 security/integrity/ima/ima_main.c:519 do_open fs/namei.c:3540 [inline] path_openat+0x2745/0x2f20 fs/namei.c:3672 do_filp_open+0x21c/0x460 fs/namei.c:3699 do_sys_openat2+0x13b/0x500 fs/open.c:1211 do_sys_open fs/open.c:1227 [inline] __do_sys_openat fs/open.c:1243 [inline] __se_sys_openat fs/open.c:1238 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1238 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb -> #0 (mapping.invalidate_lock#8){.+.+}-{3:3}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1646/0x58b0 kernel/locking/lockdep.c:3787 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622 down_read+0x45/0x2e0 kernel/locking/rwsem.c:1488 filemap_invalidate_lock_shared include/linux/fs.h:842 [inline] filemap_fault+0x708/0x1470 mm/filemap.c:3072 __do_fault+0x139/0x340 mm/memory.c:3885 do_read_fault mm/memory.c:4221 [inline] do_fault mm/memory.c:4349 [inline] handle_pte_fault mm/memory.c:4608 [inline] __handle_mm_fault mm/memory.c:4743 [inline] handle_mm_fault+0x376f/0x5950 mm/memory.c:4841 faultin_page mm/gup.c:976 [inline] __get_user_pages+0x4ed/0x11d0 mm/gup.c:1197 populate_vma_page_range+0x215/0x2a0 mm/gup.c:1529 __mm_populate+0x2a5/0x4a0 mm/gup.c:1638 mm_populate include/linux/mm.h:2632 [inline] vm_mmap_pgoff+0x22b/0x2d0 mm/util.c:556 ksys_mmap_pgoff+0x559/0x780 mm/mmap.c:1624 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb other info that might help us debug this: Chain exists of: mapping.invalidate_lock#8 --> &ni->file.run_lock --> &mm->mmap_lock#2 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_lock#2); lock(&ni->file.run_lock); lock(&mm->mmap_lock#2); lock(mapping.invalidate_lock#8); *** DEADLOCK *** 1 lock held by syz-executor.2/24024: #0: ffff888024414028 (&mm->mmap_lock#2){++++}-{3:3}, at: mmap_read_lock include/linux/mmap_lock.h:117 [inline] #0: ffff888024414028 (&mm->mmap_lock#2){++++}-{3:3}, at: __mm_populate+0x190/0x4a0 mm/gup.c:1618 stack backtrace: CPU: 1 PID: 24024 Comm: syz-executor.2 Not tainted 5.15.118-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+0x1e3/0x2cb 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+0x1646/0x58b0 kernel/locking/lockdep.c:3787 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622 down_read+0x45/0x2e0 kernel/locking/rwsem.c:1488 filemap_invalidate_lock_shared include/linux/fs.h:842 [inline] filemap_fault+0x708/0x1470 mm/filemap.c:3072 __do_fault+0x139/0x340 mm/memory.c:3885 do_read_fault mm/memory.c:4221 [inline] do_fault mm/memory.c:4349 [inline] handle_pte_fault mm/memory.c:4608 [inline] __handle_mm_fault mm/memory.c:4743 [inline] handle_mm_fault+0x376f/0x5950 mm/memory.c:4841 faultin_page mm/gup.c:976 [inline] __get_user_pages+0x4ed/0x11d0 mm/gup.c:1197 populate_vma_page_range+0x215/0x2a0 mm/gup.c:1529 __mm_populate+0x2a5/0x4a0 mm/gup.c:1638 mm_populate include/linux/mm.h:2632 [inline] vm_mmap_pgoff+0x22b/0x2d0 mm/util.c:556 ksys_mmap_pgoff+0x559/0x780 mm/mmap.c:1624 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7f7db258b389 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:00007f7da88bb168 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 00007f7db26ab120 RCX: 00007f7db258b389 RDX: 0000000000800001 RSI: 0000000000b36000 RDI: 0000000020000000 RBP: 00007f7db25d6493 R08: 0000000000000006 R09: 0000000000000000 R10: 0000000000028011 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffcd638bedf R14: 00007f7da88bb300 R15: 0000000000022000