F2FS-fs (loop4): Try to recover 1th superblock, ret: 0 F2FS-fs (loop4): Mounted with checkpoint version = 753bd00b ====================================================== WARNING: possible circular locking dependency detected 6.2.0-rc6-syzkaller-17549-gca72d58361ee #0 Not tainted ------------------------------------------------------ syz-executor.4/11489 is trying to acquire lock: ffff0000c0ecc4c8 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x54/0xb4 mm/memory.c:5646 but task is already holding lock: ffff000116a6c088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2213 [inline] ffff000116a6c088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_ioc_get_encryption_pwsalt fs/f2fs/file.c:2350 [inline] ffff000116a6c088 (&sbi->sb_lock){++++}-{3:3}, at: __f2fs_ioctl+0x13e0/0x3320 fs/f2fs/file.c:4169 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #4 (&sbi->sb_lock){++++}-{3:3}: down_write+0x5c/0x88 kernel/locking/rwsem.c:1562 f2fs_down_write fs/f2fs/f2fs.h:2213 [inline] f2fs_handle_error+0x9c/0x17c fs/f2fs/super.c:3926 f2fs_check_nid_range fs/f2fs/node.c:39 [inline] add_free_nid+0x4d8/0x50c fs/f2fs/node.c:2285 scan_nat_page fs/f2fs/node.c:2387 [inline] __f2fs_build_free_nids fs/f2fs/node.c:2493 [inline] f2fs_build_free_nids+0x680/0x8f4 fs/f2fs/node.c:2531 f2fs_build_node_manager+0x628/0x650 fs/f2fs/node.c:3316 f2fs_fill_super+0x1394/0x1e88 fs/f2fs/super.c:4334 mount_bdev+0x1b8/0x210 fs/super.c:1359 f2fs_mount+0x44/0x58 fs/f2fs/super.c:4608 legacy_get_tree+0x30/0x74 fs/fs_context.c:610 vfs_get_tree+0x40/0x140 fs/super.c:1489 do_new_mount+0x1dc/0x4e4 fs/namespace.c:3145 path_mount+0x358/0x890 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] __arm64_sys_mount+0x2c4/0x3c4 fs/namespace.c:3674 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall arch/arm64/kernel/syscall.c:52 [inline] el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x48/0x104 arch/arm64/kernel/syscall.c:193 el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 -> #3 (&nm_i->nat_tree_lock){++++}-{3:3}: down_read+0x5c/0x78 kernel/locking/rwsem.c:1509 f2fs_down_read fs/f2fs/f2fs.h:2188 [inline] f2fs_get_node_info+0x74/0x458 fs/f2fs/node.c:564 f2fs_do_write_data_page+0x640/0x109c fs/f2fs/data.c:2728 f2fs_write_single_data_page+0x750/0xb24 fs/f2fs/data.c:2863 f2fs_write_cache_pages+0x498/0xdd0 fs/f2fs/data.c:3115 __f2fs_write_data_pages+0x3f8/0x48c fs/f2fs/data.c:3265 f2fs_write_data_pages+0x44/0x54 fs/f2fs/data.c:3292 do_writepages+0x144/0x27c mm/page-writeback.c:2581 filemap_fdatawrite_wbc+0xac/0xd0 mm/filemap.c:388 __filemap_fdatawrite_range mm/filemap.c:421 [inline] filemap_write_and_wait_range+0xa4/0x208 mm/filemap.c:674 f2fs_defragment_range+0xc8/0x62c fs/f2fs/file.c:2585 f2fs_ioc_defragment fs/f2fs/file.c:2739 [inline] __f2fs_ioctl+0x25e0/0x3320 fs/f2fs/file.c:4189 f2fs_ioctl+0x74/0xbc 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] __arm64_sys_ioctl+0xd0/0x140 fs/ioctl.c:856 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall arch/arm64/kernel/syscall.c:52 [inline] el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x48/0x104 arch/arm64/kernel/syscall.c:193 el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 -> #2 (&sbi->cp_rwsem){++++}-{3:3}: down_read+0x5c/0x78 kernel/locking/rwsem.c:1509 f2fs_down_read fs/f2fs/f2fs.h:2188 [inline] f2fs_lock_op fs/f2fs/f2fs.h:2231 [inline] f2fs_do_truncate_blocks+0x98/0x384 fs/f2fs/file.c:688 f2fs_truncate_blocks+0x9c/0x1d8 fs/f2fs/file.c:751 f2fs_truncate+0x1bc/0x2ac fs/f2fs/file.c:803 f2fs_setattr+0x5c8/0x788 fs/f2fs/file.c:1010 notify_change+0x738/0x7d0 fs/attr.c:482 do_truncate+0x10c/0x154 fs/open.c:65 handle_truncate+0xf4/0x154 fs/namei.c:3216 do_open fs/namei.c:3561 [inline] path_openat+0xee0/0x11f0 fs/namei.c:3714 do_filp_open+0xdc/0x1b8 fs/namei.c:3741 do_sys_openat2+0xb8/0x22c 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] __arm64_sys_openat+0xb0/0xe0 fs/open.c:1337 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall arch/arm64/kernel/syscall.c:52 [inline] el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x48/0x104 arch/arm64/kernel/syscall.c:193 el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 -> #1 (mapping.invalidate_lock#9){++++}-{3:3}: down_read+0x5c/0x78 kernel/locking/rwsem.c:1509 filemap_invalidate_lock_shared include/linux/fs.h:811 [inline] filemap_fault+0x104/0x7fc mm/filemap.c:3146 f2fs_filemap_fault+0x2c/0x54 fs/f2fs/file.c:44 __do_fault+0x74/0x328 mm/memory.c:4163 do_shared_fault mm/memory.c:4569 [inline] do_fault mm/memory.c:4647 [inline] handle_pte_fault mm/memory.c:4931 [inline] __handle_mm_fault mm/memory.c:5073 [inline] handle_mm_fault+0xa54/0xf90 mm/memory.c:5219 __do_page_fault arch/arm64/mm/fault.c:512 [inline] do_page_fault+0x428/0x79c arch/arm64/mm/fault.c:612 do_translation_fault+0x78/0x194 arch/arm64/mm/fault.c:695 do_mem_abort+0x54/0x130 arch/arm64/mm/fault.c:831 el0_da+0x70/0x16c arch/arm64/kernel/entry-common.c:515 el0t_64_sync_handler+0xcc/0xf0 arch/arm64/kernel/entry-common.c:658 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 -> #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+0x1530/0x3084 kernel/locking/lockdep.c:5055 lock_acquire+0xf0/0x1dc kernel/locking/lockdep.c:5668 __might_fault+0x7c/0xb4 mm/memory.c:5647 _copy_to_user include/linux/uaccess.h:143 [inline] copy_to_user include/linux/uaccess.h:169 [inline] f2fs_ioc_get_encryption_pwsalt fs/f2fs/file.c:2365 [inline] __f2fs_ioctl+0x320c/0x3320 fs/f2fs/file.c:4169 f2fs_ioctl+0x74/0xbc 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] __arm64_sys_ioctl+0xd0/0x140 fs/ioctl.c:856 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall arch/arm64/kernel/syscall.c:52 [inline] el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x48/0x104 arch/arm64/kernel/syscall.c:193 el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 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.4/11489: #0: ffff0000c8361460 (sb_writers#28){.+.+}-{0:0}, at: mnt_want_write_file+0x28/0xd8 fs/namespace.c:552 #1: ffff000116a6c088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2213 [inline] #1: ffff000116a6c088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_ioc_get_encryption_pwsalt fs/f2fs/file.c:2350 [inline] #1: ffff000116a6c088 (&sbi->sb_lock){++++}-{3:3}, at: __f2fs_ioctl+0x13e0/0x3320 fs/f2fs/file.c:4169 stack backtrace: CPU: 1 PID: 11489 Comm: syz-executor.4 Not tainted 6.2.0-rc6-syzkaller-17549-gca72d58361ee #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023 Call trace: dump_backtrace+0x1c4/0x1f0 arch/arm64/kernel/stacktrace.c:158 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106 dump_stack+0x1c/0x28 lib/dump_stack.c:113 print_circular_bug+0x2c4/0x2c8 kernel/locking/lockdep.c:2055 check_noncircular+0x14c/0x154 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+0x1530/0x3084 kernel/locking/lockdep.c:5055 lock_acquire+0xf0/0x1dc kernel/locking/lockdep.c:5668 __might_fault+0x7c/0xb4 mm/memory.c:5647 _copy_to_user include/linux/uaccess.h:143 [inline] copy_to_user include/linux/uaccess.h:169 [inline] f2fs_ioc_get_encryption_pwsalt fs/f2fs/file.c:2365 [inline] __f2fs_ioctl+0x320c/0x3320 fs/f2fs/file.c:4169 f2fs_ioctl+0x74/0xbc 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] __arm64_sys_ioctl+0xd0/0x140 fs/ioctl.c:856 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall arch/arm64/kernel/syscall.c:52 [inline] el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x48/0x104 arch/arm64/kernel/syscall.c:193 el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591