From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: Matt Jan <zoo868e@gmail.com>,
jfs-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
Shuan Khan <skhan@linuxfoundation.org>
Cc: syzbot+9e90a1c5eedb9dc4c6cc@syzkaller.appspotmail.com
Subject: Re: [PATCH v4] jfs: UBSAN: shift-out-of-bounds in dbFindBits
Date: Mon, 2 Dec 2024 14:53:58 -0600 [thread overview]
Message-ID: <a5d8f41d-abe3-4a76-994f-6047148f5554@oracle.com> (raw)
In-Reply-To: <20241101095955.9786-1-zoo868e@gmail.com>
On 11/1/24 4:59AM, Matt Jan wrote:
> Ensure l2nb is less than BUDMIN by performing a sanity check in the caller.
> Return -EIO if the check fails.
Sorry for the delay again, but I'm still not okay with this patch.
It's possible for l2nb to be greater than L2DBWORD if and only if the
entire dmap page represents free space.
In dbAllocNear, there is a test:
if (leaf[word] < l2nb)
before dbFindbits is called. This will prevent the problem in dbFindbits
from this path. The problem still remains in dbAllocDmapLev since there
is no similar check.
>
> #syz test
>
> Reported-by: syzbot+9e90a1c5eedb9dc4c6cc@syzkaller.appspotmail.com
> Signed-off-by: Matt Jan <zoo868e@gmail.com>
> ---
> Changes in v4: Thanks to Shaggy for the review. We now perform a sanity check instead of continuing as if nothing is wrong.
> Changes in v3: Return the result earlier instead of assert it
> Changes in v2: Test if the patch resolve the issue through syzbot and reference the reporter
>
> fs/jfs/jfs_dmap.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
> index 974ecf5e0d95..89c22a18314f 100644
> --- a/fs/jfs/jfs_dmap.c
> +++ b/fs/jfs/jfs_dmap.c
> @@ -1217,7 +1217,7 @@ dbAllocNear(struct bmap * bmp,
> int word, lword, rc;
> s8 *leaf;
>
> - if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
> + if (dp->tree.leafidx != cpu_to_le32(LEAFIND) || l2nb >= L2DBWORD) {
> jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
> return -EIO;
> }
> @@ -1969,7 +1969,7 @@ dbAllocDmapLev(struct bmap * bmp,
> if (dbFindLeaf((dmtree_t *) &dp->tree, l2nb, &leafidx, false))
> return -ENOSPC;
>
> - if (leafidx < 0)
> + if (leafidx < 0 || l2nb >= L2DBWORD)
> return -EIO;
>
> /* determine the block number within the file system corresponding
next prev parent reply other threads:[~2024-12-02 20:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 6:49 [syzbot] [jfs?] UBSAN: shift-out-of-bounds in dbFindBits (2) syzbot
2024-10-25 15:24 ` [PATCH v2] jfs: UBSAN: shift-out-of-bounds in dbFindBits Matt Jan
2024-10-25 15:39 ` [syzbot] [jfs?] UBSAN: shift-out-of-bounds in dbFindBits (2) syzbot
2024-10-25 16:30 ` [syzbot] [PATCH v3] jfs: UBSAN: shift-out-of-bounds in dbFindBits syzbot
2024-10-25 17:00 ` Matt Jan
2024-10-25 17:20 ` [syzbot] [jfs?] UBSAN: shift-out-of-bounds in dbFindBits (2) syzbot
2024-10-30 15:15 ` [PATCH v3] jfs: UBSAN: shift-out-of-bounds in dbFindBits Dave Kleikamp
2024-11-01 9:59 ` [PATCH v4] " Matt Jan
2024-11-01 10:20 ` [syzbot] [jfs?] UBSAN: shift-out-of-bounds in dbFindBits (2) syzbot
2024-12-02 20:53 ` Dave Kleikamp [this message]
2025-09-28 1:00 ` Forwarded: " syzbot
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=a5d8f41d-abe3-4a76-994f-6047148f5554@oracle.com \
--to=dave.kleikamp@oracle.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=syzbot+9e90a1c5eedb9dc4c6cc@syzkaller.appspotmail.com \
--cc=zoo868e@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®