====================================================== WARNING: possible circular locking dependency detected 6.1.28-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.2/3707 is trying to acquire lock: ffff88801fbc40e0 ( &sbi->s_lock){+.+.}-{3:3}, at: exfat_get_block+0x1e1/0x2040 fs/exfat/inode.c:281 but task is already holding lock: ffff88806989df50 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:811 [inline] ffff88806989df50 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: page_cache_ra_unbounded+0xed/0x7b0 mm/readahead.c:226 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (mapping.invalidate_lock#3){.+.+}-{3:3}: lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669 down_read+0x39/0x50 kernel/locking/rwsem.c:1520 filemap_invalidate_lock_shared include/linux/fs.h:811 [inline] filemap_fault+0x640/0x17e0 mm/filemap.c:3128 __do_fault+0x136/0x4f0 mm/memory.c:4212 do_read_fault mm/memory.c:4563 [inline] do_fault mm/memory.c:4692 [inline] handle_pte_fault mm/memory.c:4964 [inline] __handle_mm_fault mm/memory.c:5106 [inline] handle_mm_fault+0x3407/0x5330 mm/memory.c:5227 do_user_addr_fault arch/x86/mm/fault.c:1428 [inline] handle_page_fault arch/x86/mm/fault.c:1519 [inline] exc_page_fault+0x58d/0x790 arch/x86/mm/fault.c:1575 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570 strncpy_from_user+0x159/0x360 lib/strncpy_from_user.c:139 getname_flags+0xf5/0x4e0 fs/namei.c:150 do_sys_openat2+0xd2/0x500 fs/open.c:1304 do_sys_open fs/open.c:1326 [inline] __do_sys_openat fs/open.c:1342 [inline] __se_sys_openat fs/open.c:1337 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1337 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+0x63/0xcd -> #1 (&mm->mmap_lock#2){++++}-{3:3}: lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669 down_read+0x39/0x50 kernel/locking/rwsem.c:1520 mmap_read_lock include/linux/mmap_lock.h:117 [inline] do_user_addr_fault arch/x86/mm/fault.c:1379 [inline] handle_page_fault arch/x86/mm/fault.c:1519 [inline] exc_page_fault+0x46a/0x790 arch/x86/mm/fault.c:1575 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570 filldir64+0x307/0x6f0 fs/readdir.c:331 dir_emit_dot include/linux/fs.h:3583 [inline] dir_emit_dots include/linux/fs.h:3594 [inline] exfat_iterate+0x28a/0x3290 fs/exfat/dir.c:231 iterate_dir+0x224/0x560 __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64+0x209/0x4f0 fs/readdir.c:354 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+0x63/0xcd -> #0 (&sbi->s_lock){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669 __mutex_lock_common+0x1d4/0x2520 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799 exfat_get_block+0x1e1/0x2040 fs/exfat/inode.c:281 do_mpage_readpage+0x8d2/0x2040 fs/mpage.c:208 mpage_readahead+0x450/0x920 fs/mpage.c:361 read_pages+0x17f/0x830 mm/readahead.c:161 page_cache_ra_unbounded+0x68b/0x7b0 mm/readahead.c:270 page_cache_sync_readahead include/linux/pagemap.h:1213 [inline] filemap_get_pages mm/filemap.c:2582 [inline] filemap_read+0x7fa/0x31d0 mm/filemap.c:2676 __kernel_read+0x41e/0x8a0 fs/read_write.c:428 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+0xa57/0x1c00 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x4d4/0x970 security/integrity/ima/ima_api.c:292 process_measurement+0x1018/0x1cf0 security/integrity/ima/ima_main.c:337 ima_file_check+0xed/0x170 security/integrity/ima/ima_main.c:520 do_open fs/namei.c:3559 [inline] path_openat+0x2687/0x2e60 fs/namei.c:3714 do_filp_open+0x230/0x480 fs/namei.c:3741 do_sys_openat2+0x13b/0x500 fs/open.c:1310 do_sys_open fs/open.c:1326 [inline] __do_sys_openat fs/open.c:1342 [inline] __se_sys_openat fs/open.c:1337 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1337 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+0x63/0xcd other info that might help us debug this: Chain exists of: &sbi->s_lock --> &mm->mmap_lock#2 --> mapping.invalidate_lock#3 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(mapping.invalidate_lock#3); lock(&mm->mmap_lock#2); lock(mapping.invalidate_lock#3); lock(&sbi->s_lock); *** DEADLOCK *** 3 locks held by syz-executor.2/3707: #0: ffff888014246460 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393 #1: ffff888025aa9ce0 (&iint->mutex){+.+.}-{3:3}, at: process_measurement+0x7fe/0x1cf0 security/integrity/ima/ima_main.c:260 #2: ffff88806989df50 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:811 [inline] #2: ffff88806989df50 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: page_cache_ra_unbounded+0xed/0x7b0 mm/readahead.c:226 stack backtrace: CPU: 1 PID: 3707 Comm: syz-executor.2 Not tainted 6.1.28-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2178 check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669 __mutex_lock_common+0x1d4/0x2520 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799 exfat_get_block+0x1e1/0x2040 fs/exfat/inode.c:281 do_mpage_readpage+0x8d2/0x2040 fs/mpage.c:208 mpage_readahead+0x450/0x920 fs/mpage.c:361 read_pages+0x17f/0x830 mm/readahead.c:161 page_cache_ra_unbounded+0x68b/0x7b0 mm/readahead.c:270 page_cache_sync_readahead include/linux/pagemap.h:1213 [inline] filemap_get_pages mm/filemap.c:2582 [inline] filemap_read+0x7fa/0x31d0 mm/filemap.c:2676 __kernel_read+0x41e/0x8a0 fs/read_write.c:428 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+0xa57/0x1c00 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x4d4/0x970 security/integrity/ima/ima_api.c:292 process_measurement+0x1018/0x1cf0 security/integrity/ima/ima_main.c:337 ima_file_check+0xed/0x170 security/integrity/ima/ima_main.c:520 do_open fs/namei.c:3559 [inline] path_openat+0x2687/0x2e60 fs/namei.c:3714 do_filp_open+0x230/0x480 fs/namei.c:3741 do_sys_openat2+0x13b/0x500 fs/open.c:1310 do_sys_open fs/open.c:1326 [inline] __do_sys_openat fs/open.c:1342 [inline] __se_sys_openat fs/open.c:1337 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1337 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+0x63/0xcd RIP: 0033:0x7f5320c8c169 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:00007f5321970168 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f5320dabf80 RCX: 00007f5320c8c169 RDX: 000000000000275a RSI: 0000000020006ac0 RDI: ffffffffffffff9c RBP: 00007f5320ce7ca1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd7b66416f R14: 00007f5321970300 R15: 0000000000022000 syz-executor.2 (3707) used greatest stack depth: 18648 bytes left