[v6.6] possible deadlock in ext4_xattr_inode_lookup_create

2 views
Skip to first unread message

syzbot

unread,
Jun 26, 2025, 12:08:35 PM6/26/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 6282921b6825 Linux 6.6.94
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1174008c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=96da6b2210cda427
dashboard link: https://syzkaller.appspot.com/bug?extid=fe415608f4e4cf970968
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a3bf0d8e22b2/disk-6282921b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d1d442f782d0/vmlinux-6282921b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a8378f4b7e1b/bzImage-6282921b.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+fe4156...@syzkaller.appspotmail.com

EXT4-fs (loop7): 1 truncate cleaned up
EXT4-fs (loop7): mounted filesystem 00000000-0000-0000-0000-000000000000 r/w without journal. Quota mode: none.
======================================================
WARNING: possible circular locking dependency detected
6.6.94-syzkaller #0 Not tainted
------------------------------------------------------
syz.7.1233/9501 is trying to acquire lock:
ffff888076f78410 (&sb->s_type->i_mutex_key#8/1){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline]
ffff888076f78410 (&sb->s_type->i_mutex_key#8/1){+.+.}-{3:3}, at: ext4_xattr_inode_create fs/ext4/xattr.c:1523 [inline]
ffff888076f78410 (&sb->s_type->i_mutex_key#8/1){+.+.}-{3:3}, at: ext4_xattr_inode_lookup_create+0x1917/0x1d80 fs/ext4/xattr.c:1605

but task is already holding lock:
ffff888076f85c88 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x15fa/0x1c90 fs/ext4/inode.c:5575

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+0x97/0x1f0 kernel/locking/rwsem.c:1573
ext4_update_i_disksize fs/ext4/ext4.h:3375 [inline]
ext4_xattr_inode_write fs/ext4/xattr.c:1461 [inline]
ext4_xattr_inode_lookup_create+0x15fe/0x1d80 fs/ext4/xattr.c:1611
ext4_xattr_ibody_set+0x202/0x6a0 fs/ext4/xattr.c:2273
ext4_xattr_set_handle+0xaad/0x1290 fs/ext4/xattr.c:2450
ext4_xattr_set+0x22d/0x320 fs/ext4/xattr.c:2564
__vfs_setxattr+0x431/0x470 fs/xattr.c:201
__vfs_setxattr_noperm+0x12d/0x5e0 fs/xattr.c:235
vfs_setxattr+0x16c/0x2f0 fs/xattr.c:322
do_setxattr fs/xattr.c:630 [inline]
path_setxattr+0x362/0x550 fs/xattr.c:659
__do_sys_setxattr fs/xattr.c:677 [inline]
__se_sys_setxattr fs/xattr.c:673 [inline]
__x64_sys_setxattr+0xbb/0xd0 fs/xattr.c:673
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&sb->s_type->i_mutex_key#8/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:3869 [inline]
__lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
down_write+0x97/0x1f0 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:804 [inline]
ext4_xattr_inode_create fs/ext4/xattr.c:1523 [inline]
ext4_xattr_inode_lookup_create+0x1917/0x1d80 fs/ext4/xattr.c:1605
ext4_xattr_block_set+0x23e/0x32a0 fs/ext4/xattr.c:1925
ext4_xattr_move_to_block fs/ext4/xattr.c:2674 [inline]
ext4_xattr_make_inode_space fs/ext4/xattr.c:2749 [inline]
ext4_expand_extra_isize_ea+0x10ea/0x19e0 fs/ext4/xattr.c:2841
__ext4_expand_extra_isize+0x306/0x400 fs/ext4/inode.c:5947
ext4_try_to_expand_extra_isize fs/ext4/inode.c:5990 [inline]
__ext4_mark_inode_dirty+0x45d/0x6e0 fs/ext4/inode.c:6068
ext4_setattr+0x1673/0x1c90 fs/ext4/inode.c:5578
notify_change+0xb0d/0xe10 fs/attr.c:499
do_truncate+0x19b/0x220 fs/open.c:66
handle_truncate fs/namei.c:3291 [inline]
do_open fs/namei.c:3636 [inline]
path_openat+0x298c/0x3190 fs/namei.c:3789
do_filp_open+0x1c5/0x3d0 fs/namei.c:3816
do_sys_openat2+0x12c/0x1c0 fs/open.c:1419
do_sys_open fs/open.c:1434 [inline]
__do_sys_openat fs/open.c:1450 [inline]
__se_sys_openat fs/open.c:1445 [inline]
__x64_sys_openat+0x139/0x160 fs/open.c:1445
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/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(&sb->s_type->i_mutex_key#8/1);
lock(&ei->i_data_sem/3);
lock(&sb->s_type->i_mutex_key#8/1);

*** DEADLOCK ***

5 locks held by syz.7.1233/9501:
#0: ffff88807ed34418 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:403
#1: ffff888076f85e10 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline]
#1: ffff888076f85e10 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: do_truncate+0x187/0x220 fs/open.c:64
#2: ffff888076f85fa0 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_invalidate_lock include/linux/fs.h:849 [inline]
#2: ffff888076f85fa0 (mapping.invalidate_lock){++++}-{3:3}, at: ext4_setattr+0xef3/0x1c90 fs/ext4/inode.c:5523
#3: ffff888076f85c88 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x15fa/0x1c90 fs/ext4/inode.c:5575
#4: ffff888076f85ac8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_trylock_xattr fs/ext4/xattr.h:162 [inline]
#4: ffff888076f85ac8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_try_to_expand_extra_isize fs/ext4/inode.c:5987 [inline]
#4: ffff888076f85ac8 (&ei->xattr_sem){++++}-{3:3}, at: __ext4_mark_inode_dirty+0x3dc/0x6e0 fs/ext4/inode.c:6068

stack backtrace:
CPU: 0 PID: 9501 Comm: syz.7.1233 Not tainted 6.6.94-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
<TASK>
dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
check_noncircular+0x2bd/0x3c0 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:3869 [inline]
__lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
down_write+0x97/0x1f0 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:804 [inline]
ext4_xattr_inode_create fs/ext4/xattr.c:1523 [inline]
ext4_xattr_inode_lookup_create+0x1917/0x1d80 fs/ext4/xattr.c:1605
ext4_xattr_block_set+0x23e/0x32a0 fs/ext4/xattr.c:1925
ext4_xattr_move_to_block fs/ext4/xattr.c:2674 [inline]
ext4_xattr_make_inode_space fs/ext4/xattr.c:2749 [inline]
ext4_expand_extra_isize_ea+0x10ea/0x19e0 fs/ext4/xattr.c:2841
__ext4_expand_extra_isize+0x306/0x400 fs/ext4/inode.c:5947
ext4_try_to_expand_extra_isize fs/ext4/inode.c:5990 [inline]
__ext4_mark_inode_dirty+0x45d/0x6e0 fs/ext4/inode.c:6068
ext4_setattr+0x1673/0x1c90 fs/ext4/inode.c:5578
notify_change+0xb0d/0xe10 fs/attr.c:499
do_truncate+0x19b/0x220 fs/open.c:66
handle_truncate fs/namei.c:3291 [inline]
do_open fs/namei.c:3636 [inline]
path_openat+0x298c/0x3190 fs/namei.c:3789
do_filp_open+0x1c5/0x3d0 fs/namei.c:3816
do_sys_openat2+0x12c/0x1c0 fs/open.c:1419
do_sys_open fs/open.c:1434 [inline]
__do_sys_openat fs/open.c:1450 [inline]
__se_sys_openat fs/open.c:1445 [inline]
__x64_sys_openat+0x139/0x160 fs/open.c:1445
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f6f8a18e929
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:00007f6f8b02e038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f6f8a3b5fa0 RCX: 00007f6f8a18e929
RDX: 0000000000000242 RSI: 0000200000000040 RDI: ffffffffffffff9c
RBP: 00007f6f8a210b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f6f8a3b5fa0 R15: 00007ffd4336e398
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Jul 5, 2025, 7:49:31 PM7/5/25
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 3f5b4c104b7d Linux 6.6.95
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1094fc8c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=747dbf84b0ecd30c
dashboard link: https://syzkaller.appspot.com/bug?extid=fe415608f4e4cf970968
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12f10bd4580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12cd2f70580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/421f6e2d0cd1/disk-3f5b4c10.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/90250695b20b/vmlinux-3f5b4c10.xz
kernel image: https://storage.googleapis.com/syzbot-assets/32250e77bce9/bzImage-3f5b4c10.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/b27f9efffcc7/mount_0.gz
fsck result: OK (log: https://syzkaller.appspot.com/x/fsck.log?x=12199c8c580000)

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+fe4156...@syzkaller.appspotmail.com

loop0: detected capacity change from 0 to 512
EXT4-fs: Ignoring removed i_version option
EXT4-fs (loop0): encrypted files will use data=ordered instead of data journaling mode
EXT4-fs (loop0): 1 truncate cleaned up
======================================================
WARNING: possible circular locking dependency detected
6.6.95-syzkaller #0 Not tainted
------------------------------------------------------
syz.0.68/6050 is trying to acquire lock:
ffff888075375410 (&sb->s_type->i_mutex_key#8/1){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline]
ffff888075375410 (&sb->s_type->i_mutex_key#8/1){+.+.}-{3:3}, at: ext4_xattr_inode_create fs/ext4/xattr.c:1523 [inline]
ffff888075375410 (&sb->s_type->i_mutex_key#8/1){+.+.}-{3:3}, at: ext4_xattr_inode_lookup_create+0x1917/0x1d80 fs/ext4/xattr.c:1605

but task is already holding lock:
ffff888064570c88 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x15fa/0x1c90 fs/ext4/inode.c:5581

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+0x97/0x1f0 kernel/locking/rwsem.c:1573
ext4_update_i_disksize fs/ext4/ext4.h:3382 [inline]
__ext4_expand_extra_isize+0x306/0x400 fs/ext4/inode.c:5953
ext4_try_to_expand_extra_isize fs/ext4/inode.c:5996 [inline]
__ext4_mark_inode_dirty+0x45d/0x6e0 fs/ext4/inode.c:6074
ext4_setattr+0x1673/0x1c90 fs/ext4/inode.c:5584
notify_change+0xb0d/0xe10 fs/attr.c:499
do_truncate+0x19b/0x220 fs/open.c:66
handle_truncate fs/namei.c:3291 [inline]
do_open fs/namei.c:3636 [inline]
path_openat+0x298c/0x3190 fs/namei.c:3789
do_filp_open+0x1c5/0x3d0 fs/namei.c:3816
do_sys_openat2+0x12c/0x1c0 fs/open.c:1419
do_sys_open fs/open.c:1434 [inline]
__do_sys_openat fs/open.c:1450 [inline]
__se_sys_openat fs/open.c:1445 [inline]
__x64_sys_openat+0x139/0x160 fs/open.c:1445
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/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(&sb->s_type->i_mutex_key#8/1);
lock(&ei->i_data_sem/3);
lock(&sb->s_type->i_mutex_key#8/1);

*** DEADLOCK ***

5 locks held by syz.0.68/6050:
#0: ffff88802e6a2418 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:403
#1: ffff888064570e10 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline]
#1: ffff888064570e10 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: do_truncate+0x187/0x220 fs/open.c:64
#2: ffff888064570fa0 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_invalidate_lock include/linux/fs.h:849 [inline]
#2: ffff888064570fa0 (mapping.invalidate_lock){++++}-{3:3}, at: ext4_setattr+0xef3/0x1c90 fs/ext4/inode.c:5529
#3: ffff888064570c88 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x15fa/0x1c90 fs/ext4/inode.c:5581
#4: ffff888064570ac8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_trylock_xattr fs/ext4/xattr.h:162 [inline]
#4: ffff888064570ac8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_try_to_expand_extra_isize fs/ext4/inode.c:5993 [inline]
#4: ffff888064570ac8 (&ei->xattr_sem){++++}-{3:3}, at: __ext4_mark_inode_dirty+0x3dc/0x6e0 fs/ext4/inode.c:6074

stack backtrace:
CPU: 0 PID: 6050 Comm: syz.0.68 Not tainted 6.6.95-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
<TASK>
dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
check_noncircular+0x2bd/0x3c0 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:3869 [inline]
__lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
down_write+0x97/0x1f0 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:804 [inline]
ext4_xattr_inode_create fs/ext4/xattr.c:1523 [inline]
ext4_xattr_inode_lookup_create+0x1917/0x1d80 fs/ext4/xattr.c:1605
ext4_xattr_block_set+0x23e/0x32a0 fs/ext4/xattr.c:1925
ext4_xattr_move_to_block fs/ext4/xattr.c:2674 [inline]
ext4_xattr_make_inode_space fs/ext4/xattr.c:2749 [inline]
ext4_expand_extra_isize_ea+0x10ea/0x19e0 fs/ext4/xattr.c:2841
__ext4_expand_extra_isize+0x306/0x400 fs/ext4/inode.c:5953
ext4_try_to_expand_extra_isize fs/ext4/inode.c:5996 [inline]
__ext4_mark_inode_dirty+0x45d/0x6e0 fs/ext4/inode.c:6074
ext4_setattr+0x1673/0x1c90 fs/ext4/inode.c:5584
notify_change+0xb0d/0xe10 fs/attr.c:499
do_truncate+0x19b/0x220 fs/open.c:66
handle_truncate fs/namei.c:3291 [inline]
do_open fs/namei.c:3636 [inline]
path_openat+0x298c/0x3190 fs/namei.c:3789
do_filp_open+0x1c5/0x3d0 fs/namei.c:3816
do_sys_openat2+0x12c/0x1c0 fs/open.c:1419
do_sys_open fs/open.c:1434 [inline]
__do_sys_openat fs/open.c:1450 [inline]
__se_sys_openat fs/open.c:1445 [inline]
__x64_sys_openat+0x139/0x160 fs/open.c:1445
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fa9e0f8e929
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:00007fffc245c228 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007fa9e11b5fa0 RCX: 00007fa9e0f8e929
RDX: 0000000000000242 RSI: 0000200000000040 RDI: ffffffffffffff9c
RBP: 00007fa9e1010b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fa9e11b5fa0 R14: 00007fa9e11b5fa0 R15: 0000000000000004
</TASK>


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
Reply all
Reply to author
Forward
0 new messages