From: syzbot <syzbot+13ba7f3e9a17f77250fe@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: Re: [syzbot] UBSAN: shift-out-of-bounds in jfs_statfs
Date: Fri, 17 Apr 2026 09:19:44 -0700 [thread overview]
Message-ID: <69e25da0.a00a0220.1bd0ca.0007.GAE@google.com> (raw)
In-Reply-To: <68122507.050a0220.3a872c.0001.GAE@google.com>
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
prev parent reply other threads:[~2026-04-17 16:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Forwarded: test 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 ` syzbot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=69e25da0.a00a0220.1bd0ca.0007.GAE@google.com \
--to=syzbot+13ba7f3e9a17f77250fe@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.