====================================================== WARNING: possible circular locking dependency detected 6.2.0-rc5-syzkaller-00199-g5af6ce704936 #0 Not tainted ------------------------------------------------------ syz-executor.1/5097 is trying to acquire lock: ffff88803332d380 (&rl->lock){++++}-{3:3}, at: ntfs_read_block+0x91a/0x22e0 fs/ntfs/aops.c:248 but task is already holding lock: ffff88803332e490 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x46/0x610 fs/ntfs/mft.c:154 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&ni->mrec_lock){+.+.}-{3:3}: lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668 __mutex_lock_common+0x1bd/0x26e0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799 map_mft_record+0x46/0x610 fs/ntfs/mft.c:154 ntfs_map_runlist_nolock+0x469/0x16e0 fs/ntfs/attrib.c:91 ntfs_map_runlist+0x7e/0xa0 fs/ntfs/attrib.c:292 ntfs_read_block+0xbd8/0x22e0 fs/ntfs/aops.c:283 read_pages+0x74b/0x9c0 mm/readahead.c:181 page_cache_ra_unbounded+0x703/0x820 mm/readahead.c:270 page_cache_sync_readahead include/linux/pagemap.h:1210 [inline] filemap_get_pages+0x465/0x10d0 mm/filemap.c:2600 filemap_read+0x3cf/0xea0 mm/filemap.c:2694 __kernel_read+0x3fc/0x830 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+0x178f/0x1ca0 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x444/0x8c0 security/integrity/ima/ima_api.c:292 process_measurement+0xf41/0x1bc0 security/integrity/ima/ima_main.c:339 ima_file_check+0xd8/0x130 security/integrity/ima/ima_main.c:519 do_open fs/namei.c:3559 [inline] path_openat+0x2600/0x2dd0 fs/namei.c:3714 do_filp_open+0x264/0x4f0 fs/namei.c:3741 do_sys_openat2+0x124/0x4e0 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 -> #0 (&rl->lock){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain+0x1898/0x6ae0 kernel/locking/lockdep.c:3831 __lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5055 lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668 down_read+0x39/0x50 kernel/locking/rwsem.c:1509 ntfs_read_block+0x91a/0x22e0 fs/ntfs/aops.c:248 filemap_read_folio+0x187/0x7d0 mm/filemap.c:2426 do_read_cache_folio+0x2d3/0x790 mm/filemap.c:3553 do_read_cache_page mm/filemap.c:3595 [inline] read_cache_page+0x56/0x270 mm/filemap.c:3604 read_mapping_page include/linux/pagemap.h:755 [inline] ntfs_map_page fs/ntfs/aops.h:75 [inline] ntfs_sync_mft_mirror+0x21a/0x1df0 fs/ntfs/mft.c:480 write_mft_record_nolock+0x147f/0x1930 fs/ntfs/mft.c:805 write_mft_record fs/ntfs/mft.h:95 [inline] __ntfs_write_inode+0x721/0xc90 fs/ntfs/inode.c:3050 ntfs_commit_inode fs/ntfs/inode.h:300 [inline] ntfs_put_super+0x679/0xf80 fs/ntfs/super.c:2307 generic_shutdown_super+0x130/0x310 fs/super.c:492 kill_block_super+0x79/0xd0 fs/super.c:1386 deactivate_locked_super+0xa7/0xf0 fs/super.c:332 cleanup_mnt+0x494/0x520 fs/namespace.c:1291 task_work_run+0x243/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0x124/0x150 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xb2/0x140 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x26/0x60 kernel/entry/common.c:296 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ni->mrec_lock); lock(&rl->lock); lock(&ni->mrec_lock); lock(&rl->lock); *** DEADLOCK *** 2 locks held by syz-executor.1/5097: #0: ffff8880213620e0 (&type->s_umount_key#51){++++}-{3:3}, at: deactivate_super+0x96/0xd0 fs/super.c:362 #1: ffff88803332e490 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x46/0x610 fs/ntfs/mft.c:154 stack backtrace: CPU: 1 PID: 5097 Comm: syz-executor.1 Not tainted 6.2.0-rc5-syzkaller-00199-g5af6ce704936 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1b1/0x290 lib/dump_stack.c:106 check_noncircular+0x2cc/0x390 kernel/locking/lockdep.c:2177 check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain+0x1898/0x6ae0 kernel/locking/lockdep.c:3831 __lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5055 lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668 down_read+0x39/0x50 kernel/locking/rwsem.c:1509 ntfs_read_block+0x91a/0x22e0 fs/ntfs/aops.c:248 filemap_read_folio+0x187/0x7d0 mm/filemap.c:2426 do_read_cache_folio+0x2d3/0x790 mm/filemap.c:3553 do_read_cache_page mm/filemap.c:3595 [inline] read_cache_page+0x56/0x270 mm/filemap.c:3604 read_mapping_page include/linux/pagemap.h:755 [inline] ntfs_map_page fs/ntfs/aops.h:75 [inline] ntfs_sync_mft_mirror+0x21a/0x1df0 fs/ntfs/mft.c:480 write_mft_record_nolock+0x147f/0x1930 fs/ntfs/mft.c:805 write_mft_record fs/ntfs/mft.h:95 [inline] __ntfs_write_inode+0x721/0xc90 fs/ntfs/inode.c:3050 ntfs_commit_inode fs/ntfs/inode.h:300 [inline] ntfs_put_super+0x679/0xf80 fs/ntfs/super.c:2307 generic_shutdown_super+0x130/0x310 fs/super.c:492 kill_block_super+0x79/0xd0 fs/super.c:1386 deactivate_locked_super+0xa7/0xf0 fs/super.c:332 cleanup_mnt+0x494/0x520 fs/namespace.c:1291 task_work_run+0x243/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0x124/0x150 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xb2/0x140 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x26/0x60 kernel/entry/common.c:296 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f6c4ce8d537 Code: ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 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:00007ffcad666e88 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f6c4ce8d537 RDX: 00007ffcad666f5b RSI: 000000000000000a RDI: 00007ffcad666f50 RBP: 00007ffcad666f50 R08: 00000000ffffffff R09: 00007ffcad666d20 R10: 00005555564178b3 R11: 0000000000000246 R12: 00007f6c4cee6b24 R13: 00007ffcad668010 R14: 0000555556417810 R15: 00007ffcad668050