[v6.6] possible deadlock in ext4_truncate

0 views
Skip to first unread message

syzbot

unread,
Jul 30, 2025, 9:32:38 AM7/30/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: dbcb8d8e4163 Linux 6.6.100
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=117ecca2580000
kernel config: https://syzkaller.appspot.com/x/.config?x=293251cfa8d8100
dashboard link: https://syzkaller.appspot.com/bug?extid=7b46c757866b8925015a
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=13deccf0580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/d0b56817a2c3/disk-dbcb8d8e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f0d646b2f7fa/vmlinux-dbcb8d8e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/1e0b752a5011/bzImage-dbcb8d8e.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/75fa11495525/mount_0.gz
fsck result: OK (log: https://syzkaller.appspot.com/x/fsck.log?x=16e10ca2580000)

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

============================================
WARNING: possible recursive locking detected
6.6.100-syzkaller #0 Not tainted
--------------------------------------------
syz.0.1018/10604 is trying to acquire lock:
ffff88805af62088 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_truncate+0x91d/0x1060 fs/ext4/inode.c:4260

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

other info that might help us debug this:
Possible unsafe locking scenario:

CPU0
----
lock(&ei->i_data_sem/3);
lock(&ei->i_data_sem/3);

*** DEADLOCK ***

May be due to missing lock nesting notation

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

stack backtrace:
CPU: 0 PID: 10604 Comm: syz.0.1018 Not tainted 6.6.100-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_deadlock kernel/locking/lockdep.c:3062 [inline]
validate_chain kernel/locking/lockdep.c:3856 [inline]
__lock_acquire+0x5d40/0x7c80 kernel/locking/lockdep.c:5137
lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
down_write+0x97/0x1f0 kernel/locking/rwsem.c:1573
ext4_truncate+0x91d/0x1060 fs/ext4/inode.c:4260
ext4_evict_inode+0x8af/0xea0 fs/ext4/inode.c:259
evict+0x486/0x870 fs/inode.c:705
ext4_xattr_set_entry+0x132e/0x1e90 fs/ext4/xattr.c:1856
ext4_xattr_ibody_set+0x254/0x6a0 fs/ext4/xattr.c:2278
ext4_xattr_move_to_block fs/ext4/xattr.c:2681 [inline]
ext4_xattr_make_inode_space fs/ext4/xattr.c:2749 [inline]
ext4_expand_extra_isize_ea+0x113a/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
vfs_truncate+0x266/0x300 fs/open.c:112
do_sys_truncate+0xe0/0x1a0 fs/open.c:135
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:0x7fcfccb8e9a9
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:00007fcfcd989038 EFLAGS: 00000246 ORIG_RAX: 000000000000004c
RAX: ffffffffffffffda RBX: 00007fcfccdb5fa0 RCX: 00007fcfccb8e9a9
RDX: 0000000000000000 RSI: 0000000000000005 RDI: 0000200000000100
RBP: 00007fcfccc10d69 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fcfccdb5fa0 R15: 00007ffe1214ffb8
</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 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.

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
Reply all
Reply to author
Forward
0 new messages