* Re: [syzbot] [jfs?] UBSAN: shift-out-of-bounds in jfs_statfs (3)
2025-04-30 13:26 [syzbot] [jfs?] UBSAN: shift-out-of-bounds in jfs_statfs (3) syzbot
@ 2025-06-09 22:13 ` syzbot
2025-09-28 3:22 ` Forwarded: " syzbot
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2025-06-09 22:13 UTC (permalink / raw)
To: jfs-discussion, linux-kernel, shaggy, syzkaller-bugs
syzbot has found a reproducer for the following issue on:
HEAD commit: 475c850a7fdd Add linux-next specific files for 20250606
git tree: linux-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=11fe2a82580000
kernel config: https://syzkaller.appspot.com/x/.config?x=28859360c84ac63d
dashboard link: https://syzkaller.appspot.com/bug?extid=13ba7f3e9a17f77250fe
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11c79a0c580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=162aa9d4580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/2f1cf8485b7a/disk-475c850a.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/976adb9f739e/vmlinux-475c850a.xz
kernel image: https://storage.googleapis.com/syzbot-assets/0ac20b1308b7/bzImage-475c850a.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/fad6178a795b/mount_0.gz
fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=122aa9d4580000)
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+13ba7f3e9a17f77250fe@syzkaller.appspotmail.com
loop0: detected capacity change from 0 to 32768
------------[ cut here ]------------
UBSAN: shift-out-of-bounds in fs/jfs/super.c:140:14
shift exponent 115 is too large for 64-bit type 's64' (aka 'long long')
CPU: 1 UID: 0 PID: 5841 Comm: syz-executor190 Not tainted 6.15.0-next-20250606-syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
<TASK>
dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
ubsan_epilogue+0xa/0x40 lib/ubsan.c:233
__ubsan_handle_shift_out_of_bounds+0x386/0x410 lib/ubsan.c:494
jfs_statfs+0x4d1/0x550 fs/jfs/super.c:140
statfs_by_dentry fs/statfs.c:66 [inline]
vfs_statfs+0x144/0x2d0 fs/statfs.c:90
ovl_check_namelen fs/overlayfs/super.c:388 [inline]
ovl_lower_dir fs/overlayfs/super.c:404 [inline]
ovl_get_lowerstack fs/overlayfs/super.c:1150 [inline]
ovl_fill_super+0x9d9/0x35d0 fs/overlayfs/super.c:1416
vfs_get_super fs/super.c:1323 [inline]
get_tree_nodev+0xbb/0x150 fs/super.c:1342
vfs_get_tree+0x8f/0x2b0 fs/super.c:1802
do_new_mount+0x24a/0xa40 fs/namespace.c:3874
do_mount fs/namespace.c:4211 [inline]
__do_sys_mount fs/namespace.c:4422 [inline]
__se_sys_mount+0x317/0x410 fs/namespace.c:4399
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f8347037a39
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffdd0158b28 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000200000000000 RCX: 00007f8347037a39
RDX: 0000200000000000 RSI: 0000200000000140 RDI: 0000000000000000
RBP: 00007f834708005e R08: 00002000000003c0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0030656c69662f2e
R13: 65756e69746e6f63 R14: 633d73726f727265 R15: 0000000000000001
</TASK>
---[ end trace ]---
---
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] 6+ messages in thread* Forwarded: Re: [syzbot] [jfs?] UBSAN: shift-out-of-bounds in jfs_statfs (3)
2025-04-30 13:26 [syzbot] [jfs?] UBSAN: shift-out-of-bounds in jfs_statfs (3) syzbot
2025-06-09 22:13 ` syzbot
@ 2025-09-28 3:22 ` syzbot
2025-11-20 15:15 ` Forwarded: test syzbot
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2025-09-28 3:22 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Re: [syzbot] [jfs?] UBSAN: shift-out-of-bounds in jfs_statfs (3)
Author: xandfury@gmail.com
syzbot <syzbot+13ba7f3e9a17f77250fe@syzkaller.appspotmail.com> writes:
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 475c850a7fdd Add linux-next specific files for 20250606
> git tree: linux-next
> console+strace: <https://syzkaller.appspot.com/x/log.txt?x=11fe2a82580000>
> kernel config: <https://syzkaller.appspot.com/x/.config?x=28859360c84ac63d>
> dashboard link: <https://syzkaller.appspot.com/bug?extid=13ba7f3e9a17f77250fe>
> compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
> syz repro: <https://syzkaller.appspot.com/x/repro.syz?x=11c79a0c580000>
> C reproducer: <https://syzkaller.appspot.com/x/repro.c?x=162aa9d4580000>
>
> Downloadable assets:
> disk image: <https://storage.googleapis.com/syzbot-assets/2f1cf8485b7a/disk-475c850a.raw.xz>
> vmlinux: <https://storage.googleapis.com/syzbot-assets/976adb9f739e/vmlinux-475c850a.xz>
> kernel image: <https://storage.googleapis.com/syzbot-assets/0ac20b1308b7/bzImage-475c850a.xz>
> mounted in repro: <https://storage.googleapis.com/syzbot-assets/fad6178a795b/mount_0.gz>
> fsck result: failed (log: <https://syzkaller.appspot.com/x/fsck.log?x=122aa9d4580000>)
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+13ba7f3e9a17f77250fe@syzkaller.appspotmail.com
>
> loop0: detected capacity change from 0 to 32768
> ————[ cut here ]————
> UBSAN: shift-out-of-bounds in fs/jfs/super.c:140:14
> shift exponent 115 is too large for 64-bit type ’s64’ (aka ’long long’)
> CPU: 1 UID: 0 PID: 5841 Comm: syz-executor190 Not tainted 6.15.0-next-20250606-syzkaller #0 PREEMPT(full)
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
> Call Trace:
> <TASK>
> dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
> ubsan_epilogue+0xa/0x40 lib/ubsan.c:233
> __ubsan_handle_shift_out_of_bounds+0x386/0x410 lib/ubsan.c:494
> jfs_statfs+0x4d1/0x550 fs/jfs/super.c:140
> statfs_by_dentry fs/statfs.c:66 [inline]
> vfs_statfs+0x144/0x2d0 fs/statfs.c:90
> ovl_check_namelen fs/overlayfs/super.c:388 [inline]
> ovl_lower_dir fs/overlayfs/super.c:404 [inline]
> ovl_get_lowerstack fs/overlayfs/super.c:1150 [inline]
> ovl_fill_super+0x9d9/0x35d0 fs/overlayfs/super.c:1416
> vfs_get_super fs/super.c:1323 [inline]
> get_tree_nodev+0xbb/0x150 fs/super.c:1342
> vfs_get_tree+0x8f/0x2b0 fs/super.c:1802
> do_new_mount+0x24a/0xa40 fs/namespace.c:3874
> do_mount fs/namespace.c:4211 [inline]
> __do_sys_mount fs/namespace.c:4422 [inline]
> __se_sys_mount+0x317/0x410 fs/namespace.c:4399
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
> RIP: 0033:0x7f8347037a39
> Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007ffdd0158b28 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
> RAX: ffffffffffffffda RBX: 0000200000000000 RCX: 00007f8347037a39
> RDX: 0000200000000000 RSI: 0000200000000140 RDI: 0000000000000000
> RBP: 00007f834708005e R08: 00002000000003c0 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 0030656c69662f2e
> R13: 65756e69746e6f63 R14: 633d73726f727265 R15: 0000000000000001
> </TASK>
> —[ end trace ]—
>
>
> —
> 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.
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
^ permalink raw reply [flat|nested] 6+ messages in thread* Forwarded: test
2025-04-30 13:26 [syzbot] [jfs?] UBSAN: shift-out-of-bounds in jfs_statfs (3) syzbot
2025-06-09 22:13 ` syzbot
2025-09-28 3:22 ` Forwarded: " syzbot
@ 2025-11-20 15:15 ` syzbot
2026-04-17 9:08 ` Forwarded: [PATCH] jfs: validate l2nbperiext in diMount() to prevent shift-out-of-bounds syzbot
2026-04-17 16:19 ` Forwarded: Re: [syzbot] UBSAN: shift-out-of-bounds in jfs_statfs syzbot
4 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2025-11-20 15:15 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: test
Author: yun.zhou@windriver.com
#syz test
^ permalink raw reply [flat|nested] 6+ messages in thread
* Forwarded: [PATCH] jfs: validate l2nbperiext in diMount() to prevent shift-out-of-bounds
2025-04-30 13:26 [syzbot] [jfs?] UBSAN: shift-out-of-bounds in jfs_statfs (3) syzbot
` (2 preceding siblings ...)
2025-11-20 15:15 ` Forwarded: test syzbot
@ 2026-04-17 9:08 ` syzbot
2026-04-17 16:19 ` Forwarded: Re: [syzbot] UBSAN: shift-out-of-bounds in jfs_statfs syzbot
4 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2026-04-17 9:08 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: [PATCH] jfs: validate l2nbperiext in diMount() to prevent shift-out-of-bounds
Author: tristmd@gmail.com
From: Tristan Madani <tristan@talencesecurity.com>
#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
diMount() reads im_l2nbperiext and im_nbperiext directly from on-disk
metadata without validating them. A corrupted filesystem image can set
im_l2nbperiext to an arbitrarily large value, which is then used as a
shift exponent in jfs_statfs():
maxinodes = min((s64) atomic_read(&imap->im_numinos) +
((sbi->bmap->db_nfree >> imap->im_l2nbperiext)
<< L2INOSPEREXT), (s64) 0xffffffffLL);
This triggers UBSAN shift-out-of-bounds when the exponent exceeds 63.
Add a sanity check after reading both fields in diMount() to reject
the filesystem mount if l2nbperiext is out of range or inconsistent
with nbperiext.
Reported-by: syzbot+13ba7f3e9a17f77250fe@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=13ba7f3e9a17f77250fe
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
fs/jfs/jfs_imap.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index XXXXXXX..XXXXXXX 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -125,6 +125,17 @@ int diMount(struct inode *ipimap)
imap->im_nbperiext = le32_to_cpu(dinom_le->in_nbperiext);
imap->im_l2nbperiext = le32_to_cpu(dinom_le->in_l2nbperiext);
+
+ if (imap->im_l2nbperiext < 0 ||
+ imap->im_l2nbperiext > 30 ||
+ imap->im_nbperiext != (1 << imap->im_l2nbperiext)) {
+ jfs_err("diMount: invalid imap parameters: "
+ "nbperiext(%d) l2nbperiext(%d)",
+ imap->im_nbperiext, imap->im_l2nbperiext);
+ release_metapage(mp);
+ kfree(imap);
+ return -EINVAL;
+ }
+
for (index = 0; index < MAXAG; index++) {
imap->im_agctl[index].inofree =
le32_to_cpu(dinom_le->in_agctl[index].inofree);
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* Forwarded: Re: [syzbot] UBSAN: shift-out-of-bounds in jfs_statfs
2025-04-30 13:26 [syzbot] [jfs?] UBSAN: shift-out-of-bounds in jfs_statfs (3) syzbot
` (3 preceding siblings ...)
2026-04-17 9:08 ` Forwarded: [PATCH] jfs: validate l2nbperiext in diMount() to prevent shift-out-of-bounds syzbot
@ 2026-04-17 16:19 ` syzbot
4 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2026-04-17 16:19 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Re: [syzbot] UBSAN: shift-out-of-bounds in jfs_statfs
Author: tristmd@gmail.com
#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>From 88957226783011487a1627b69a6295cb9aa7e5ac Mon Sep 17 00:00:00 2001
From: Tristan Madani <tristan@talencesecurity.com>
Date: Fri, 17 Apr 2026 16:15:13 +0000
Subject: [PATCH] jfs: validate l2nbperiext in diMount() to prevent
shift-out-of-bounds
A corrupted filesystem image can set im_l2nbperiext to an arbitrary
value. When this value exceeds the width of an integer type, a shift
operation using it triggers UBSAN shift-out-of-bounds.
Add validation in diMount() to reject im_l2nbperiext values that are
negative, exceed 30, or are inconsistent with im_nbperiext.
Reported-by: syzbot+13ba7f3e9a17f77250fe@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=13ba7f3e9a17f77250fe
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
fs/jfs/jfs_imap.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index b84ba4d..eafbd2b 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -124,6 +124,18 @@ int diMount(struct inode *ipimap)
atomic_set(&imap->im_numfree, le32_to_cpu(dinom_le->in_numfree));
imap->im_nbperiext = le32_to_cpu(dinom_le->in_nbperiext);
imap->im_l2nbperiext = le32_to_cpu(dinom_le->in_l2nbperiext);
+
+ if (imap->im_l2nbperiext < 0 ||
+ imap->im_l2nbperiext > 30 ||
+ imap->im_nbperiext != (1 << imap->im_l2nbperiext)) {
+ jfs_err("diMount: invalid imap parameters: "
+ "nbperiext(%d) l2nbperiext(%d)",
+ imap->im_nbperiext, imap->im_l2nbperiext);
+ release_metapage(mp);
+ kfree(imap);
+ return -EINVAL;
+ }
+
for (index = 0; index < MAXAG; index++) {
imap->im_agctl[index].inofree =
le32_to_cpu(dinom_le->in_agctl[index].inofree);
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread