syzbot


possible deadlock in ext4_truncate

Status: upstream: reported on 2025/09/19 07:13
Reported-by: syzbot+0cbfd1e05175ae90529e@syzkaller.appspotmail.com
First crash: 1h41m, last: 1h41m
Similar bugs (3)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ext4_truncate ext4 4 4 265d 286d 0/29 closed as dup on 2024/12/12 23:40
upstream possible deadlock in ext4_truncate (2) ext4 4 C unreliable 3 11d 25d 0/29 upstream: reported C repro on 2025/08/25 08:51
linux-6.6 possible deadlock in ext4_truncate origin:lts-only 4 syz 6 48d 50d 0/2 upstream: reported syz repro on 2025/07/30 13:32

Sample crash report:
============================================
WARNING: possible recursive locking detected
syzkaller #0 Not tainted
--------------------------------------------
syz.5.494/7256 is trying to acquire lock:
ffff88805603d238 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_truncate+0x96d/0x10d0 fs/ext4/inode.c:4245

but task is already holding lock:
ffff88805603be48 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x133d/0x19e0 fs/ext4/inode.c:5546

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.5.494/7256:
 #0: ffff88806225a460 (sb_writers#5){.+.+}-{0:0}, at: mnt_want_write+0x3d/0x90 fs/namespace.c:377
 #1: ffff88805603bfc0 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: inode_lock include/linux/fs.h:787 [inline]
 #1: ffff88805603bfc0 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: do_truncate+0x183/0x220 fs/open.c:63
 #2: ffff88805603c160 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_invalidate_lock include/linux/fs.h:832 [inline]
 #2: ffff88805603c160 (mapping.invalidate_lock){++++}-{3:3}, at: ext4_setattr+0xdb6/0x19e0 fs/ext4/inode.c:5506
 #3: ffff88805603be48 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x133d/0x19e0 fs/ext4/inode.c:5546
 #4: ffff88805603bc98 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_trylock_xattr fs/ext4/xattr.h:162 [inline]
 #4: ffff88805603bc98 (&ei->xattr_sem){++++}-{3:3}, at: ext4_try_to_expand_extra_isize fs/ext4/inode.c:5927 [inline]
 #4: ffff88805603bc98 (&ei->xattr_sem){++++}-{3:3}, at: __ext4_mark_inode_dirty+0x3e8/0x700 fs/ext4/inode.c:6008

stack backtrace:
CPU: 1 PID: 7256 Comm: syz.5.494 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106
 __lock_acquire+0x1227/0x7c60 kernel/locking/lockdep.c:-1
 lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623
 down_write+0x38/0x60 kernel/locking/rwsem.c:1551
 ext4_truncate+0x96d/0x10d0 fs/ext4/inode.c:4245
 ext4_evict_inode+0xb43/0x1080 fs/ext4/inode.c:289
 evict+0x485/0x870 fs/inode.c:647
 ext4_xattr_set_entry+0x10f7/0x3d30 fs/ext4/xattr.c:1835
 ext4_xattr_ibody_set+0x112/0x330 fs/ext4/xattr.c:2252
 ext4_xattr_move_to_block fs/ext4/xattr.c:2639 [inline]
 ext4_xattr_make_inode_space fs/ext4/xattr.c:2707 [inline]
 ext4_expand_extra_isize_ea+0xf9a/0x19a0 fs/ext4/xattr.c:2799
 __ext4_expand_extra_isize+0x301/0x3e0 fs/ext4/inode.c:5887
 ext4_try_to_expand_extra_isize fs/ext4/inode.c:5930 [inline]
 __ext4_mark_inode_dirty+0x469/0x700 fs/ext4/inode.c:6008
 ext4_setattr+0x13b7/0x19e0 fs/ext4/inode.c:5549
 notify_change+0xbcd/0xee0 fs/attr.c:505
 do_truncate+0x197/0x220 fs/open.c:65
 vfs_truncate+0x262/0x2f0 fs/open.c:111
 do_sys_truncate+0xdc/0x190 fs/open.c:134
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f87c542dba9
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:00007f87c3695038 EFLAGS: 00000246 ORIG_RAX: 000000000000004c
RAX: ffffffffffffffda RBX: 00007f87c5674fa0 RCX: 00007f87c542dba9
RDX: 0000000000000000 RSI: 0000000000000004 RDI: 00002000000000c0
RBP: 00007f87c54b0e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f87c5675038 R14: 00007f87c5674fa0 R15: 00007ffc362a3fe8
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/09/19 07:13 linux-5.15.y 43bb85222e53 e2beed91 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ext4_truncate
* Struck through repros no longer work on HEAD.