====================================================== WARNING: possible circular locking dependency detected 6.4.0-rc2-syzkaller-dirty #0 Not tainted ------------------------------------------------------ syz-executor.0/5501 is trying to acquire lock: ffff8880746780c8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_lock_xattr fs/ext4/xattr.h:155 [inline] ffff8880746780c8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_xattr_set_handle+0x160/0x1510 fs/ext4/xattr.c:2374 but task is already holding lock: ffff88802c4b0990 (jbd2_handle){.+.+}-{0:0}, at: start_this_handle+0xfb4/0x14e0 fs/jbd2/transaction.c:461 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (jbd2_handle){.+.+}-{0:0}: start_this_handle+0xfe7/0x14e0 fs/jbd2/transaction.c:463 jbd2__journal_start+0x390/0x850 fs/jbd2/transaction.c:520 __ext4_journal_start_sb+0x411/0x5d0 fs/ext4/ext4_jbd2.c:111 __ext4_journal_start fs/ext4/ext4_jbd2.h:326 [inline] ext4_truncate+0x54f/0x1340 fs/ext4/inode.c:4126 ext4_setattr+0x1b24/0x2880 fs/ext4/inode.c:5436 notify_change+0xb2c/0x1180 fs/attr.c:483 do_truncate+0x143/0x200 fs/open.c:66 do_sys_ftruncate+0x53a/0x770 fs/open.c:194 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 (mapping.invalidate_lock){++++}-{3:3}: down_write+0x92/0x200 kernel/locking/rwsem.c:1573 filemap_invalidate_lock include/linux/fs.h:820 [inline] ext4_setattr+0x6f2/0x2880 fs/ext4/inode.c:5359 notify_change+0xb2c/0x1180 fs/attr.c:483 do_truncate+0x143/0x200 fs/open.c:66 handle_truncate fs/namei.c:3295 [inline] do_open fs/namei.c:3640 [inline] path_openat+0x2083/0x2750 fs/namei.c:3791 do_filp_open+0x1ba/0x410 fs/namei.c:3818 do_sys_openat2+0x16d/0x4c0 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_openat fs/open.c:1388 [inline] __se_sys_openat fs/open.c:1383 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1383 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 (&ea_inode->i_rwsem#8/1){+.+.}-{3:3}: down_write+0x92/0x200 kernel/locking/rwsem.c:1573 inode_lock include/linux/fs.h:775 [inline] ext4_xattr_inode_create fs/ext4/xattr.c:1526 [inline] ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1609 [inline] ext4_xattr_set_entry+0x2c06/0x3b20 fs/ext4/xattr.c:1738 ext4_xattr_block_set+0xcb7/0x3030 fs/ext4/xattr.c:2044 ext4_xattr_set_handle+0xd8a/0x1510 fs/ext4/xattr.c:2459 ext4_xattr_set+0x144/0x360 fs/ext4/xattr.c:2561 __vfs_setxattr+0x173/0x1e0 fs/xattr.c:201 __vfs_setxattr_noperm+0x129/0x5f0 fs/xattr.c:235 __vfs_setxattr_locked+0x1d3/0x260 fs/xattr.c:296 vfs_setxattr+0x143/0x340 fs/xattr.c:322 do_setxattr+0x147/0x190 fs/xattr.c:630 setxattr+0x146/0x160 fs/xattr.c:653 path_setxattr+0x197/0x1c0 fs/xattr.c:672 __do_sys_setxattr fs/xattr.c:688 [inline] __se_sys_setxattr fs/xattr.c:684 [inline] __x64_sys_setxattr+0xc4/0x160 fs/xattr.c:684 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 (&ei->xattr_sem){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3108 [inline] check_prevs_add kernel/locking/lockdep.c:3227 [inline] validate_chain kernel/locking/lockdep.c:3842 [inline] __lock_acquire+0x2f21/0x5df0 kernel/locking/lockdep.c:5074 lock_acquire kernel/locking/lockdep.c:5691 [inline] lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5656 down_write+0x92/0x200 kernel/locking/rwsem.c:1573 ext4_write_lock_xattr fs/ext4/xattr.h:155 [inline] ext4_xattr_set_handle+0x160/0x1510 fs/ext4/xattr.c:2374 ext4_xattr_set+0x144/0x360 fs/ext4/xattr.c:2561 __vfs_setxattr+0x173/0x1e0 fs/xattr.c:201 __vfs_setxattr_noperm+0x129/0x5f0 fs/xattr.c:235 __vfs_setxattr_locked+0x1d3/0x260 fs/xattr.c:296 vfs_setxattr+0x143/0x340 fs/xattr.c:322 do_setxattr+0x147/0x190 fs/xattr.c:630 setxattr+0x146/0x160 fs/xattr.c:653 path_setxattr+0x197/0x1c0 fs/xattr.c:672 __do_sys_setxattr fs/xattr.c:688 [inline] __se_sys_setxattr fs/xattr.c:684 [inline] __x64_sys_setxattr+0xc4/0x160 fs/xattr.c:684 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: &ei->xattr_sem --> mapping.invalidate_lock --> jbd2_handle Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(jbd2_handle); lock(mapping.invalidate_lock); lock(jbd2_handle); lock(&ei->xattr_sem); *** DEADLOCK *** 3 locks held by syz-executor.0/5501: #0: ffff88802c3f8460 (sb_writers#4){.+.+}-{0:0}, at: path_setxattr+0xb2/0x1c0 fs/xattr.c:670 #1: ffff888074678400 (&type->i_mutex_dir_key#3){++++}-{3:3}, at: inode_lock include/linux/fs.h:775 [inline] #1: ffff888074678400 (&type->i_mutex_dir_key#3){++++}-{3:3}, at: vfs_setxattr+0x120/0x340 fs/xattr.c:321 #2: ffff88802c4b0990 (jbd2_handle){.+.+}-{0:0}, at: start_this_handle+0xfb4/0x14e0 fs/jbd2/transaction.c:461 stack backtrace: CPU: 0 PID: 5501 Comm: syz-executor.0 Not tainted 6.4.0-rc2-syzkaller-dirty #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2188 check_prev_add kernel/locking/lockdep.c:3108 [inline] check_prevs_add kernel/locking/lockdep.c:3227 [inline] validate_chain kernel/locking/lockdep.c:3842 [inline] __lock_acquire+0x2f21/0x5df0 kernel/locking/lockdep.c:5074 lock_acquire kernel/locking/lockdep.c:5691 [inline] lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5656 down_write+0x92/0x200 kernel/locking/rwsem.c:1573 ext4_write_lock_xattr fs/ext4/xattr.h:155 [inline] ext4_xattr_set_handle+0x160/0x1510 fs/ext4/xattr.c:2374 ext4_xattr_set+0x144/0x360 fs/ext4/xattr.c:2561 __vfs_setxattr+0x173/0x1e0 fs/xattr.c:201 __vfs_setxattr_noperm+0x129/0x5f0 fs/xattr.c:235 __vfs_setxattr_locked+0x1d3/0x260 fs/xattr.c:296 vfs_setxattr+0x143/0x340 fs/xattr.c:322 do_setxattr+0x147/0x190 fs/xattr.c:630 setxattr+0x146/0x160 fs/xattr.c:653 path_setxattr+0x197/0x1c0 fs/xattr.c:672 __do_sys_setxattr fs/xattr.c:688 [inline] __se_sys_setxattr fs/xattr.c:684 [inline] __x64_sys_setxattr+0xc4/0x160 fs/xattr.c:684 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:0x7f3060a8c169 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:00007f30617c8168 EFLAGS: 00000246 ORIG_RAX: 00000000000000bc RAX: ffffffffffffffda RBX: 00007f3060bac050 RCX: 00007f3060a8c169 RDX: 00000000200005c0 RSI: 0000000020000180 RDI: 0000000020000080 RBP: 00007f3060ae7ca1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000002000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffcf5737d4f R14: 00007f30617c8300 R15: 0000000000022000