F2FS-fs (loop2): Try to recover 1th superblock, ret: 0 F2FS-fs (loop2): Mounted with checkpoint version = 753bd00b ====================================================== WARNING: possible circular locking dependency detected 6.2.0-rc6-syzkaller-00229-g7b753a909f42 #0 Not tainted ------------------------------------------------------ syz-executor.2/22612 is trying to acquire lock: ffff888028ac4758 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0xa9/0x180 mm/memory.c:5646 but task is already holding lock: ffff88803f1cc088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2213 [inline] ffff88803f1cc088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_ioc_get_encryption_pwsalt+0x174/0x370 fs/f2fs/file.c:2350 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #4 (&sbi->sb_lock){++++}-{3:3}: down_write+0x94/0x220 kernel/locking/rwsem.c:1562 f2fs_down_write fs/f2fs/f2fs.h:2213 [inline] f2fs_handle_error+0x8e/0x200 fs/f2fs/super.c:3926 f2fs_check_nid_range.part.0+0x4d/0x60 fs/f2fs/node.c:39 f2fs_check_nid_range fs/f2fs/node.c:2278 [inline] add_free_nid.isra.0+0x781/0x940 fs/f2fs/node.c:2285 scan_nat_page fs/f2fs/node.c:2387 [inline] __f2fs_build_free_nids+0x5b5/0xe10 fs/f2fs/node.c:2493 f2fs_build_free_nids fs/f2fs/node.c:2531 [inline] f2fs_build_node_manager+0x2007/0x2fb0 fs/f2fs/node.c:3316 f2fs_fill_super+0x3ade/0x7680 fs/f2fs/super.c:4334 mount_bdev+0x351/0x410 fs/super.c:1359 legacy_get_tree+0x109/0x220 fs/fs_context.c:610 vfs_get_tree+0x8d/0x2f0 fs/super.c:1489 do_new_mount fs/namespace.c:3145 [inline] path_mount+0x132a/0x1e20 fs/namespace.c:3475 do_mount fs/namespace.c:3488 [inline] __do_sys_mount fs/namespace.c:3697 [inline] __se_sys_mount fs/namespace.c:3674 [inline] __x64_sys_mount+0x283/0x300 fs/namespace.c:3674 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 -> #3 (&nm_i->nat_tree_lock){++++}-{3:3}: down_read+0x9c/0x450 kernel/locking/rwsem.c:1509 f2fs_down_read fs/f2fs/f2fs.h:2188 [inline] f2fs_get_node_info+0x1ac/0x1070 fs/f2fs/node.c:564 f2fs_new_node_page+0x249/0xac0 fs/f2fs/node.c:1295 f2fs_get_dnode_of_data+0x530/0x2480 fs/f2fs/node.c:810 f2fs_reserve_block+0x4d/0x430 fs/f2fs/data.c:1199 f2fs_get_new_data_page+0xfb/0x6b0 fs/f2fs/data.c:1387 f2fs_add_regular_entry+0x4e9/0xbd0 fs/f2fs/dir.c:754 f2fs_add_dentry+0x1b5/0x210 fs/f2fs/dir.c:816 f2fs_do_add_link+0x183/0x270 fs/f2fs/dir.c:855 f2fs_add_link fs/f2fs/f2fs.h:3564 [inline] f2fs_create+0x3c1/0x670 fs/f2fs/namei.c:363 lookup_open.isra.0+0xee7/0x1270 fs/namei.c:3413 open_last_lookups fs/namei.c:3481 [inline] path_openat+0x975/0x2a50 fs/namei.c:3711 do_filp_open+0x1ba/0x410 fs/namei.c:3741 do_sys_openat2+0x16d/0x4c0 fs/open.c:1310 do_sys_open fs/open.c:1326 [inline] __do_sys_creat fs/open.c:1402 [inline] __se_sys_creat fs/open.c:1396 [inline] __x64_sys_creat+0xcd/0x120 fs/open.c:1396 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 -> #2 (&sbi->cp_rwsem){++++}-{3:3}: down_read+0x9c/0x450 kernel/locking/rwsem.c:1509 f2fs_down_read fs/f2fs/f2fs.h:2188 [inline] f2fs_lock_op fs/f2fs/f2fs.h:2231 [inline] punch_hole fs/f2fs/file.c:1163 [inline] f2fs_fallocate+0x65c/0x3780 fs/f2fs/file.c:1835 vfs_fallocate+0x48b/0xe00 fs/open.c:323 ksys_fallocate fs/open.c:346 [inline] __do_sys_fallocate fs/open.c:354 [inline] __se_sys_fallocate fs/open.c:352 [inline] __x64_sys_fallocate+0xd3/0x140 fs/open.c:352 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 (mapping.invalidate_lock#8){++++}-{3:3}: down_read+0x9c/0x450 kernel/locking/rwsem.c:1509 filemap_invalidate_lock_shared include/linux/fs.h:811 [inline] filemap_fault+0xb99/0x23f0 mm/filemap.c:3146 f2fs_filemap_fault+0x82/0x3e0 fs/f2fs/file.c:44 __do_fault+0x107/0x600 mm/memory.c:4163 do_read_fault mm/memory.c:4514 [inline] do_fault mm/memory.c:4643 [inline] handle_pte_fault mm/memory.c:4931 [inline] __handle_mm_fault+0x22f2/0x3c90 mm/memory.c:5073 handle_mm_fault+0x1b6/0x850 mm/memory.c:5219 faultin_page mm/gup.c:926 [inline] __get_user_pages+0x4f8/0xfc0 mm/gup.c:1153 populate_vma_page_range+0x241/0x320 mm/gup.c:1526 __mm_populate+0x105/0x3b0 mm/gup.c:1640 mm_populate include/linux/mm.h:2874 [inline] vm_mmap_pgoff+0x201/0x280 mm/util.c:525 ksys_mmap_pgoff+0x41f/0x5a0 mm/mmap.c:1457 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 (&mm->mmap_lock){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain kernel/locking/lockdep.c:3831 [inline] __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055 lock_acquire kernel/locking/lockdep.c:5668 [inline] lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633 __might_fault mm/memory.c:5647 [inline] __might_fault+0x10c/0x180 mm/memory.c:5640 _copy_to_user+0x29/0x150 lib/usercopy.c:29 copy_to_user include/linux/uaccess.h:169 [inline] f2fs_ioc_get_encryption_pwsalt+0x2b2/0x370 fs/f2fs/file.c:2365 __f2fs_ioctl+0x29f1/0xaaf0 fs/f2fs/file.c:4169 f2fs_ioctl+0x18e/0x220 fs/f2fs/file.c:4242 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856 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: &mm->mmap_lock --> &nm_i->nat_tree_lock --> &sbi->sb_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&sbi->sb_lock); lock(&nm_i->nat_tree_lock); lock(&sbi->sb_lock); lock(&mm->mmap_lock); *** DEADLOCK *** 2 locks held by syz-executor.2/22612: #0: ffff888082278460 (sb_writers#28){.+.+}-{0:0}, at: f2fs_ioc_get_encryption_pwsalt+0x136/0x370 fs/f2fs/file.c:2346 #1: ffff88803f1cc088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2213 [inline] #1: ffff88803f1cc088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_ioc_get_encryption_pwsalt+0x174/0x370 fs/f2fs/file.c:2350 stack backtrace: CPU: 0 PID: 22612 Comm: syz-executor.2 Not tainted 6.2.0-rc6-syzkaller-00229-g7b753a909f42 #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+0xd1/0x138 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 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 kernel/locking/lockdep.c:3831 [inline] __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055 lock_acquire kernel/locking/lockdep.c:5668 [inline] lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633 __might_fault mm/memory.c:5647 [inline] __might_fault+0x10c/0x180 mm/memory.c:5640 _copy_to_user+0x29/0x150 lib/usercopy.c:29 copy_to_user include/linux/uaccess.h:169 [inline] f2fs_ioc_get_encryption_pwsalt+0x2b2/0x370 fs/f2fs/file.c:2365 __f2fs_ioctl+0x29f1/0xaaf0 fs/f2fs/file.c:4169 f2fs_ioctl+0x18e/0x220 fs/f2fs/file.c:4242 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856 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:0x7f3f9048c0c9 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:00007f3f91104168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f3f905abf80 RCX: 00007f3f9048c0c9 RDX: 0000000020007fc0 RSI: 0000000040106614 RDI: 0000000000000004 RBP: 00007f3f904e7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffeebe90e9f R14: 00007f3f91104300 R15: 0000000000022000