====================================================== WARNING: possible circular locking dependency detected 6.1.98-syzkaller #0 Not tainted ------------------------------------------------------ syz.1.1040/7170 is trying to acquire lock: ffff88805c9e4030 (&ea_inode->i_rwsem#8/1){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline] ffff88805c9e4030 (&ea_inode->i_rwsem#8/1){+.+.}-{3:3}, at: ext4_xattr_inode_iget+0x425/0x5e0 fs/ext4/xattr.c:425 but task is already holding lock: ffff88805cb68c90 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_truncate+0x999/0x1290 fs/ext4/inode.c:4272 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&ei->i_data_sem/3){++++}-{3:3}: lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 down_write+0x36/0x60 kernel/locking/rwsem.c:1573 ext4_update_i_disksize fs/ext4/ext4.h:3377 [inline] ext4_xattr_inode_write fs/ext4/xattr.c:1397 [inline] ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1545 [inline] ext4_xattr_set_entry+0x34be/0x3fb0 fs/ext4/xattr.c:1669 ext4_xattr_ibody_set+0x11d/0x330 fs/ext4/xattr.c:2237 ext4_xattr_set_handle+0xc72/0x1560 fs/ext4/xattr.c:2394 ext4_xattr_set+0x231/0x3d0 fs/ext4/xattr.c:2508 __vfs_setxattr+0x3e7/0x420 fs/xattr.c:182 __vfs_setxattr_noperm+0x12a/0x5e0 fs/xattr.c:216 vfs_setxattr+0x21d/0x420 fs/xattr.c:309 do_setxattr fs/xattr.c:594 [inline] setxattr+0x250/0x2b0 fs/xattr.c:617 path_setxattr+0x1bc/0x2a0 fs/xattr.c:636 __do_sys_lsetxattr fs/xattr.c:659 [inline] __se_sys_lsetxattr fs/xattr.c:655 [inline] __x64_sys_lsetxattr+0xb4/0xd0 fs/xattr.c:655 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 -> #0 (&ea_inode->i_rwsem#8/1){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 down_write+0x36/0x60 kernel/locking/rwsem.c:1573 inode_lock include/linux/fs.h:758 [inline] ext4_xattr_inode_iget+0x425/0x5e0 fs/ext4/xattr.c:425 ext4_xattr_inode_get+0x17d/0x9a0 fs/ext4/xattr.c:485 ext4_xattr_move_to_block fs/ext4/xattr.c:2590 [inline] ext4_xattr_make_inode_space fs/ext4/xattr.c:2692 [inline] ext4_expand_extra_isize_ea+0xe70/0x1bb0 fs/ext4/xattr.c:2784 __ext4_expand_extra_isize+0x2f7/0x3d0 fs/ext4/inode.c:5919 ext4_try_to_expand_extra_isize fs/ext4/inode.c:5962 [inline] __ext4_mark_inode_dirty+0x54f/0x920 fs/ext4/inode.c:6040 ext4_ext_truncate+0x97/0x360 fs/ext4/extents.c:4430 ext4_truncate+0xa1d/0x1290 fs/ext4/inode.c:4277 ext4_evict_inode+0xb68/0x1150 fs/ext4/inode.c:286 evict+0x2a4/0x620 fs/inode.c:666 __dentry_kill+0x436/0x650 fs/dcache.c:607 dentry_kill+0xbb/0x290 dput+0xfb/0x1d0 fs/dcache.c:914 do_renameat2+0xded/0x1440 fs/namei.c:5031 __do_sys_renameat2 fs/namei.c:5062 [inline] __se_sys_renameat2 fs/namei.c:5059 [inline] __x64_sys_renameat2+0xce/0xe0 fs/namei.c:5059 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ei->i_data_sem/3); lock(&ea_inode->i_rwsem#8/1); lock(&ei->i_data_sem/3); lock(&ea_inode->i_rwsem#8/1); *** DEADLOCK *** 7 locks held by syz.1.1040/7170: #0: ffff8880258f0460 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393 #1: ffff8880258f0748 (&type->s_vfs_rename_key#2){+.+.}-{3:3}, at: lock_rename fs/namei.c:3040 [inline] #1: ffff8880258f0748 (&type->s_vfs_rename_key#2){+.+.}-{3:3}, at: do_renameat2+0x5a0/0x1440 fs/namei.c:4968 #2: ffff888072aab628 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: lock_rename fs/namei.c:3041 [inline] #2: ffff888072aab628 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: do_renameat2+0x61e/0x1440 fs/namei.c:4968 #3: ffff88805cb6c030 (&type->i_mutex_dir_key#3/5){+.+.}-{3:3}, at: do_renameat2+0x65a/0x1440 fs/namei.c:4968 #4: ffff8880258f0650 (sb_internal){.+.+}-{0:0}, at: __sb_start_write include/linux/fs.h:1891 [inline] #4: ffff8880258f0650 (sb_internal){.+.+}-{0:0}, at: sb_start_intwrite include/linux/fs.h:2013 [inline] #4: ffff8880258f0650 (sb_internal){.+.+}-{0:0}, at: ext4_evict_inode+0x46d/0x1150 fs/ext4/inode.c:240 #5: ffff88805cb68c90 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_truncate+0x999/0x1290 fs/ext4/inode.c:4272 #6: ffff88805cb68ad0 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_trylock_xattr fs/ext4/xattr.h:162 [inline] #6: ffff88805cb68ad0 (&ei->xattr_sem){++++}-{3:3}, at: ext4_try_to_expand_extra_isize fs/ext4/inode.c:5959 [inline] #6: ffff88805cb68ad0 (&ei->xattr_sem){++++}-{3:3}, at: __ext4_mark_inode_dirty+0x4b0/0x920 fs/ext4/inode.c:6040 stack backtrace: CPU: 1 PID: 7170 Comm: syz.1.1040 Not tainted 6.1.98-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170 check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 down_write+0x36/0x60 kernel/locking/rwsem.c:1573 inode_lock include/linux/fs.h:758 [inline] ext4_xattr_inode_iget+0x425/0x5e0 fs/ext4/xattr.c:425 ext4_xattr_inode_get+0x17d/0x9a0 fs/ext4/xattr.c:485 ext4_xattr_move_to_block fs/ext4/xattr.c:2590 [inline] ext4_xattr_make_inode_space fs/ext4/xattr.c:2692 [inline] ext4_expand_extra_isize_ea+0xe70/0x1bb0 fs/ext4/xattr.c:2784 __ext4_expand_extra_isize+0x2f7/0x3d0 fs/ext4/inode.c:5919 ext4_try_to_expand_extra_isize fs/ext4/inode.c:5962 [inline] __ext4_mark_inode_dirty+0x54f/0x920 fs/ext4/inode.c:6040 ext4_ext_truncate+0x97/0x360 fs/ext4/extents.c:4430 ext4_truncate+0xa1d/0x1290 fs/ext4/inode.c:4277 ext4_evict_inode+0xb68/0x1150 fs/ext4/inode.c:286 evict+0x2a4/0x620 fs/inode.c:666 __dentry_kill+0x436/0x650 fs/dcache.c:607 dentry_kill+0xbb/0x290 dput+0xfb/0x1d0 fs/dcache.c:914 do_renameat2+0xded/0x1440 fs/namei.c:5031 __do_sys_renameat2 fs/namei.c:5062 [inline] __se_sys_renameat2 fs/namei.c:5059 [inline] __x64_sys_renameat2+0xce/0xe0 fs/namei.c:5059 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7f4915b75bd9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f49159de048 EFLAGS: 00000246 ORIG_RAX: 000000000000013c RAX: ffffffffffffffda RBX: 00007f4915d041e8 RCX: 00007f4915b75bd9 RDX: 0000000000000006 RSI: 0000000020000080 RDI: 0000000000000007 RBP: 00007f4915be4e60 R08: 0000000000000000 R09: 0000000000000000 R10: 00000000200000c0 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000006e R14: 00007f4915d041e8 R15: 00007ffd65c0adc8