====================================================== WARNING: possible circular locking dependency detected 6.5.0-rc2-syzkaller-00184-g57f1f9dd3abe #0 Not tainted ------------------------------------------------------ syz-executor.2/22266 is trying to acquire lock: ffff88807cbe80e0 (&sbi->s_lock#2){+.+.}-{3:3}, at: exfat_get_block+0x1e5/0x2050 fs/exfat/inode.c:280 but task is already holding lock: ffff888036daf950 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:826 [inline] ffff888036daf950 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: page_cache_ra_unbounded+0xf1/0x7c0 mm/readahead.c:225 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (mapping.invalidate_lock#8){.+.+}-{3:3}: down_read+0x47/0x2f0 kernel/locking/rwsem.c:1520 filemap_invalidate_lock_shared include/linux/fs.h:826 [inline] filemap_fault+0x647/0x1810 mm/filemap.c:3289 __do_fault+0x136/0x500 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 mm/memory.c:5079 [inline] handle_mm_fault+0x4172/0x5410 mm/memory.c:5233 do_user_addr_fault arch/x86/mm/fault.c:1392 [inline] handle_page_fault arch/x86/mm/fault.c:1486 [inline] exc_page_fault+0x266/0x7c0 arch/x86/mm/fault.c:1542 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 strncpy_from_user+0x111/0x2e0 lib/strncpy_from_user.c:139 getname_flags+0xf9/0x4e0 fs/namei.c:151 getname fs/namei.c:219 [inline] __do_sys_mkdirat fs/namei.c:4155 [inline] __se_sys_mkdirat fs/namei.c:4153 [inline] __x64_sys_mkdirat+0x7c/0xa0 fs/namei.c:4153 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #1 (&mm->mmap_lock){++++}-{3:3}: down_read_killable+0x51/0x350 kernel/locking/rwsem.c:1543 mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:151 get_mmap_lock_carefully mm/memory.c:5272 [inline] lock_mm_and_find_vma+0x2b3/0x2f0 mm/memory.c:5323 do_user_addr_fault arch/x86/mm/fault.c:1364 [inline] handle_page_fault arch/x86/mm/fault.c:1486 [inline] exc_page_fault+0x1b2/0x7c0 arch/x86/mm/fault.c:1542 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 filldir+0x2a1/0x6a0 fs/readdir.c:249 dir_emit_dot include/linux/fs.h:3180 [inline] dir_emit_dots include/linux/fs.h:3191 [inline] exfat_iterate+0x2be/0x3380 fs/exfat/dir.c:235 iterate_dir+0x231/0x5a0 __do_sys_getdents fs/readdir.c:286 [inline] __se_sys_getdents+0x1ef/0x4c0 fs/readdir.c:271 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (&sbi->s_lock#2){+.+.}-{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+0x39ff/0x7f70 kernel/locking/lockdep.c:5144 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5761 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 exfat_get_block+0x1e5/0x2050 fs/exfat/inode.c:280 do_mpage_readpage+0x911/0x1fa0 fs/mpage.c:234 mpage_readahead+0x454/0x930 fs/mpage.c:382 read_pages+0x183/0x830 mm/readahead.c:160 page_cache_ra_unbounded+0x697/0x7c0 mm/readahead.c:269 page_cache_sync_readahead include/linux/pagemap.h:1213 [inline] filemap_get_pages+0x49c/0x20c0 mm/filemap.c:2563 filemap_read+0x3d9/0x10d0 mm/filemap.c:2658 __kernel_read+0x422/0x8e0 fs/read_write.c:428 integrity_kernel_read+0xb0/0xf0 security/integrity/iint.c:195 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+0x164c/0x1d20 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x4a5/0x890 security/integrity/ima/ima_api.c:289 process_measurement+0xfea/0x1cf0 security/integrity/ima/ima_main.c:345 ima_file_check+0xf1/0x170 security/integrity/ima/ima_main.c:543 do_open fs/namei.c:3638 [inline] path_openat+0x2812/0x3180 fs/namei.c:3793 do_filp_open+0x234/0x490 fs/namei.c:3820 do_sys_openat2+0x13e/0x1d0 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+0x247/0x290 fs/open.c:1433 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 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#2 --> &mm->mmap_lock --> mapping.invalidate_lock#8 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(mapping.invalidate_lock#8); lock(&mm->mmap_lock); lock(mapping.invalidate_lock#8); lock(&sbi->s_lock#2); *** DEADLOCK *** 2 locks held by syz-executor.2/22266: #0: ffff88807dcfa2c0 (&iint->mutex){+.+.}-{3:3}, at: process_measurement+0x7c9/0x1cf0 security/integrity/ima/ima_main.c:266 #1: ffff888036daf950 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:826 [inline] #1: ffff888036daf950 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: page_cache_ra_unbounded+0xf1/0x7c0 mm/readahead.c:225 stack backtrace: CPU: 0 PID: 22266 Comm: syz-executor.2 Not tainted 6.5.0-rc2-syzkaller-00184-g57f1f9dd3abe #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 check_noncircular+0x375/0x4a0 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+0x39ff/0x7f70 kernel/locking/lockdep.c:5144 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5761 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 exfat_get_block+0x1e5/0x2050 fs/exfat/inode.c:280 do_mpage_readpage+0x911/0x1fa0 fs/mpage.c:234 mpage_readahead+0x454/0x930 fs/mpage.c:382 read_pages+0x183/0x830 mm/readahead.c:160 page_cache_ra_unbounded+0x697/0x7c0 mm/readahead.c:269 page_cache_sync_readahead include/linux/pagemap.h:1213 [inline] filemap_get_pages+0x49c/0x20c0 mm/filemap.c:2563 filemap_read+0x3d9/0x10d0 mm/filemap.c:2658 __kernel_read+0x422/0x8e0 fs/read_write.c:428 integrity_kernel_read+0xb0/0xf0 security/integrity/iint.c:195 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+0x164c/0x1d20 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x4a5/0x890 security/integrity/ima/ima_api.c:289 process_measurement+0xfea/0x1cf0 security/integrity/ima/ima_main.c:345 ima_file_check+0xf1/0x170 security/integrity/ima/ima_main.c:543 do_open fs/namei.c:3638 [inline] path_openat+0x2812/0x3180 fs/namei.c:3793 do_filp_open+0x234/0x490 fs/namei.c:3820 do_sys_openat2+0x13e/0x1d0 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+0x247/0x290 fs/open.c:1433 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f05ce67cb29 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:00007f05cf4470c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f05ce79c050 RCX: 00007f05ce67cb29 RDX: 0000000000000000 RSI: 0000000020000000 RDI: ffffffffffffff9c RBP: 00007f05ce6c847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000006e R14: 00007f05ce79c050 R15: 00007ffecc86de38 syz-executor.2: attempt to access beyond end of device loop2: rw=524288, sector=272, nr_sectors = 128 limit=256 syz-executor.2: attempt to access beyond end of device loop2: rw=524288, sector=400, nr_sectors = 256 limit=256 syz-executor.2: attempt to access beyond end of device loop2: rw=0, sector=272, nr_sectors = 8 limit=256