loop2: detected capacity change from 0 to 512
EXT4-fs (loop2): 1 truncate cleaned up
======================================================
WARNING: possible circular locking dependency detected
6.6.0-rc5-syzkaller-00055-g1c8b86a3799f #0 Not tainted
------------------------------------------------------
syz-executor.2/14277 is trying to acquire lock:
ffff888066f4b6c0 (&ea_inode->i_rwsem#7/1){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:802 [inline]
ffff888066f4b6c0 (&ea_inode->i_rwsem#7/1){+.+.}-{3:3}, at: ext4_xattr_inode_iget+0x173/0x430 fs/ext4/xattr.c:461
but task is already holding lock:
ffff8880323ed708 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x1b6f/0x2990 fs/ext4/inode.c:5431
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&ei->i_data_sem/3){++++}-{3:3}:
down_write+0x93/0x200 kernel/locking/rwsem.c:1573
ext4_update_i_disksize fs/ext4/ext4.h:3369 [inline]
ext4_xattr_inode_write fs/ext4/xattr.c:1446 [inline]
ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1594 [inline]
ext4_xattr_set_entry+0x33dd/0x3ca0 fs/ext4/xattr.c:1719
ext4_xattr_ibody_set+0x126/0x380 fs/ext4/xattr.c:2287
ext4_xattr_set_handle+0x936/0x1420 fs/ext4/xattr.c:2444
ext4_xattr_set+0x149/0x370 fs/ext4/xattr.c:2558
__vfs_setxattr+0x173/0x1d0 fs/xattr.c:201
__vfs_setxattr_noperm+0x127/0x5e0 fs/xattr.c:235
__vfs_setxattr_locked+0x17e/0x250 fs/xattr.c:296
vfs_setxattr+0x146/0x350 fs/xattr.c:322
do_setxattr+0x142/0x170 fs/xattr.c:630
setxattr+0x159/0x170 fs/xattr.c:653
path_setxattr+0x1a3/0x1d0 fs/xattr.c:672
__do_sys_lsetxattr fs/xattr.c:695 [inline]
__se_sys_lsetxattr fs/xattr.c:691 [inline]
__x64_sys_lsetxattr+0xc1/0x160 fs/xattr.c:691
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
-> #0 (&ea_inode->i_rwsem#7/1){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain kernel/locking/lockdep.c:3868 [inline]
__lock_acquire+0x2e3d/0x5de0 kernel/locking/lockdep.c:5136
lock_acquire kernel/locking/lockdep.c:5753 [inline]
lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5718
down_write+0x93/0x200 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:802 [inline]
ext4_xattr_inode_iget+0x173/0x430 fs/ext4/xattr.c:461
ext4_xattr_inode_get+0x170/0x840 fs/ext4/xattr.c:535
ext4_xattr_move_to_block fs/ext4/xattr.c:2640 [inline]
ext4_xattr_make_inode_space fs/ext4/xattr.c:2742 [inline]
ext4_expand_extra_isize_ea+0x125a/0x1b20 fs/ext4/xattr.c:2834
__ext4_expand_extra_isize+0x342/0x470 fs/ext4/inode.c:5803
ext4_try_to_expand_extra_isize fs/ext4/inode.c:5846 [inline]
__ext4_mark_inode_dirty+0x52b/0x800 fs/ext4/inode.c:5924
ext4_setattr+0x1be3/0x2990 fs/ext4/inode.c:5434
notify_change+0x742/0x11c0 fs/attr.c:499
do_truncate+0x15c/0x220 fs/open.c:66
handle_truncate fs/namei.c:3298 [inline]
do_open fs/namei.c:3643 [inline]
path_openat+0x23f1/0x29c0 fs/namei.c:3796
do_filp_open+0x1de/0x430 fs/namei.c:3823
do_sys_openat2+0x176/0x1e0 fs/open.c:1422
do_sys_open fs/open.c:1437 [inline]
__do_sys_creat fs/open.c:1513 [inline]
__se_sys_creat fs/open.c:1507 [inline]
__x64_sys_creat+0xcd/0x120 fs/open.c:1507
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
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#7/1);
lock(&ei->i_data_sem/3);
lock(&ea_inode->i_rwsem#7/1);
*** DEADLOCK ***
5 locks held by syz-executor.2/14277:
#0: ffff8880276c2410 (sb_writers#5){.+.+}-{0:0}, at: do_open fs/namei.c:3632 [inline]
#0: ffff8880276c2410 (sb_writers#5){.+.+}-{0:0}, at: path_openat+0x1e7c/0x29c0 fs/namei.c:3796
#1: ffff8880323ed880 (&sb->s_type->i_mutex_key#7){++++}-{3:3}, at: inode_lock include/linux/fs.h:802 [inline]
#1: ffff8880323ed880 (&sb->s_type->i_mutex_key#7){++++}-{3:3}, at: do_truncate+0x14b/0x220 fs/open.c:64
#2: ffff8880323eda20 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_invalidate_lock include/linux/fs.h:847 [inline]
#2: ffff8880323eda20 (mapping.invalidate_lock){++++}-{3:3}, at: ext4_setattr+0xdf1/0x2990 fs/ext4/inode.c:5393
#3: ffff8880323ed708 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x1b6f/0x2990 fs/ext4/inode.c:5431
#4: ffff8880323ed548 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_trylock_xattr fs/ext4/xattr.h:162 [inline]
#4: ffff8880323ed548 (&ei->xattr_sem){++++}-{3:3}, at: ext4_try_to_expand_extra_isize fs/ext4/inode.c:5843 [inline]
#4: ffff8880323ed548 (&ei->xattr_sem){++++}-{3:3}, at: __ext4_mark_inode_dirty+0x4a1/0x800 fs/ext4/inode.c:5924
stack backtrace:
CPU: 0 PID: 14277 Comm: syz-executor.2 Not tainted 6.6.0-rc5-syzkaller-00055-g1c8b86a3799f #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
check_noncircular+0x311/0x3f0 kernel/locking/lockdep.c:2187
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain kernel/locking/lockdep.c:3868 [inline]
__lock_acquire+0x2e3d/0x5de0 kernel/locking/lockdep.c:5136
lock_acquire kernel/locking/lockdep.c:5753 [inline]
lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5718
down_write+0x93/0x200 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:802 [inline]
ext4_xattr_inode_iget+0x173/0x430 fs/ext4/xattr.c:461
ext4_xattr_inode_get+0x170/0x840 fs/ext4/xattr.c:535
ext4_xattr_move_to_block fs/ext4/xattr.c:2640 [inline]
ext4_xattr_make_inode_space fs/ext4/xattr.c:2742 [inline]
ext4_expand_extra_isize_ea+0x125a/0x1b20 fs/ext4/xattr.c:2834
__ext4_expand_extra_isize+0x342/0x470 fs/ext4/inode.c:5803
ext4_try_to_expand_extra_isize fs/ext4/inode.c:5846 [inline]
__ext4_mark_inode_dirty+0x52b/0x800 fs/ext4/inode.c:5924
ext4_setattr+0x1be3/0x2990 fs/ext4/inode.c:5434
notify_change+0x742/0x11c0 fs/attr.c:499
do_truncate+0x15c/0x220 fs/open.c:66
handle_truncate fs/namei.c:3298 [inline]
do_open fs/namei.c:3643 [inline]
path_openat+0x23f1/0x29c0 fs/namei.c:3796
do_filp_open+0x1de/0x430 fs/namei.c:3823
do_sys_openat2+0x176/0x1e0 fs/open.c:1422
do_sys_open fs/open.c:1437 [inline]
__do_sys_creat fs/open.c:1513 [inline]
__se_sys_creat fs/open.c:1507 [inline]
__x64_sys_creat+0xcd/0x120 fs/open.c:1507
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f0ea3e7cae9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f0ea4b900c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
RAX: ffffffffffffffda RBX: 00007f0ea3f9bf80 RCX: 00007f0ea3e7cae9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000340
RBP: 00007f0ea4b90120 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002
R13: 000000000000000b R14: 00007f0ea3f9bf80 R15: 00007fff7bd4a738
FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 0, space 0, times 0
CPU: 0 PID: 14277 Comm: syz-executor.2 Not tainted 6.6.0-rc5-syzkaller-00055-g1c8b86a3799f #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x125/0x1b0 lib/dump_stack.c:106
fail_dump lib/fault-inject.c:52 [inline]
should_fail_ex+0x496/0x5b0 lib/fault-inject.c:153
should_failslab+0x9/0x20 mm/slab_common.c:1509
slab_pre_alloc_hook mm/slab.h:711 [inline]
slab_alloc_node mm/slab.c:3221 [inline]
slab_alloc mm/slab.c:3246 [inline]
__kmem_cache_alloc_lru mm/slab.c:3423 [inline]
kmem_cache_alloc+0x61/0x400 mm/slab.c:3432
kmem_cache_zalloc include/linux/slab.h:710 [inline]
ext4_mb_new_blocks+0x8f6/0x4af0 fs/ext4/mballoc.c:6205
ext4_alloc_branch fs/ext4/indirect.c:340 [inline]
ext4_ind_map_blocks+0x183d/0x26e0 fs/ext4/indirect.c:635
ext4_map_blocks+0x874/0x1770 fs/ext4/inode.c:623
ext4_xattr_inode_write fs/ext4/xattr.c:1400 [inline]
ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1594 [inline]
ext4_xattr_set_entry+0x29c4/0x3ca0 fs/ext4/xattr.c:1719
ext4_xattr_block_set+0x678/0x30e0 fs/ext4/xattr.c:1970
ext4_xattr_move_to_block fs/ext4/xattr.c:2667 [inline]
ext4_xattr_make_inode_space fs/ext4/xattr.c:2742 [inline]
ext4_expand_extra_isize_ea+0x1306/0x1b20 fs/ext4/xattr.c:2834
__ext4_expand_extra_isize+0x342/0x470 fs/ext4/inode.c:5803
ext4_try_to_expand_extra_isize fs/ext4/inode.c:5846 [inline]
__ext4_mark_inode_dirty+0x52b/0x800 fs/ext4/inode.c:5924
ext4_setattr+0x1be3/0x2990 fs/ext4/inode.c:5434
notify_change+0x742/0x11c0 fs/attr.c:499
do_truncate+0x15c/0x220 fs/open.c:66
handle_truncate fs/namei.c:3298 [inline]
do_open fs/namei.c:3643 [inline]
path_openat+0x23f1/0x29c0 fs/namei.c:3796
do_filp_open+0x1de/0x430 fs/namei.c:3823
do_sys_openat2+0x176/0x1e0 fs/open.c:1422
do_sys_open fs/open.c:1437 [inline]
__do_sys_creat fs/open.c:1513 [inline]
__se_sys_creat fs/open.c:1507 [inline]
__x64_sys_creat+0xcd/0x120 fs/open.c:1507
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f0ea3e7cae9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f0ea4b900c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
RAX: ffffffffffffffda RBX: 00007f0ea3f9bf80 RCX: 00007f0ea3e7cae9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000340
RBP: 00007f0ea4b90120 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002
R13: 000000000000000b R14: 00007f0ea3f9bf80 R15: 00007fff7bd4a738