public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [syzbot] [nilfs?] WARNING in nilfs_ioctl_prepare_clean_segments
       [not found] <69b8c9a9.a00a0220.3b25d1.002a.GAE@google.com>
@ 2026-03-23  0:49 ` syzbot
  2026-03-24 10:45   ` Junjie Cao
  0 siblings, 1 reply; 4+ messages in thread
From: syzbot @ 2026-03-23  0:49 UTC (permalink / raw)
  To: junjie.cao, konishi.ryusuke, linux-kernel, linux-nilfs, slava,
	stable, syzkaller-bugs

syzbot has found a reproducer for the following issue on:

HEAD commit:    785f0eb2f85d Add linux-next specific files for 20260320
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=10d95e02580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=c584910d0d74158d
dashboard link: https://syzkaller.appspot.com/bug?extid=466a45fcfb0562f5b9a0
compiler:       Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=14a941d6580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14d95e02580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a1f7fd9c1a63/disk-785f0eb2.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6c138da87c25/vmlinux-785f0eb2.xz
kernel image: https://storage.googleapis.com/syzbot-assets/4d1be64e56db/bzImage-785f0eb2.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/35af4078ce5c/mount_0.gz

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

loop0: detected capacity change from 0 to 4096
------------[ cut here ]------------
ret == -ENOENT
WARNING: fs/nilfs2/ioctl.c:757 at nilfs_ioctl_mark_blocks_dirty fs/nilfs2/ioctl.c:757 [inline], CPU#1: syz.0.17/6067
WARNING: fs/nilfs2/ioctl.c:757 at nilfs_ioctl_prepare_clean_segments+0x7e7/0x800 fs/nilfs2/ioctl.c:799, CPU#1: syz.0.17/6067
Modules linked in:
CPU: 1 UID: 0 PID: 6067 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2026
RIP: 0010:nilfs_ioctl_mark_blocks_dirty fs/nilfs2/ioctl.c:757 [inline]
RIP: 0010:nilfs_ioctl_prepare_clean_segments+0x7e7/0x800 fs/nilfs2/ioctl.c:799
Code: fe e9 3e fa ff ff 44 89 e9 80 e1 07 80 c1 03 38 c1 0f 8c d4 fa ff ff 4c 89 ef e8 34 a7 7e fe e9 c7 fa ff ff e8 fa 40 15 fe 90 <0f> 0b 90 41 bf fe ff ff ff e9 e3 fe ff ff 66 66 2e 0f 1f 84 00 00
RSP: 0018:ffffc90002f17640 EFLAGS: 00010293
RAX: ffffffff83b11086 RBX: 00000000fffffffe RCX: ffff888029a05b80
RDX: 0000000000000000 RSI: ffffffff8ecbc490 RDI: 00000000fffffffe
RBP: ffffc90002f17730 R08: ffff888029a05b80 R09: 0000000000000002
R10: 00000000fffffffe R11: 0000000000000000 R12: dffffc0000000000
R13: 0000000000000020 R14: ffff88805c254560 R15: ffff88807ade9180
FS:  0000555588d41500(0000) GS:ffff888125548000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b31063fff CR3: 0000000078882000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 nilfs_clean_segments+0x18c/0xa50 fs/nilfs2/segment.c:2525
 nilfs_ioctl_clean_segments fs/nilfs2/ioctl.c:916 [inline]
 nilfs_ioctl+0x261f/0x2780 fs/nilfs2/ioctl.c:1346
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:597 [inline]
 __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f2426b9c799
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffcedafafd8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f2426e15fa0 RCX: 00007f2426b9c799
RDX: 0000200000000000 RSI: 0000000040786e88 RDI: 0000000000000004
RBP: 00007f2426c32c99 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f2426e15fac R14: 00007f2426e15fa0 R15: 00007f2426e15fa0
 </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.

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

* Re: [syzbot] [nilfs?] WARNING in nilfs_ioctl_prepare_clean_segments
  2026-03-23  0:49 ` [syzbot] [nilfs?] WARNING in nilfs_ioctl_prepare_clean_segments syzbot
@ 2026-03-24 10:45   ` Junjie Cao
  2026-03-24 11:26     ` Junjie Cao
  0 siblings, 1 reply; 4+ messages in thread
From: Junjie Cao @ 2026-03-24 10:45 UTC (permalink / raw)
  To: syzbot+466a45fcfb0562f5b9a0, Ryusuke Konishi, Viacheslav Dubeyko,
	linux-nilfs, linux-kernel
  Cc: stable, syzkaller-bugs, Junjie Cao

Please test the following patch.

From: Junjie Cao <junjie.cao@linux.dev>
Date: Thu, 19 Mar 2026 00:00:00 +0800
Subject: [PATCH] nilfs2: skip blocks with no bmap entry in
 nilfs_ioctl_mark_blocks_dirty()

In nilfs_ioctl_mark_blocks_dirty(), called during garbage collection,
nilfs_bmap_lookup_at_level() may return -ENOENT when a block no longer
exists in the DAT bmap.  In that case the code sets bd_blocknr to 0 but
falls through to the liveness check that compares bd_blocknr against
bd_oblocknr.  If bd_oblocknr also happens to be 0, the descriptor is
incorrectly treated as live and the code attempts to get or mark the
non-existent block, triggering a WARN_ON.

Fix this by adding a continue statement so that a block descriptor is
immediately skipped when its bmap lookup returns -ENOENT, since there
is no block in the DAT to mark dirty.

Fixes: 7942b919f732 ("nilfs2: ioctl operations")
Reported-by: syzbot+466a45fcfb0562f5b9a0@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=466a45fcfb0562f5b9a0
Cc: stable@vger.kernel.org
Signed-off-by: Junjie Cao <junjie.cao@linux.dev>
---
 fs/nilfs2/ioctl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index 1bfe8a2..d71a0a5 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -744,6 +744,7 @@ static int nilfs_ioctl_mark_blocks_dirty(struct the_nilfs *nilfs,
 		if (ret < 0) {
 			if (ret != -ENOENT)
 				return ret;
 			bdescs[i].bd_blocknr = 0;
+			continue;
 		}
 		if (bdescs[i].bd_blocknr != bdescs[i].bd_oblocknr)
 			/* skip dead block */
--
2.43.0

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

* Re: [syzbot] [nilfs?] WARNING in nilfs_ioctl_prepare_clean_segments
  2026-03-24 10:45   ` Junjie Cao
@ 2026-03-24 11:26     ` Junjie Cao
  2026-03-24 12:01       ` syzbot
  0 siblings, 1 reply; 4+ messages in thread
From: Junjie Cao @ 2026-03-24 11:26 UTC (permalink / raw)
  To: syzbot+466a45fcfb0562f5b9a0, Ryusuke Konishi, Viacheslav Dubeyko,
	linux-nilfs, linux-kernel
  Cc: stable, syzkaller-bugs, Junjie Cao

Please test this branch.

#syz test: https://github.com/Lukaaa525/linux-kernel.git nilfs2-mark-blocks-dirty-fix-syztest

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

* Re: [syzbot] [nilfs?] WARNING in nilfs_ioctl_prepare_clean_segments
  2026-03-24 11:26     ` Junjie Cao
@ 2026-03-24 12:01       ` syzbot
  0 siblings, 0 replies; 4+ messages in thread
From: syzbot @ 2026-03-24 12:01 UTC (permalink / raw)
  To: junjie.cao, konishi.ryusuke, linux-kernel, linux-nilfs, slava,
	stable, syzkaller-bugs

Hello,

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

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

Tested on:

commit:         ebd34541 nilfs2: skip blocks with no bmap entry in nil..
git tree:       https://github.com/Lukaaa525/linux-kernel.git nilfs2-mark-blocks-dirty-fix-syztest
console output: https://syzkaller.appspot.com/x/log.txt?x=1100d6da580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=a1eff8566a28238e
dashboard link: https://syzkaller.appspot.com/bug?extid=466a45fcfb0562f5b9a0
compiler:       Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8

Note: no patches were applied.
Note: testing is done by a robot and is best-effort only.

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

end of thread, other threads:[~2026-03-24 12:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <69b8c9a9.a00a0220.3b25d1.002a.GAE@google.com>
2026-03-23  0:49 ` [syzbot] [nilfs?] WARNING in nilfs_ioctl_prepare_clean_segments syzbot
2026-03-24 10:45   ` Junjie Cao
2026-03-24 11:26     ` Junjie Cao
2026-03-24 12:01       ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox