====================================================== WARNING: possible circular locking dependency detected 6.5.0-rc1-syzkaller-00201-g2772d7df3c93 #0 Not tainted ------------------------------------------------------ syz-executor.0/5503 is trying to acquire lock: ffff8880766cd720 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock_killable include/linux/mmap_lock.h:151 [inline] ffff8880766cd720 (&mm->mmap_lock){++++}-{3:3}, at: get_mmap_lock_carefully mm/memory.c:5272 [inline] ffff8880766cd720 (&mm->mmap_lock){++++}-{3:3}, at: lock_mm_and_find_vma+0x3fb/0x780 mm/memory.c:5323 but task is already holding lock: ffff8880229c80e0 (&sbi->s_lock){+.+.}-{3:3}, at: exfat_iterate+0x117/0xb40 fs/exfat/dir.c:232 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&sbi->s_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x14d/0x12d0 kernel/locking/mutex.c:747 exfat_get_block+0x17c/0x1780 fs/exfat/inode.c:280 do_mpage_readpage+0x6d5/0x1a80 fs/mpage.c:234 mpage_readahead+0x344/0x580 fs/mpage.c:382 read_pages+0x1a3/0xd70 mm/readahead.c:160 page_cache_ra_unbounded+0x457/0x5e0 mm/readahead.c:269 do_page_cache_ra mm/readahead.c:299 [inline] page_cache_ra_order+0x72b/0xa80 mm/readahead.c:559 ondemand_readahead+0x540/0x1150 mm/readahead.c:681 page_cache_sync_ra+0x174/0x1d0 mm/readahead.c:708 page_cache_sync_readahead include/linux/pagemap.h:1213 [inline] filemap_get_pages+0xc05/0x1820 mm/filemap.c:2563 filemap_read+0x359/0xce0 mm/filemap.c:2658 generic_file_read_iter+0x346/0x450 mm/filemap.c:2837 __kernel_read+0x2ac/0x840 fs/read_write.c:428 integrity_kernel_read+0x7f/0xb0 security/integrity/iint.c:195 ima_calc_file_hash_tfm+0x2b8/0x3c0 security/integrity/ima/ima_crypto.c:485 ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline] ima_calc_file_hash+0x1c6/0x4a0 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x5b4/0x6c0 security/integrity/ima/ima_api.c:289 process_measurement+0xc68/0x1cc0 security/integrity/ima/ima_main.c:345 ima_file_check+0xba/0x100 security/integrity/ima/ima_main.c:543 do_open fs/namei.c:3638 [inline] path_openat+0x178d/0x2990 fs/namei.c:3793 do_filp_open+0x1cb/0x410 fs/namei.c:3820 do_sys_openat2+0x15c/0x1c0 fs/open.c:1407 do_sys_open fs/open.c:1422 [inline] __do_sys_openat fs/open.c:1438 [inline] __se_sys_openat fs/open.c:1433 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1433 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #1 (mapping.invalidate_lock#3){.+.+}-{3:3}: down_read+0x9c/0x470 kernel/locking/rwsem.c:1520 filemap_invalidate_lock_shared include/linux/fs.h:826 [inline] filemap_fault+0x276/0x2680 mm/filemap.c:3289 __do_fault+0x107/0x5f0 mm/memory.c:4198 do_read_fault mm/memory.c:4547 [inline] do_fault mm/memory.c:4670 [inline] do_pte_missing mm/memory.c:3664 [inline] handle_pte_fault mm/memory.c:4939 [inline] __handle_mm_fault+0x27b7/0x3b50 mm/memory.c:5079 handle_mm_fault+0x2ab/0x9d0 mm/memory.c:5233 do_user_addr_fault+0x446/0xfc0 arch/x86/mm/fault.c:1392 handle_page_fault arch/x86/mm/fault.c:1486 [inline] exc_page_fault+0x5c/0xd0 arch/x86/mm/fault.c:1542 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 do_strncpy_from_user lib/strncpy_from_user.c:41 [inline] strncpy_from_user+0x165/0x300 lib/strncpy_from_user.c:139 getname_flags.part.0+0x93/0x4d0 fs/namei.c:151 getname_flags include/linux/audit.h:319 [inline] getname+0x90/0xe0 fs/namei.c:219 do_sys_openat2+0xe6/0x1c0 fs/open.c:1401 do_sys_open fs/open.c:1422 [inline] __do_sys_openat fs/open.c:1438 [inline] __se_sys_openat fs/open.c:1433 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1433 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (&mm->mmap_lock){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3142 [inline] check_prevs_add kernel/locking/lockdep.c:3261 [inline] validate_chain kernel/locking/lockdep.c:3876 [inline] __lock_acquire+0x2e3d/0x5de0 kernel/locking/lockdep.c:5144 lock_acquire kernel/locking/lockdep.c:5761 [inline] lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5726 down_read_killable+0x9f/0x4b0 kernel/locking/rwsem.c:1543 mmap_read_lock_killable include/linux/mmap_lock.h:151 [inline] get_mmap_lock_carefully mm/memory.c:5272 [inline] lock_mm_and_find_vma+0x3fb/0x780 mm/memory.c:5323 do_user_addr_fault+0x3fd/0xfc0 arch/x86/mm/fault.c:1364 handle_page_fault arch/x86/mm/fault.c:1486 [inline] exc_page_fault+0x5c/0xd0 arch/x86/mm/fault.c:1542 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 filldir64+0x289/0x5d0 fs/readdir.c:335 dir_emit_dot include/linux/fs.h:3180 [inline] dir_emit_dots include/linux/fs.h:3191 [inline] exfat_iterate+0x581/0xb40 fs/exfat/dir.c:235 iterate_dir+0x201/0x740 fs/readdir.c:67 __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64 fs/readdir.c:354 [inline] __x64_sys_getdents64+0x14f/0x2e0 fs/readdir.c:354 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/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: &mm->mmap_lock --> mapping.invalidate_lock#3 --> &sbi->s_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&sbi->s_lock); lock(mapping.invalidate_lock#3); lock(&sbi->s_lock); rlock(&mm->mmap_lock); *** DEADLOCK *** 3 locks held by syz-executor.0/5503: #0: ffff8880232300c8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0xe3/0x100 fs/file.c:1047 #1: ffff88807322a330 (&sb->s_type->i_mutex_key#21){++++}-{3:3}, at: iterate_dir+0x535/0x740 fs/readdir.c:57 #2: ffff8880229c80e0 (&sbi->s_lock){+.+.}-{3:3}, at: exfat_iterate+0x117/0xb40 fs/exfat/dir.c:232 stack backtrace: CPU: 1 PID: 5503 Comm: syz-executor.0 Not tainted 6.5.0-rc1-syzkaller-00201-g2772d7df3c93 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/03/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 check_noncircular+0x2f7/0x3d0 kernel/locking/lockdep.c:2195 check_prev_add kernel/locking/lockdep.c:3142 [inline] check_prevs_add kernel/locking/lockdep.c:3261 [inline] validate_chain kernel/locking/lockdep.c:3876 [inline] __lock_acquire+0x2e3d/0x5de0 kernel/locking/lockdep.c:5144 lock_acquire kernel/locking/lockdep.c:5761 [inline] lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5726 down_read_killable+0x9f/0x4b0 kernel/locking/rwsem.c:1543 mmap_read_lock_killable include/linux/mmap_lock.h:151 [inline] get_mmap_lock_carefully mm/memory.c:5272 [inline] lock_mm_and_find_vma+0x3fb/0x780 mm/memory.c:5323 do_user_addr_fault+0x3fd/0xfc0 arch/x86/mm/fault.c:1364 handle_page_fault arch/x86/mm/fault.c:1486 [inline] exc_page_fault+0x5c/0xd0 arch/x86/mm/fault.c:1542 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0010:filldir64+0x289/0x5d0 fs/readdir.c:335 Code: ff ff ff 31 db e8 47 0c 98 ff 89 d8 48 83 c4 48 5b 5d 41 5c 41 5d 41 5e 41 5f c3 e8 31 0c 98 ff 0f 01 cb 0f ae e8 48 8b 04 24 <49> 89 47 08 e8 1e 0c 98 ff 4c 8b 7c 24 28 48 8b 74 24 10 49 89 37 RSP: 0018:ffffc90005ecfbd8 EFLAGS: 00050293 RAX: 0000000000000000 RBX: ffffc90005ecfe90 RCX: 0000000000000000 RDX: ffff88807de01dc0 RSI: ffffffff81edaaaf RDI: 0000000000000006 RBP: 0000000000000001 R08: 0000000000000006 R09: 0000000000000000 R10: 0000000000000018 R11: 0000000000000000 R12: 0000000000000018 R13: 0000000000000018 R14: ffffffff8a866080 R15: 0000000000000000 dir_emit_dot include/linux/fs.h:3180 [inline] dir_emit_dots include/linux/fs.h:3191 [inline] exfat_iterate+0x581/0xb40 fs/exfat/dir.c:235 iterate_dir+0x201/0x740 fs/readdir.c:67 __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64 fs/readdir.c:354 [inline] __x64_sys_getdents64+0x14f/0x2e0 fs/readdir.c:354 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f19c6e7cb29 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:00007f19c7b760c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9 RAX: ffffffffffffffda RBX: 00007f19c6f9c050 RCX: 00007f19c6e7cb29 RDX: 0000000000008008 RSI: 0000000000000000 RDI: 0000000000000006 RBP: 00007f19c6ec847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f19c6f9c050 R15: 00007ffd1d4dc6b8 ---------------- Code disassembly (best guess), 2 bytes skipped: 0: ff 31 push (%rcx) 2: db e8 fucomi %st(0),%st 4: 47 0c 98 rex.RXB or $0x98,%al 7: ff 89 d8 48 83 c4 decl -0x3b7cb728(%rcx) d: 48 5b rex.W pop %rbx f: 5d pop %rbp 10: 41 5c pop %r12 12: 41 5d pop %r13 14: 41 5e pop %r14 16: 41 5f pop %r15 18: c3 ret 19: e8 31 0c 98 ff call 0xff980c4f 1e: 0f 01 cb stac 21: 0f ae e8 lfence 24: 48 8b 04 24 mov (%rsp),%rax * 28: 49 89 47 08 mov %rax,0x8(%r15) <-- trapping instruction 2c: e8 1e 0c 98 ff call 0xff980c4f 31: 4c 8b 7c 24 28 mov 0x28(%rsp),%r15 36: 48 8b 74 24 10 mov 0x10(%rsp),%rsi 3b: 49 89 37 mov %rsi,(%r15)