====================================================== WARNING: possible circular locking dependency detected 5.11.0-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/6606 is trying to acquire lock: ffff8880320c94c8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_lock_xattr fs/ext4/xattr.h:142 [inline] ffff8880320c94c8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_xattr_set_handle+0x12f/0x1070 fs/ext4/xattr.c:2308 but task is already holding lock: ffff888149f388e0 (jbd2_handle){.+.+}-{0:0}, at: start_this_handle+0xd75/0x11b0 fs/jbd2/transaction.c:444 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (jbd2_handle){.+.+}-{0:0}: start_this_handle+0xda4/0x11b0 fs/jbd2/transaction.c:446 jbd2__journal_start+0x385/0x890 fs/jbd2/transaction.c:503 __ext4_journal_start_sb+0x19f/0x3a0 fs/ext4/ext4_jbd2.c:105 __ext4_journal_start fs/ext4/ext4_jbd2.h:320 [inline] ext4_truncate+0x40b/0x10c0 fs/ext4/inode.c:4236 ext4_setattr+0xf81/0x1c90 fs/ext4/inode.c:5506 notify_change+0x748/0xd90 fs/attr.c:336 do_truncate+0xe3/0x190 fs/open.c:64 do_sys_ftruncate+0x4d6/0x680 fs/open.c:195 do_syscall_64+0x2d/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 -> #2 (&ei->i_mmap_sem){++++}-{3:3}: down_write+0x8d/0x150 kernel/locking/rwsem.c:1406 ext4_setattr+0xb30/0x1c90 fs/ext4/inode.c:5431 notify_change+0x748/0xd90 fs/attr.c:336 do_truncate+0xe3/0x190 fs/open.c:64 handle_truncate fs/namei.c:2912 [inline] do_open fs/namei.c:3258 [inline] path_openat+0x1843/0x21d0 fs/namei.c:3371 do_filp_open+0x16d/0x390 fs/namei.c:3398 do_sys_openat2+0x11e/0x360 fs/open.c:1172 do_sys_open fs/open.c:1188 [inline] __do_sys_openat fs/open.c:1204 [inline] __se_sys_openat fs/open.c:1199 [inline] __x64_sys_openat+0x11b/0x1d0 fs/open.c:1199 do_syscall_64+0x2d/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 -> #1 (&ea_inode->i_rwsem#10/1){+.+.}-{3:3}: down_write+0x8d/0x150 kernel/locking/rwsem.c:1406 inode_lock include/linux/fs.h:773 [inline] ext4_xattr_inode_create fs/ext4/xattr.c:1441 [inline] ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1521 [inline] ext4_xattr_set_entry+0x2643/0x36d0 fs/ext4/xattr.c:1649 ext4_xattr_block_set+0x737/0x2820 fs/ext4/xattr.c:1944 ext4_xattr_set_handle+0x9fc/0x1070 fs/ext4/xattr.c:2392 ext4_xattr_set+0x11d/0x2c0 fs/ext4/xattr.c:2493 __vfs_setxattr+0xcf/0x120 fs/xattr.c:177 __vfs_setxattr_noperm+0xe6/0x470 fs/xattr.c:208 vfs_setxattr+0x10c/0x2c0 fs/xattr.c:291 setxattr+0x14e/0x250 fs/xattr.c:553 path_setxattr+0x115/0x130 fs/xattr.c:572 __do_sys_setxattr fs/xattr.c:587 [inline] __se_sys_setxattr fs/xattr.c:583 [inline] __x64_sys_setxattr+0xbb/0x150 fs/xattr.c:583 do_syscall_64+0x2d/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 -> #0 (&ei->xattr_sem){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:2868 [inline] check_prevs_add kernel/locking/lockdep.c:2993 [inline] validate_chain kernel/locking/lockdep.c:3608 [inline] __lock_acquire+0x2b2a/0x5500 kernel/locking/lockdep.c:4832 lock_acquire kernel/locking/lockdep.c:5442 [inline] lock_acquire+0x1a8/0x720 kernel/locking/lockdep.c:5407 down_write+0x8d/0x150 kernel/locking/rwsem.c:1406 ext4_write_lock_xattr fs/ext4/xattr.h:142 [inline] ext4_xattr_set_handle+0x12f/0x1070 fs/ext4/xattr.c:2308 ext4_xattr_set+0x11d/0x2c0 fs/ext4/xattr.c:2493 __vfs_setxattr+0xcf/0x120 fs/xattr.c:177 __vfs_setxattr_noperm+0xe6/0x470 fs/xattr.c:208 vfs_setxattr+0x10c/0x2c0 fs/xattr.c:291 setxattr+0x14e/0x250 fs/xattr.c:553 path_setxattr+0x115/0x130 fs/xattr.c:572 __do_sys_setxattr fs/xattr.c:587 [inline] __se_sys_setxattr fs/xattr.c:583 [inline] __x64_sys_setxattr+0xbb/0x150 fs/xattr.c:583 do_syscall_64+0x2d/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 other info that might help us debug this: Chain exists of: &ei->xattr_sem --> &ei->i_mmap_sem --> jbd2_handle Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(jbd2_handle); lock(&ei->i_mmap_sem); lock(jbd2_handle); lock(&ei->xattr_sem); *** DEADLOCK *** 3 locks held by syz-executor.0/6606: #0: ffff888149f34460 (sb_writers#5){.+.+}-{0:0}, at: path_setxattr+0xa0/0x130 fs/xattr.c:570 #1: ffff8880320c9888 (&type->i_mutex_dir_key#4){++++}-{3:3}, at: inode_lock include/linux/fs.h:773 [inline] #1: ffff8880320c9888 (&type->i_mutex_dir_key#4){++++}-{3:3}, at: vfs_setxattr+0xef/0x2c0 fs/xattr.c:290 #2: ffff888149f388e0 (jbd2_handle){.+.+}-{0:0}, at: start_this_handle+0xd75/0x11b0 fs/jbd2/transaction.c:444 stack backtrace: CPU: 1 PID: 6606 Comm: syz-executor.0 Not tainted 5.11.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x9a/0xcc lib/dump_stack.c:120 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2117 check_prev_add kernel/locking/lockdep.c:2868 [inline] check_prevs_add kernel/locking/lockdep.c:2993 [inline] validate_chain kernel/locking/lockdep.c:3608 [inline] __lock_acquire+0x2b2a/0x5500 kernel/locking/lockdep.c:4832 lock_acquire kernel/locking/lockdep.c:5442 [inline] lock_acquire+0x1a8/0x720 kernel/locking/lockdep.c:5407 down_write+0x8d/0x150 kernel/locking/rwsem.c:1406 ext4_write_lock_xattr fs/ext4/xattr.h:142 [inline] ext4_xattr_set_handle+0x12f/0x1070 fs/ext4/xattr.c:2308 ext4_xattr_set+0x11d/0x2c0 fs/ext4/xattr.c:2493 __vfs_setxattr+0xcf/0x120 fs/xattr.c:177 __vfs_setxattr_noperm+0xe6/0x470 fs/xattr.c:208 vfs_setxattr+0x10c/0x2c0 fs/xattr.c:291 setxattr+0x14e/0x250 fs/xattr.c:553 path_setxattr+0x115/0x130 fs/xattr.c:572 __do_sys_setxattr fs/xattr.c:587 [inline] __se_sys_setxattr fs/xattr.c:583 [inline] __x64_sys_setxattr+0xbb/0x150 fs/xattr.c:583 do_syscall_64+0x2d/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f2321395169 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:00007f23206e6168 EFLAGS: 00000246 ORIG_RAX: 00000000000000bc RAX: ffffffffffffffda RBX: 00007f23214b5050 RCX: 00007f2321395169 RDX: 00000000200005c0 RSI: 0000000020000180 RDI: 0000000020000080 RBP: 00007f23213f0ca1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000002000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff05de319f R14: 00007f23206e6300 R15: 0000000000022000