F2FS-fs (loop4): Mounted with checkpoint version = 48b305e5 F2FS-fs (loop4): f2fs_check_nid_range: out-of-range nid=1000000, run fsck to fix. ====================================================== WARNING: possible circular locking dependency detected 6.2.0-rc1-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.4/7462 is trying to acquire lock: ffff88802132c088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2213 [inline] ffff88802132c088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_handle_error+0xe0/0x230 fs/f2fs/super.c:3926 but task is already holding lock: ffff888038c67308 (&fi->i_xattr_sem){++++}-{3:3}, at: f2fs_down_read fs/f2fs/f2fs.h:2188 [inline] ffff888038c67308 (&fi->i_xattr_sem){++++}-{3:3}, at: f2fs_getxattr+0x98/0x1490 fs/f2fs/xattr.c:530 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #4 (&fi->i_xattr_sem){++++}-{3:3}: lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668 down_write+0x9c/0x270 kernel/locking/rwsem.c:1562 f2fs_down_write fs/f2fs/f2fs.h:2213 [inline] f2fs_setxattr+0x1d6/0x320 fs/f2fs/xattr.c:797 __f2fs_set_acl+0xa58/0xdd0 fs/f2fs/acl.c:269 set_posix_acl fs/posix_acl.c:957 [inline] vfs_remove_acl+0x586/0x800 fs/posix_acl.c:1209 ovl_do_remove_acl fs/overlayfs/overlayfs.h:292 [inline] ovl_workdir_create+0x4df/0x8f0 fs/overlayfs/super.c:821 ovl_make_workdir+0x107/0xdf0 fs/overlayfs/super.c:1294 ovl_get_workdir+0x2e4/0x410 fs/overlayfs/super.c:1444 ovl_fill_super+0x19d7/0x2790 fs/overlayfs/super.c:2000 mount_nodev+0x52/0xe0 fs/super.c:1405 legacy_get_tree+0xea/0x180 fs/fs_context.c:610 vfs_get_tree+0x88/0x270 fs/super.c:1489 do_new_mount+0x289/0xad0 fs/namespace.c:3145 do_mount fs/namespace.c:3488 [inline] __do_sys_mount fs/namespace.c:3697 [inline] __se_sys_mount+0x2d3/0x3c0 fs/namespace.c:3674 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 -> #3 (&sbi->cp_rwsem){++++}-{3:3}: lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668 down_read+0x39/0x50 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+0x12a/0x740 fs/f2fs/file.c:688 f2fs_truncate_blocks+0x10b/0x300 fs/f2fs/file.c:751 f2fs_truncate+0x363/0x5b0 fs/f2fs/file.c:803 f2fs_setattr+0xb5b/0x1120 fs/f2fs/file.c:1010 notify_change+0xe50/0x1100 fs/attr.c:482 ovl_do_notify_change fs/overlayfs/overlayfs.h:144 [inline] ovl_setattr+0x321/0x4a0 fs/overlayfs/inode.c:83 notify_change+0xe50/0x1100 fs/attr.c:482 do_truncate+0x200/0x2f0 fs/open.c:65 handle_truncate fs/namei.c:3216 [inline] do_open fs/namei.c:3561 [inline] path_openat+0x272b/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 -> #2 (mapping.invalidate_lock#7){++++}-{3:3}: lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668 down_read+0x39/0x50 kernel/locking/rwsem.c:1509 filemap_invalidate_lock_shared include/linux/fs.h:811 [inline] filemap_fault+0x2fb/0x1060 mm/filemap.c:3146 f2fs_filemap_fault+0x75/0xb0 fs/f2fs/file.c:44 __do_fault+0x136/0x4f0 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+0x18bc/0x26b0 mm/memory.c:5219 do_user_addr_fault+0x69b/0xcb0 arch/x86/mm/fault.c:1428 handle_page_fault arch/x86/mm/fault.c:1519 [inline] exc_page_fault+0x7a/0x110 arch/x86/mm/fault.c:1575 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570 -> #1 (&mm->mmap_lock){++++}-{3:3}: lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668 __might_fault+0xb2/0x110 mm/memory.c:5647 _copy_to_user+0x26/0x130 lib/usercopy.c:29 copy_to_user include/linux/uaccess.h:169 [inline] f2fs_ioc_get_encryption_pwsalt fs/f2fs/file.c:2365 [inline] __f2fs_ioctl+0xaf72/0xb540 fs/f2fs/file.c:4169 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:856 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 (&sbi->sb_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_write+0x9c/0x270 kernel/locking/rwsem.c:1562 f2fs_down_write fs/f2fs/f2fs.h:2213 [inline] f2fs_handle_error+0xe0/0x230 fs/f2fs/super.c:3926 f2fs_check_nid_range fs/f2fs/node.c:39 [inline] __get_node_page+0xd9a/0x1570 fs/f2fs/node.c:1415 read_xattr_block fs/f2fs/xattr.c:305 [inline] lookup_all_xattrs fs/f2fs/xattr.c:354 [inline] f2fs_getxattr+0x743/0x1490 fs/f2fs/xattr.c:531 __f2fs_get_acl+0x52/0x900 fs/f2fs/acl.c:179 f2fs_acl_create fs/f2fs/acl.c:377 [inline] f2fs_init_acl+0xd2/0x9b0 fs/f2fs/acl.c:420 f2fs_init_inode_metadata+0x99a/0xf80 fs/f2fs/dir.c:591 f2fs_add_regular_entry+0x8ce/0xea0 fs/f2fs/dir.c:775 f2fs_add_dentry fs/f2fs/dir.c:816 [inline] f2fs_do_add_link+0x2a7/0x470 fs/f2fs/dir.c:855 f2fs_add_link fs/f2fs/f2fs.h:3564 [inline] f2fs_create+0x324/0x530 fs/f2fs/namei.c:363 lookup_open fs/namei.c:3413 [inline] open_last_lookups fs/namei.c:3481 [inline] path_openat+0x12ac/0x2dd0 fs/namei.c:3711 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 other info that might help us debug this: Chain exists of: &sbi->sb_lock --> &sbi->cp_rwsem --> &fi->i_xattr_sem Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&fi->i_xattr_sem); lock(&sbi->cp_rwsem); lock(&fi->i_xattr_sem); lock(&sbi->sb_lock); *** DEADLOCK *** 5 locks held by syz-executor.4/7462: #0: ffff8880342d6460 (sb_writers#18){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:508 #1: ffff888038c66c90 (&type->i_mutex_dir_key#14){++++}-{3:3}, at: inode_lock include/linux/fs.h:756 [inline] #1: ffff888038c66c90 (&type->i_mutex_dir_key#14){++++}-{3:3}, at: open_last_lookups fs/namei.c:3478 [inline] #1: ffff888038c66c90 (&type->i_mutex_dir_key#14){++++}-{3:3}, at: path_openat+0x7b9/0x2dd0 fs/namei.c:3711 #2: ffff88802132c3b0 (&sbi->cp_rwsem){++++}-{3:3}, at: f2fs_down_read fs/f2fs/f2fs.h:2188 [inline] #2: ffff88802132c3b0 (&sbi->cp_rwsem){++++}-{3:3}, at: f2fs_lock_op fs/f2fs/f2fs.h:2231 [inline] #2: ffff88802132c3b0 (&sbi->cp_rwsem){++++}-{3:3}, at: f2fs_create+0x26e/0x530 fs/f2fs/namei.c:362 #3: ffff888038c66778 (&fi->i_sem){++++}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2213 [inline] #3: ffff888038c66778 (&fi->i_sem){++++}-{3:3}, at: f2fs_add_regular_entry+0x8bc/0xea0 fs/f2fs/dir.c:774 #4: ffff888038c67308 (&fi->i_xattr_sem){++++}-{3:3}, at: f2fs_down_read fs/f2fs/f2fs.h:2188 [inline] #4: ffff888038c67308 (&fi->i_xattr_sem){++++}-{3:3}, at: f2fs_getxattr+0x98/0x1490 fs/f2fs/xattr.c:530 stack backtrace: CPU: 1 PID: 7462 Comm: syz-executor.4 Not tainted 6.2.0-rc1-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 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_write+0x9c/0x270 kernel/locking/rwsem.c:1562 f2fs_down_write fs/f2fs/f2fs.h:2213 [inline] f2fs_handle_error+0xe0/0x230 fs/f2fs/super.c:3926 f2fs_check_nid_range fs/f2fs/node.c:39 [inline] __get_node_page+0xd9a/0x1570 fs/f2fs/node.c:1415 read_xattr_block fs/f2fs/xattr.c:305 [inline] lookup_all_xattrs fs/f2fs/xattr.c:354 [inline] f2fs_getxattr+0x743/0x1490 fs/f2fs/xattr.c:531 __f2fs_get_acl+0x52/0x900 fs/f2fs/acl.c:179 f2fs_acl_create fs/f2fs/acl.c:377 [inline] f2fs_init_acl+0xd2/0x9b0 fs/f2fs/acl.c:420 f2fs_init_inode_metadata+0x99a/0xf80 fs/f2fs/dir.c:591 f2fs_add_regular_entry+0x8ce/0xea0 fs/f2fs/dir.c:775 f2fs_add_dentry fs/f2fs/dir.c:816 [inline] f2fs_do_add_link+0x2a7/0x470 fs/f2fs/dir.c:855 f2fs_add_link fs/f2fs/f2fs.h:3564 [inline] f2fs_create+0x324/0x530 fs/f2fs/namei.c:363 lookup_open fs/namei.c:3413 [inline] open_last_lookups fs/namei.c:3481 [inline] path_openat+0x12ac/0x2dd0 fs/namei.c:3711 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 RIP: 0033:0x7f1a59a8c0a9 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:00007f1a5a763168 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f1a59babf80 RCX: 00007f1a59a8c0a9 RDX: 000000000000275a RSI: 00000000200001c0 RDI: ffffffffffffff9c RBP: 00007f1a59ae7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe8c63731f R14: 00007f1a5a763300 R15: 0000000000022000