====================================================== WARNING: possible circular locking dependency detected 6.3.0-rc4-next-20230328-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/4974 is trying to acquire lock: ffff888043dd80e0 (&sbi->s_lock){+.+.}-{3:3}, at: exfat_get_block+0x18d/0x16e0 fs/exfat/inode.c:280 but task is already holding lock: ffff8880418497d0 (mapping.invalidate_lock#9){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:816 [inline] ffff8880418497d0 (mapping.invalidate_lock#9){.+.+}-{3:3}, at: page_cache_ra_unbounded+0x153/0x5e0 mm/readahead.c:226 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (mapping.invalidate_lock#9){.+.+}-{3:3}: down_read+0x3d/0x50 kernel/locking/rwsem.c:1520 filemap_invalidate_lock_shared include/linux/fs.h:816 [inline] filemap_fault+0xba7/0x24a0 mm/filemap.c:3269 __do_fault+0x107/0x600 mm/memory.c:4163 do_read_fault mm/memory.c:4517 [inline] do_fault mm/memory.c:4646 [inline] do_pte_missing mm/memory.c:3634 [inline] handle_pte_fault mm/memory.c:4934 [inline] __handle_mm_fault+0x2806/0x4180 mm/memory.c:5076 handle_mm_fault+0x2c0/0x9c0 mm/memory.c:5222 do_user_addr_fault+0x53d/0x1240 arch/x86/mm/fault.c:1462 handle_page_fault arch/x86/mm/fault.c:1556 [inline] exc_page_fault+0x98/0x170 arch/x86/mm/fault.c:1612 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 copy_user_short_string+0xa/0x40 arch/x86/lib/copy_user_64.S:231 copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline] raw_copy_from_user arch/x86/include/asm/uaccess_64.h:52 [inline] _copy_from_user+0x147/0x180 lib/usercopy.c:23 copy_from_user include/linux/uaccess.h:183 [inline] copy_struct_from_user include/linux/uaccess.h:367 [inline] __do_sys_openat2+0xbe/0x280 fs/open.c:1403 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #1 (&mm->mmap_lock){++++}-{3:3}: down_read+0x3d/0x50 kernel/locking/rwsem.c:1520 mmap_read_lock include/linux/mmap_lock.h:142 [inline] do_user_addr_fault+0xb60/0x1240 arch/x86/mm/fault.c:1413 handle_page_fault arch/x86/mm/fault.c:1556 [inline] exc_page_fault+0x98/0x170 arch/x86/mm/fault.c:1612 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 filldir+0x1ef/0x680 fs/readdir.c:253 dir_emit_dot include/linux/fs.h:3147 [inline] dir_emit_dots include/linux/fs.h:3158 [inline] exfat_iterate+0x56b/0xb40 fs/exfat/dir.c:235 iterate_dir+0x1fd/0x6f0 fs/readdir.c:67 __do_sys_getdents fs/readdir.c:286 [inline] __se_sys_getdents fs/readdir.c:271 [inline] __x64_sys_getdents+0x13e/0x2c0 fs/readdir.c:271 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/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:3108 [inline] check_prevs_add kernel/locking/lockdep.c:3227 [inline] validate_chain kernel/locking/lockdep.c:3842 [inline] __lock_acquire+0x2f21/0x5df0 kernel/locking/lockdep.c:5074 lock_acquire.part.0+0x11c/0x370 kernel/locking/lockdep.c:5691 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747 exfat_get_block+0x18d/0x16e0 fs/exfat/inode.c:280 do_mpage_readpage+0x768/0x1960 fs/mpage.c:208 mpage_readahead+0x344/0x580 fs/mpage.c:356 read_pages+0x1a2/0xd40 mm/readahead.c:161 page_cache_ra_unbounded+0x477/0x5e0 mm/readahead.c:270 do_page_cache_ra mm/readahead.c:300 [inline] page_cache_ra_order+0x6ec/0xa00 mm/readahead.c:560 ondemand_readahead+0x6b3/0x1080 mm/readahead.c:682 page_cache_sync_ra+0x1c9/0x200 mm/readahead.c:709 page_cache_sync_readahead include/linux/pagemap.h:1209 [inline] filemap_get_pages+0x28d/0x1620 mm/filemap.c:2595 filemap_read+0x32c/0xc30 mm/filemap.c:2690 generic_file_read_iter+0x3ad/0x5b0 mm/filemap.c:2836 __kernel_read+0x2ca/0x830 fs/read_write.c:428 integrity_kernel_read+0x7f/0xb0 security/integrity/iint.c:192 ima_calc_file_hash_tfm+0x2aa/0x3b0 security/integrity/ima/ima_crypto.c:485 ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline] ima_calc_file_hash+0x195/0x4a0 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x55b/0x670 security/integrity/ima/ima_api.c:293 process_measurement+0xd2f/0x1930 security/integrity/ima/ima_main.c:341 ima_file_check+0xba/0x100 security/integrity/ima/ima_main.c:539 do_open fs/namei.c:3562 [inline] path_openat+0x15d3/0x2750 fs/namei.c:3715 do_filp_open+0x1ba/0x410 fs/namei.c:3742 do_sys_openat2+0x16d/0x4c0 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_open fs/open.c:1380 [inline] __se_sys_open fs/open.c:1376 [inline] __x64_sys_open+0x11d/0x1c0 fs/open.c:1376 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/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 --> mapping.invalidate_lock#9 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(mapping.invalidate_lock#9); lock(&mm->mmap_lock); lock(mapping.invalidate_lock#9); lock(&sbi->s_lock); *** DEADLOCK *** 2 locks held by syz-executor.1/4974: #0: ffff88802950a500 (&iint->mutex){+.+.}-{3:3}, at: process_measurement+0x67b/0x1930 security/integrity/ima/ima_main.c:262 #1: ffff8880418497d0 (mapping.invalidate_lock#9){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:816 [inline] #1: ffff8880418497d0 (mapping.invalidate_lock#9){.+.+}-{3:3}, at: page_cache_ra_unbounded+0x153/0x5e0 mm/readahead.c:226 stack backtrace: CPU: 1 PID: 4974 Comm: syz-executor.1 Not tainted 6.3.0-rc4-next-20230328-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+0xd9/0x150 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2188 check_prev_add kernel/locking/lockdep.c:3108 [inline] check_prevs_add kernel/locking/lockdep.c:3227 [inline] validate_chain kernel/locking/lockdep.c:3842 [inline] __lock_acquire+0x2f21/0x5df0 kernel/locking/lockdep.c:5074 lock_acquire.part.0+0x11c/0x370 kernel/locking/lockdep.c:5691 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747 exfat_get_block+0x18d/0x16e0 fs/exfat/inode.c:280 do_mpage_readpage+0x768/0x1960 fs/mpage.c:208 mpage_readahead+0x344/0x580 fs/mpage.c:356 read_pages+0x1a2/0xd40 mm/readahead.c:161 page_cache_ra_unbounded+0x477/0x5e0 mm/readahead.c:270 do_page_cache_ra mm/readahead.c:300 [inline] page_cache_ra_order+0x6ec/0xa00 mm/readahead.c:560 ondemand_readahead+0x6b3/0x1080 mm/readahead.c:682 page_cache_sync_ra+0x1c9/0x200 mm/readahead.c:709 page_cache_sync_readahead include/linux/pagemap.h:1209 [inline] filemap_get_pages+0x28d/0x1620 mm/filemap.c:2595 filemap_read+0x32c/0xc30 mm/filemap.c:2690 generic_file_read_iter+0x3ad/0x5b0 mm/filemap.c:2836 __kernel_read+0x2ca/0x830 fs/read_write.c:428 integrity_kernel_read+0x7f/0xb0 security/integrity/iint.c:192 ima_calc_file_hash_tfm+0x2aa/0x3b0 security/integrity/ima/ima_crypto.c:485 ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline] ima_calc_file_hash+0x195/0x4a0 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x55b/0x670 security/integrity/ima/ima_api.c:293 process_measurement+0xd2f/0x1930 security/integrity/ima/ima_main.c:341 ima_file_check+0xba/0x100 security/integrity/ima/ima_main.c:539 do_open fs/namei.c:3562 [inline] path_openat+0x15d3/0x2750 fs/namei.c:3715 do_filp_open+0x1ba/0x410 fs/namei.c:3742 do_sys_openat2+0x16d/0x4c0 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_open fs/open.c:1380 [inline] __se_sys_open fs/open.c:1376 [inline] __x64_sys_open+0x11d/0x1c0 fs/open.c:1376 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fd0aa88c0f9 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:00007fd0ab625168 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007fd0aa9ac050 RCX: 00007fd0aa88c0f9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000200001c0 RBP: 00007fd0aa8e7b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffde8aa13cf R14: 00007fd0ab625300 R15: 0000000000022000