[v5.15] possible deadlock in ext4_truncate

0 views
Skip to first unread message

syzbot

unread,
3:13 AM (13 hours ago) 3:13 AM
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 43bb85222e53 Linux 5.15.193
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=147020e2580000
kernel config: https://syzkaller.appspot.com/x/.config?x=e1bb6d24ef2164eb
dashboard link: https://syzkaller.appspot.com/bug?extid=0cbfd1e05175ae90529e
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/aa8fda38f146/disk-43bb8522.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/5cfcd43783fc/vmlinux-43bb8522.xz
kernel image: https://storage.googleapis.com/syzbot-assets/582ede77e278/bzImage-43bb8522.xz

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

============================================
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>


---
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,
5:56 AM (10 hours ago) 5:56 AM
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 43bb85222e53 Linux 5.15.193
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=179039cd980000
kernel config: https://syzkaller.appspot.com/x/.config?x=e1bb6d24ef2164eb
dashboard link: https://syzkaller.appspot.com/bug?extid=0cbfd1e05175ae90529e
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=125c20e2580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16699c7c580000
mounted in repro: https://storage.googleapis.com/syzbot-assets/826f6438d20a/mount_3.gz
fsck result: OK (log: https://syzkaller.appspot.com/x/fsck.log?x=154f0d04580000)

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

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

but task is already holding lock:
ffff88805866e628 (&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.0.731/7035:
#0: ffff888028856460 (sb_writers#5){.+.+}-{0:0}, at: mnt_want_write+0x3d/0x90 fs/namespace.c:377
#1: ffff88805866e7a0 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: inode_lock include/linux/fs.h:787 [inline]
#1: ffff88805866e7a0 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: do_truncate+0x183/0x220 fs/open.c:63
#2: ffff88805866e940 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_invalidate_lock include/linux/fs.h:832 [inline]
#2: ffff88805866e940 (mapping.invalidate_lock){++++}-{3:3}, at: ext4_setattr+0xdb6/0x19e0 fs/ext4/inode.c:5506
#3: ffff88805866e628 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x133d/0x19e0 fs/ext4/inode.c:5546
#4: ffff88805866e478 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_trylock_xattr fs/ext4/xattr.h:162 [inline]
#4: ffff88805866e478 (&ei->xattr_sem){++++}-{3:3}, at: ext4_try_to_expand_extra_isize fs/ext4/inode.c:5927 [inline]
#4: ffff88805866e478 (&ei->xattr_sem){++++}-{3:3}, at: __ext4_mark_inode_dirty+0x3e8/0x700 fs/ext4/inode.c:6008

stack backtrace:
CPU: 1 PID: 7035 Comm: syz.0.731 Not tainted syzkaller #0
RIP: 0033:0x7ff64df46ba9
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:00007ff64d5b6038 EFLAGS: 00000246 ORIG_RAX: 000000000000004c
RAX: ffffffffffffffda RBX: 00007ff64e18dfa0 RCX: 00007ff64df46ba9
RDX: 0000000000000000 RSI: 0000000000000004 RDI: 00002000000000c0
RBP: 00007ff64dfc9e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ff64e18e038 R14: 00007ff64e18dfa0 R15: 00007ffc0123a4a8
</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