====================================================== WARNING: possible circular locking dependency detected 5.15.105-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.5/24769 is trying to acquire lock: ffff88807b441628 (&mm->mmap_lock#2){++++}-{3:3}, at: mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117 but task is already holding lock: ffff88814b2e80e0 (&sbi->s_lock){+.+.}-{3:3}, at: exfat_iterate+0x197/0x3290 fs/exfat/dir.c:229 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&sbi->s_lock){+.+.}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 exfat_get_block+0x1ca/0x22c0 fs/exfat/inode.c:303 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 -> #1 (mapping.invalidate_lock#12){.+.+}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622 down_read+0x3b/0x50 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:3871 do_read_fault mm/memory.c:4207 [inline] do_fault mm/memory.c:4335 [inline] handle_pte_fault mm/memory.c:4594 [inline] __handle_mm_fault mm/memory.c:4729 [inline] handle_mm_fault+0x376f/0x5950 mm/memory.c:4827 do_user_addr_fault arch/x86/mm/fault.c:1397 [inline] handle_page_fault arch/x86/mm/fault.c:1485 [inline] exc_page_fault+0x271/0x740 arch/x86/mm/fault.c:1541 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 strncpy_from_user+0x170/0x370 lib/strncpy_from_user.c:139 getname_flags+0xf5/0x4e0 fs/namei.c:149 do_sys_openat2+0xd2/0x500 fs/open.c:1205 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 (&mm->mmap_lock#2){++++}-{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+0x3b/0x50 kernel/locking/rwsem.c:1488 mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117 do_user_addr_fault arch/x86/mm/fault.c:1348 [inline] handle_page_fault arch/x86/mm/fault.c:1485 [inline] exc_page_fault+0x5ce/0x740 arch/x86/mm/fault.c:1541 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 user_access_begin arch/x86/include/asm/uaccess.h:574 [inline] filldir+0x32b/0x720 fs/readdir.c:249 dir_emit_dot include/linux/fs.h:3605 [inline] dir_emit_dots include/linux/fs.h:3616 [inline] exfat_iterate+0x2ef/0x3290 fs/exfat/dir.c:232 iterate_dir+0x224/0x570 __do_sys_getdents fs/readdir.c:286 [inline] __se_sys_getdents+0x1e8/0x4c0 fs/readdir.c:271 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: &mm->mmap_lock#2 --> mapping.invalidate_lock#12 --> &sbi->s_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&sbi->s_lock); lock(mapping.invalidate_lock#12); lock(&sbi->s_lock); lock(&mm->mmap_lock#2); *** DEADLOCK *** 3 locks held by syz-executor.5/24769: #0: ffff88808e3ea5f0 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x261/0x300 fs/file.c:1073 #1: ffff888035809630 (&sb->s_type->i_mutex_key#25){++++}-{3:3}, at: iterate_dir+0x131/0x570 fs/readdir.c:57 #2: ffff88814b2e80e0 (&sbi->s_lock){+.+.}-{3:3}, at: exfat_iterate+0x197/0x3290 fs/exfat/dir.c:229 stack backtrace: CPU: 1 PID: 24769 Comm: syz-executor.5 Not tainted 5.15.105-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/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+0x3b/0x50 kernel/locking/rwsem.c:1488 mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117 do_user_addr_fault arch/x86/mm/fault.c:1348 [inline] handle_page_fault arch/x86/mm/fault.c:1485 [inline] exc_page_fault+0x5ce/0x740 arch/x86/mm/fault.c:1541 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 RIP: 0010:filldir+0x32b/0x720 fs/readdir.c:253 Code: fd 0f 82 63 02 00 00 48 b8 00 f0 ff ff ff 7f 00 00 48 39 c5 0f 87 50 02 00 00 0f 01 cb 0f ae e8 48 8b 44 24 30 48 8b 4c 24 18 <48> 89 41 08 48 8b 44 24 10 48 8b 4c 24 60 48 89 08 48 8b 4c 24 20 RSP: 0018:ffffc9000310f740 EFLAGS: 00050287 RAX: 0000000000000000 RBX: 0000000020001fd8 RCX: 0000000020001fc0 RDX: ffffc900153ad000 RSI: 0000000020001fd8 RDI: 00007ffffffff000 RBP: 0000000020001fd8 R08: ffffffff81d99b9f R09: 0000000000000004 R10: 0000000000000003 R11: ffff888023155700 R12: ffffffff8a9e7fe0 R13: ffffc9000310fe70 R14: 0000000000000001 R15: 0000000020001fc0 dir_emit_dot include/linux/fs.h:3605 [inline] dir_emit_dots include/linux/fs.h:3616 [inline] exfat_iterate+0x2ef/0x3290 fs/exfat/dir.c:232 iterate_dir+0x224/0x570 __do_sys_getdents fs/readdir.c:286 [inline] __se_sys_getdents+0x1e8/0x4c0 fs/readdir.c:271 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:0x7fc0096d80f9 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:00007fc007c4a168 EFLAGS: 00000246 ORIG_RAX: 000000000000004e RAX: ffffffffffffffda RBX: 00007fc0097f7f80 RCX: 00007fc0096d80f9 RDX: 00000000000000b8 RSI: 0000000020001fc0 RDI: 0000000000000006 RBP: 00007fc009733b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe76bbe56f R14: 00007fc007c4a300 R15: 0000000000022000 ---------------- Code disassembly (best guess): 0: fd std 1: 0f 82 63 02 00 00 jb 0x26a 7: 48 b8 00 f0 ff ff ff movabs $0x7ffffffff000,%rax e: 7f 00 00 11: 48 39 c5 cmp %rax,%rbp 14: 0f 87 50 02 00 00 ja 0x26a 1a: 0f 01 cb stac 1d: 0f ae e8 lfence 20: 48 8b 44 24 30 mov 0x30(%rsp),%rax 25: 48 8b 4c 24 18 mov 0x18(%rsp),%rcx * 2a: 48 89 41 08 mov %rax,0x8(%rcx) <-- trapping instruction 2e: 48 8b 44 24 10 mov 0x10(%rsp),%rax 33: 48 8b 4c 24 60 mov 0x60(%rsp),%rcx 38: 48 89 08 mov %rcx,(%rax) 3b: 48 8b 4c 24 20 mov 0x20(%rsp),%rcx