mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: "Cen Zhang (Microsoft Security FORGE Labs)"
	<cenzhang@linux.microsoft.com>
Cc: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz,
	jkoolstra@xs4all.nl, neil@brown.name, sandeen@redhat.com,
	kees@kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	AutonomousCodeSecurity@microsoft.com, xmei5@asu.edu,
	tgopinath@linux.microsoft.com, kys@microsoft.com
Subject: Re: [PATCH] ufs: validate cylinder group free bitmap offset
Date: Wed, 2 Sep 2026 07:53:28 +0200	[thread overview]
Message-ID: <2026090207-threaten-shakiness-a0bc@gregkh> (raw)
In-Reply-To: <20260901180600.10394-1-cenzhang@linux.microsoft.com>

On Tue, Sep 01, 2026 at 02:06:00PM -0400, Cen Zhang (Microsoft Security FORGE Labs) wrote:
> ufs_read_cylinder() copies cg_freeoff from the on-disk cylinder group
> without checking that the free-fragment bitmap fits in the loaded
> cylinder group buffers. A crafted image can place cg_freeoff past those
> buffers so that allocation later indexes ubh->bh[] out of range.
> 
> UBSAN: array-index-out-of-bounds in fs/ufs/balloc.c:752:15
>   ubh_scanc()              fs/ufs/balloc.c:752
>   ufs_bitmap_search()      fs/ufs/balloc.c
>   ufs_alloccg_block()      fs/ufs/balloc.c
>   ufs_alloc_fragments()    fs/ufs/balloc.c
>   ufs_new_fragments()      fs/ufs/balloc.c
> 
> Reject the cylinder group unless the full BITS_TO_BYTES(s_fpg)
> free-fragment bitmap starting at c_freeoff fits in the bytes actually
> loaded for that cylinder group.

Why not fix the userspace fsck tool to fix this instead of working
around it in the kernel?

thanks,

greg k-h

      reply	other threads:[~2026-09-02  5:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 18:06 Cen Zhang (Microsoft Security FORGE Labs)
2026-09-02  5:53 ` Greg KH [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=2026090207-threaten-shakiness-a0bc@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=AutonomousCodeSecurity@microsoft.com \
    --cc=brauner@kernel.org \
    --cc=cenzhang@linux.microsoft.com \
    --cc=jack@suse.cz \
    --cc=jkoolstra@xs4all.nl \
    --cc=kees@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=sandeen@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=tgopinath@linux.microsoft.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xmei5@asu.edu \
    /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®