All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Hesse <list@eworm.de>
To: Michael Chang via Grub-devel <grub-devel@gnu.org>
Cc: Michael Chang <mchang@suse.com>
Subject: Re: [PATCH] fs/ext2: Rework out-of-bounds read for inline and external extents
Date: Fri, 21 Feb 2025 10:02:54 +0100	[thread overview]
Message-ID: <20250221100254.03f2e337@leda.eworm.net> (raw)
In-Reply-To: <20250221010613.1179224-1-mchang@suse.com>


[-- Attachment #1.1: Type: text/plain, Size: 1291 bytes --]

Michael Chang via Grub-devel <grub-devel@gnu.org> on Fri, 2025/02/21 09:06:
> Previously, the number of extent entries was not properly capped based
> on the actual available space. This could lead to insufficient reads for
> external extents, since the computation was based solely on the inline
> extent layout.
> 
> In this patch, when processing the extent header, we determine whether
> the header is stored inline (i.e., at inode->blocks.dir_blocks) or in an
> external extent block. We then clamp the number of entries accordingly
> (using max_inline_ext for inline extents and max_external_ext for
> external extent blocks).
> 
> This change ensures that only the valid number of extent entries is
> processed, preventing out-of-bound reads and potential filesystem
> corruption.
> 
> Fixes: 7e2f750f0a (fs/ext2: Fix out-of-bounds read for inline extents)
> 
> Signed-off-by: Michael Chang <mchang@suse.com>

Tested and it fixes reading from loopback disk on ext4 for me. Thanks!

Tested-by: Christian Hesse <mail@eworm.de>
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

  reply	other threads:[~2025-02-21  9:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-21  1:06 [PATCH] fs/ext2: Rework out-of-bounds read for inline and external extents Michael Chang via Grub-devel
2025-02-21  9:02 ` Christian Hesse [this message]
2025-02-24 14:42   ` Daniel Kiper

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=20250221100254.03f2e337@leda.eworm.net \
    --to=list@eworm.de \
    --cc=grub-devel@gnu.org \
    --cc=mchang@suse.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.