From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f71.google.com (mail-oo1-f71.google.com [209.85.161.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7ABA028F5 for ; Fri, 17 Apr 2026 16:20:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.71 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776442841; cv=none; b=s//U78TzAvMNGIKimOx5JWTK7pNCxVTh2vzgpEHizEKIJJqpEpOdnR8S2tXXk1qKjfmQoQhoHUxHiMu+ITDwSyu5v3bn93C2uP2H3OTdJDr305P8H995bV0H2yTTzdiYbWFTea97TqbRj7YcfJBc0v4Fhj+vq7LHkOfq92PxjIQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776442841; c=relaxed/simple; bh=u4YuwDT76J0HcdBZ1B8LyVe2vC02yzzR2Rv8cEO224w=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=OYUfGcX4lu9q7adNH8snwY3s3LSia/UkQRKxzrVgsVKipPPegBakdqMbKaP1tA69GkgAKNZp4zO1aqahCPL/zxv4TaxFKmafuqskcbmTbIzzmPV1qjVIgIBxV5cJsNcYwLH7tKYrYFM8qORrLrtFtbJe0aiISz6anHJ3wzjlw7c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.161.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oo1-f71.google.com with SMTP id 006d021491bc7-68cfc614246so1249697eaf.3 for ; Fri, 17 Apr 2026 09:20:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776442839; x=1777047639; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UOzoBjvV2RzPptkWd+hf+tVhobQ2HFiUTFm4Q6AXLJQ=; b=YrSuzC5sf+FfZBJRol+7uzCvi1z7EcleVOdKXjIroeB3rfr83ko1gidagtEnoQ7sg4 3uzLo+bH0LRHacjPjcqFv+1IObqI/BqeBpG70UEKMKSfTGf+pd4bfCSB6XYFjE+AfR+k tKKCCyIyYeKM5LjxZVOoIbEZc7fcUeGOVLlxtuY+LG9BbObPT+nF49onU4McXjsg8CFo UoYlX/v8WA5ZVb1Bkt/WAFZu9RwWm11LrOL7cCVAFiru+M1FZ0LHACSqFYN1YTdZmCpK qajMvgtEa0CNhIU1QYaZmqow2WMIcsfrNRJilegcyQuRXsaI5VYfRAf4eZ7A9aTebcNn YDig== X-Gm-Message-State: AOJu0YyBTEzNEpPOcMAQHtqoOV16tJ65ApUXR0am2eOymopVLPDf19UQ q9LMIwDGN4zsjoA9KZS98SHQgjayp8qjpl7e/7s3ALId/2TP5OUNl3GwwBhgwH69vA9bfiJNEJi 08WM3K8LmUP14qi+khJ/aZORSOMRFwYCKzO48OPzK+aZdZgD5riKYA4p5FCg= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a4a:ec42:0:b0:68a:223c:fa8f with SMTP id 006d021491bc7-69462ef729emr1750407eaf.36.1776442839546; Fri, 17 Apr 2026 09:20:39 -0700 (PDT) Date: Fri, 17 Apr 2026 09:20:39 -0700 In-Reply-To: <0000000000002e9eb506178cdd71@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69e25dd7.050a0220.1de265.002a.GAE@google.com> Subject: Forwarded: Re: [syzbot] UBSAN: shift-out-of-bounds in extBalloc From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" 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 extBalloc Author: tristmd@gmail.com #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master >>From b6c61a3aa0dc413323721f4dde24a47cf88f6f02 Mon Sep 17 00:00:00 2001 From: Tristan Madani Date: Fri, 17 Apr 2026 16:15:15 +0000 Subject: [PATCH] jfs: validate db_maxfreebud in extBalloc to prevent shift-out-of-bounds extBalloc() uses db_maxfreebud as a shift count without validation. A corrupted filesystem image can set db_maxfreebud outside the valid range [0, 63], causing UBSAN shift-out-of-bounds in the expression `(s64) 1 << bmp->db_maxfreebud`. Add a range check before the shift. Reported-by: syzbot+13e8cd4926977f8337b6@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=13e8cd4926977f8337b6 Signed-off-by: Tristan Madani --- fs/jfs/jfs_extent.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c index 46529bc..5abdb60 100644 --- a/fs/jfs/jfs_extent.c +++ b/fs/jfs/jfs_extent.c @@ -326,6 +326,12 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno) if (bmp->db_maxfreebud == -1) return -ENOSPC; + if (bmp->db_maxfreebud < 0 || bmp->db_maxfreebud > 63) { + jfs_error(ip->i_sb, + "invalid db_maxfreebud: %d\n", bmp->db_maxfreebud); + return -EIO; + } + max = (s64) 1 << bmp->db_maxfreebud; if (*nblocks >= max && *nblocks > nbperpage) nb = nblks = (max > nbperpage) ? max : nbperpage; -- 2.47.3