linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [ext4?] possible deadlock in ext4_truncate (2)
@ 2025-08-25  8:51 syzbot
  2025-08-25 10:41 ` Hillf Danton
  2025-08-26  1:43 ` Hillf Danton
  0 siblings, 2 replies; 7+ messages in thread
From: syzbot @ 2025-08-25  8:51 UTC (permalink / raw)
  To: adilger.kernel, linux-ext4, linux-kernel, syzkaller-bugs, tytso

Hello,

syzbot found the following issue on:

HEAD commit:    8d245acc1e88 Merge tag 'char-misc-6.17-rc3' of git://git.k..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1654ac42580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=da02162f945f3311
dashboard link: https://syzkaller.appspot.com/bug?extid=c5c9c223a721d7353490
compiler:       gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=15d1cef0580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10f4e7bc580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/cea3b9f96317/disk-8d245acc.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/edb55fcbe832/vmlinux-8d245acc.xz
kernel image: https://storage.googleapis.com/syzbot-assets/db6f85cd97c7/bzImage-8d245acc.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/d39971563b22/mount_0.gz
  fsck result: OK (log: https://syzkaller.appspot.com/x/fsck.log?x=125fc862580000)

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

loop5: detected capacity change from 0 to 1024
EXT4-fs: Ignoring removed nobh option
============================================
WARNING: possible recursive locking detected
syzkaller #0 Not tainted
--------------------------------------------
syz.5.286/7060 is trying to acquire lock:
ffff888056de1590 (&ei->i_data_sem/3){++++}-{4:4}, at: ext4_truncate+0xddd/0x1210 fs/ext4/inode.c:4639

but task is already holding lock:
ffff888056de1f20 (&ei->i_data_sem/3){++++}-{4:4}, at: ext4_truncate+0xddd/0x1210 fs/ext4/inode.c:4639

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.286/7060:
 #0: ffff888022bfe428 (sb_writers#4){.+.+}-{0:0}, at: vfs_truncate+0x336/0x6e0 fs/open.c:96
 #1: ffff888056de2090 (&sb->s_type->i_mutex_key#9){++++}-{4:4}, at: inode_lock_killable include/linux/fs.h:874 [inline]
 #1: ffff888056de2090 (&sb->s_type->i_mutex_key#9){++++}-{4:4}, at: do_truncate+0x146/0x230 fs/open.c:63
 #2: ffff888056de2230 (mapping.invalidate_lock#2){++++}-{4:4}, at: filemap_invalidate_lock include/linux/fs.h:924 [inline]
 #2: ffff888056de2230 (mapping.invalidate_lock#2){++++}-{4:4}, at: ext4_setattr+0xe11/0x2ae0 fs/ext4/inode.c:5954
 #3: ffff888056de1f20 (&ei->i_data_sem/3){++++}-{4:4}, at: ext4_truncate+0xddd/0x1210 fs/ext4/inode.c:4639
 #4: ffff888056de1d78 (&ei->xattr_sem){++++}-{4:4}, at: ext4_write_trylock_xattr fs/ext4/xattr.h:164 [inline]
 #4: ffff888056de1d78 (&ei->xattr_sem){++++}-{4:4}, at: ext4_try_to_expand_extra_isize fs/ext4/inode.c:6425 [inline]
 #4: ffff888056de1d78 (&ei->xattr_sem){++++}-{4:4}, at: __ext4_mark_inode_dirty+0x4ba/0x870 fs/ext4/inode.c:6506

stack backtrace:
CPU: 1 UID: 0 PID: 7060 Comm: syz.5.286 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
 print_deadlock_bug+0x1e9/0x240 kernel/locking/lockdep.c:3041
 check_deadlock kernel/locking/lockdep.c:3093 [inline]
 validate_chain kernel/locking/lockdep.c:3895 [inline]
 __lock_acquire+0x1133/0x1ce0 kernel/locking/lockdep.c:5237
 lock_acquire kernel/locking/lockdep.c:5868 [inline]
 lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825
 down_write+0x92/0x200 kernel/locking/rwsem.c:1590
 ext4_truncate+0xddd/0x1210 fs/ext4/inode.c:4639
 ext4_evict_inode+0x7a8/0x18e0 fs/ext4/inode.c:261
 evict+0x3e6/0x920 fs/inode.c:810
 iput_final fs/inode.c:1897 [inline]
 iput fs/inode.c:1923 [inline]
 iput+0x521/0x880 fs/inode.c:1909
 ext4_xattr_set_entry+0x73c/0x1f00 fs/ext4/xattr.c:1839
 ext4_xattr_ibody_set+0x3d6/0x5d0 fs/ext4/xattr.c:2263
 ext4_xattr_move_to_block fs/ext4/xattr.c:2666 [inline]
 ext4_xattr_make_inode_space fs/ext4/xattr.c:2734 [inline]
 ext4_expand_extra_isize_ea+0x1487/0x1ab0 fs/ext4/xattr.c:2822
 __ext4_expand_extra_isize+0x346/0x480 fs/ext4/inode.c:6385
 ext4_try_to_expand_extra_isize fs/ext4/inode.c:6428 [inline]
 __ext4_mark_inode_dirty+0x544/0x870 fs/ext4/inode.c:6506
 ext4_ext_truncate+0xa3/0x300 fs/ext4/extents.c:4475
 ext4_truncate+0xe3b/0x1210 fs/ext4/inode.c:4643
 ext4_setattr+0x19f3/0x2ae0 fs/ext4/inode.c:6044
 notify_change+0x6a9/0x1230 fs/attr.c:552
 do_truncate+0x1d7/0x230 fs/open.c:68
 vfs_truncate+0x5d6/0x6e0 fs/open.c:118
 do_sys_truncate fs/open.c:141 [inline]
 __do_sys_truncate fs/open.c:153 [inline]
 __se_sys_truncate fs/open.c:151 [inline]
 __x64_sys_truncate+0x172/0x1e0 fs/open.c:151
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f63ad98ebe9
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:00007f63ae7fc038 EFLAGS: 00000246 ORIG_RAX: 000000000000004c
RAX: ffffffffffffffda RBX: 00007f63adbb5fa0 RCX: 00007f63ad98ebe9
RDX: 0000000000000000 RSI: 000000000000041a RDI: 00002000000000c0
RBP: 00007f63ada11e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f63adbb6038 R14: 00007f63adbb5fa0 R15: 00007fff7f328758
 </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 syzkaller@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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] [ext4?] possible deadlock in ext4_truncate (2)
  2025-08-25  8:51 [syzbot] [ext4?] possible deadlock in ext4_truncate (2) syzbot
@ 2025-08-25 10:41 ` Hillf Danton
  2025-08-25 13:11   ` syzbot
  2025-08-25 13:37   ` Theodore Ts'o
  2025-08-26  1:43 ` Hillf Danton
  1 sibling, 2 replies; 7+ messages in thread
From: Hillf Danton @ 2025-08-25 10:41 UTC (permalink / raw)
  To: syzbot; +Cc: linux-kernel, syzkaller-bugs

> Date: Mon, 25 Aug 2025 01:51:30 -0700	[thread overview]
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    8d245acc1e88 Merge tag 'char-misc-6.17-rc3' of git://git.k..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1654ac42580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=da02162f945f3311
> dashboard link: https://syzkaller.appspot.com/bug?extid=c5c9c223a721d7353490
> compiler:       gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=15d1cef0580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10f4e7bc580000

#syz test

--- x/fs/ext4/inode.c
+++ y/fs/ext4/inode.c
@@ -4573,6 +4573,7 @@ int ext4_truncate(struct inode *inode)
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	unsigned int credits;
 	int err = 0, err2;
+	static int subclass = 0;
 	handle_t *handle;
 	struct address_space *mapping = inode->i_mapping;
 
@@ -4636,7 +4637,7 @@ int ext4_truncate(struct inode *inode)
 	ext4_fc_track_inode(handle, inode);
 	ext4_check_map_extents_env(inode);
 
-	down_write(&EXT4_I(inode)->i_data_sem);
+	down_write_nested(&EXT4_I(inode)->i_data_sem, subclass++);
 	ext4_discard_preallocations(inode);
 
 	if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
--

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] [ext4?] possible deadlock in ext4_truncate (2)
  2025-08-25 10:41 ` Hillf Danton
@ 2025-08-25 13:11   ` syzbot
  2025-08-25 13:37   ` Theodore Ts'o
  1 sibling, 0 replies; 7+ messages in thread
From: syzbot @ 2025-08-25 13:11 UTC (permalink / raw)
  To: hdanton, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING: locking bug in ext4_truncate

------------[ cut here ]------------
DEBUG_LOCKS_WARN_ON(subclass >= MAX_LOCKDEP_SUBCLASSES)
WARNING: CPU: 0 PID: 6286 at kernel/locking/lockdep.c:5103 __lock_acquire+0x10ba/0x1ce0 kernel/locking/lockdep.c:5103
Modules linked in:
CPU: 0 UID: 65534 PID: 6286 Comm: syz-executor Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
RIP: 0010:__lock_acquire+0x10ba/0x1ce0 kernel/locking/lockdep.c:5103
Code: 41 83 bd d4 0a 00 00 01 19 f6 83 e6 02 83 c6 03 e9 5b f9 ff ff 90 48 c7 c6 80 a8 c8 8d 48 c7 c7 0c 44 e1 8d e8 b7 7f e2 ff 90 <0f> 0b 90 90 e9 5b f8 ff ff 90 48 c7 c6 f6 98 e2 8d 48 c7 c7 0c 44
RSP: 0018:ffffc90002eb7920 EFLAGS: 00010086
RAX: 0000000000000000 RBX: 0000000000000008 RCX: ffffffff817a3358
RDX: ffff88807ad25a00 RSI: ffffffff817a3365 RDI: 0000000000000001
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 000000002d2d2d2d R12: 000000009af27c01
R13: ffff88807ad25a00 R14: 0000000000000000 R15: ffff88805d1b6210
FS:  0000555565c94500(0000) GS:ffff8881246bd000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffcca85bf18 CR3: 000000005dcbb000 CR4: 0000000000350ef0
Call Trace:
 <TASK>
 lock_acquire kernel/locking/lockdep.c:5868 [inline]
 lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825
 down_write_nested+0x96/0x210 kernel/locking/rwsem.c:1706
 ext4_truncate+0xdec/0x1220 fs/ext4/inode.c:4640
 ext4_evict_inode+0x7a8/0x18e0 fs/ext4/inode.c:261
 evict+0x3e6/0x920 fs/inode.c:810
 iput_final fs/inode.c:1897 [inline]
 iput fs/inode.c:1923 [inline]
 iput+0x521/0x880 fs/inode.c:1909
 d_delete_notify include/linux/fsnotify.h:377 [inline]
 vfs_rmdir fs/namei.c:4474 [inline]
 vfs_rmdir+0x487/0x690 fs/namei.c:4438
 do_rmdir+0x2e8/0x3c0 fs/namei.c:4516
 __do_sys_unlinkat fs/namei.c:4690 [inline]
 __se_sys_unlinkat fs/namei.c:4684 [inline]
 __x64_sys_unlinkat+0xef/0x130 fs/namei.c:4684
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f43c538e1c7
Code: 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 07 01 00 00 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:00007ffcca85c6c8 EFLAGS: 00000207 ORIG_RAX: 0000000000000107
RAX: ffffffffffffffda RBX: 0000000000000065 RCX: 00007f43c538e1c7
RDX: 0000000000000200 RSI: 00007ffcca85d810 RDI: 00000000ffffff9c
RBP: 00007f43c5411c05 R08: 0000555565ca754b R09: 0000000000000000
R10: 0000000000000100 R11: 0000000000000207 R12: 00007ffcca85d810
R13: 00007f43c5411c05 R14: 0000000000026c6d R15: 00007ffcca85d850
 </TASK>


Tested on:

commit:         1b237f19 Linux 6.17-rc3
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1525ec42580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=da02162f945f3311
dashboard link: https://syzkaller.appspot.com/bug?extid=c5c9c223a721d7353490
compiler:       gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=1636fa34580000


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] [ext4?] possible deadlock in ext4_truncate (2)
  2025-08-25 10:41 ` Hillf Danton
  2025-08-25 13:11   ` syzbot
@ 2025-08-25 13:37   ` Theodore Ts'o
  2025-08-26  3:46     ` Hillf Danton
  1 sibling, 1 reply; 7+ messages in thread
From: Theodore Ts'o @ 2025-08-25 13:37 UTC (permalink / raw)
  To: Hillf Danton; +Cc: syzbot, linux-kernel, syzkaller-bugs

On Mon, Aug 25, 2025 at 06:41:52PM +0800, Hillf Danton wrote:
> > syzbot found the following issue on:
> > 
> > dashboard link: https://syzkaller.appspot.com/bug?extid=c5c9c223a721d7353490
> 
> --- x/fs/ext4/inode.c
> +++ y/fs/ext4/inode.c
> @@ -4573,6 +4573,7 @@ int ext4_truncate(struct inode *inode)
>  	struct ext4_inode_info *ei = EXT4_I(inode);
>  	unsigned int credits;
>  	int err = 0, err2;
> +	static int subclass = 0;
>  	handle_t *handle;
>  	struct address_space *mapping = inode->i_mapping;
>  
> @@ -4636,7 +4637,7 @@ int ext4_truncate(struct inode *inode)
>  	ext4_fc_track_inode(handle, inode);
>  	ext4_check_map_extents_env(inode);
>  
> -	down_write(&EXT4_I(inode)->i_data_sem);
> +	down_write_nested(&EXT4_I(inode)->i_data_sem, subclass++);
>  	ext4_discard_preallocations(inode);
>  
>  	if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))

This isn't the right way to fix these sorts of Syzbot failures.  First
of all, we already have subclasses defined.  Secondly, using a
continuously incrementing subclasses will chew up a huge amount of
memory until lockdep gives a warning that the kernel exceeded a fixed
limit, which (a) disables the lockdep checking, so it's counter
productive, (b) will trigger a syzbot failure, so it doesn't even shut
up the syzbot noise.

The combination of maliciously corrupted/fuzzed file systems, and a
deadlock warning, is something that I just ignore.  Your patch is an
attempt to do this programmtically, if it worked (and for better or
for worse, it doesn't).  If there was a way I could tell syzbot ---
you're just wasting everyone's time, shut up with this combination,
but there isn't.  So when I have time, I'll recategorize these reports
to priority low, which is a signal that it's been triaged, and it's
syzbot noise.

Cheers,

						- Ted

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] [ext4?] possible deadlock in ext4_truncate (2)
  2025-08-25  8:51 [syzbot] [ext4?] possible deadlock in ext4_truncate (2) syzbot
  2025-08-25 10:41 ` Hillf Danton
@ 2025-08-26  1:43 ` Hillf Danton
  2025-08-26  2:32   ` syzbot
  1 sibling, 1 reply; 7+ messages in thread
From: Hillf Danton @ 2025-08-26  1:43 UTC (permalink / raw)
  To: syzbot; +Cc: linux-kernel, syzkaller-bugs

> Date: Mon, 25 Aug 2025 01:51:30 -0700	[thread overview]
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    8d245acc1e88 Merge tag 'char-misc-6.17-rc3' of git://git.k..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1654ac42580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=da02162f945f3311
> dashboard link: https://syzkaller.appspot.com/bug?extid=c5c9c223a721d7353490
> compiler:       gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=15d1cef0580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10f4e7bc580000

#syz test

--- x/fs/ext4/inode.c
+++ y/fs/ext4/inode.c
@@ -4573,6 +4573,7 @@ int ext4_truncate(struct inode *inode)
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	unsigned int credits;
 	int err = 0, err2;
+	static int subclass = 0;
 	handle_t *handle;
 	struct address_space *mapping = inode->i_mapping;
 
@@ -4636,7 +4637,7 @@ int ext4_truncate(struct inode *inode)
 	ext4_fc_track_inode(handle, inode);
 	ext4_check_map_extents_env(inode);
 
-	down_write(&EXT4_I(inode)->i_data_sem);
+	down_write_nested(&EXT4_I(inode)->i_data_sem, subclass++);
 	ext4_discard_preallocations(inode);
 
 	if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
@@ -4645,6 +4646,7 @@ int ext4_truncate(struct inode *inode)
 		ext4_ind_truncate(handle, inode);
 
 	up_write(&ei->i_data_sem);
+	subclass--;
 	if (err)
 		goto out_stop;
 
--

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] [ext4?] possible deadlock in ext4_truncate (2)
  2025-08-26  1:43 ` Hillf Danton
@ 2025-08-26  2:32   ` syzbot
  0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2025-08-26  2:32 UTC (permalink / raw)
  To: hdanton, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+c5c9c223a721d7353490@syzkaller.appspotmail.com
Tested-by: syzbot+c5c9c223a721d7353490@syzkaller.appspotmail.com

Tested on:

commit:         fab1beda Merge tag 'devicetree-fixes-for-6.17-1' of gi..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=144f0634580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=da02162f945f3311
dashboard link: https://syzkaller.appspot.com/bug?extid=c5c9c223a721d7353490
compiler:       gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=15bf1c42580000

Note: testing is done by a robot and is best-effort only.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] [ext4?] possible deadlock in ext4_truncate (2)
  2025-08-25 13:37   ` Theodore Ts'o
@ 2025-08-26  3:46     ` Hillf Danton
  0 siblings, 0 replies; 7+ messages in thread
From: Hillf Danton @ 2025-08-26  3:46 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: syzbot, linux-kernel, syzkaller-bugs

On Mon, 25 Aug 2025 09:37:43 -0400 Theodore Ts'o wrote:
> On Mon, Aug 25, 2025 at 06:41:52PM +0800, Hillf Danton wrote:
> > > syzbot found the following issue on:
> > > 
> > > dashboard link: https://syzkaller.appspot.com/bug?extid=c5c9c223a721d7353490
> > 
> > --- x/fs/ext4/inode.c
> > +++ y/fs/ext4/inode.c
> > @@ -4573,6 +4573,7 @@ int ext4_truncate(struct inode *inode)
> >  	struct ext4_inode_info *ei = EXT4_I(inode);
> >  	unsigned int credits;
> >  	int err = 0, err2;
> > +	static int subclass = 0;
> >  	handle_t *handle;
> >  	struct address_space *mapping = inode->i_mapping;
> >  
> > @@ -4636,7 +4637,7 @@ int ext4_truncate(struct inode *inode)
> >  	ext4_fc_track_inode(handle, inode);
> >  	ext4_check_map_extents_env(inode);
> >  
> > -	down_write(&EXT4_I(inode)->i_data_sem);
> > +	down_write_nested(&EXT4_I(inode)->i_data_sem, subclass++);
> >  	ext4_discard_preallocations(inode);
> >  
> >  	if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
> 
> This isn't the right way to fix these sorts of Syzbot failures.  First

It is simpler to fix it than create it wrt surviving the syzbot test [1].

[1] https://lore.kernel.org/lkml/68ad1ca1.050a0220.37038e.009e.GAE@google.com/

> of all, we already have subclasses defined.  Secondly, using a
> continuously incrementing subclasses will chew up a huge amount of
> memory until lockdep gives a warning that the kernel exceeded a fixed
> limit, which (a) disables the lockdep checking, so it's counter
> productive, (b) will trigger a syzbot failure, so it doesn't even shut
> up the syzbot noise.
> 
> The combination of maliciously corrupted/fuzzed file systems, and a
> deadlock warning, is something that I just ignore.  Your patch is an
> attempt to do this programmtically, if it worked (and for better or
> for worse, it doesn't).  If there was a way I could tell syzbot ---
> you're just wasting everyone's time, shut up with this combination,
> but there isn't.  So when I have time, I'll recategorize these reports
> to priority low, which is a signal that it's been triaged, and it's
> syzbot noise.
> 
Frankly there is much noise you can safely ignore, like what LT made.

> Cheers,
> 
>						- Ted

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-08-26  3:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-25  8:51 [syzbot] [ext4?] possible deadlock in ext4_truncate (2) syzbot
2025-08-25 10:41 ` Hillf Danton
2025-08-25 13:11   ` syzbot
2025-08-25 13:37   ` Theodore Ts'o
2025-08-26  3:46     ` Hillf Danton
2025-08-26  1:43 ` Hillf Danton
2025-08-26  2:32   ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).