From: Simon Horman <horms@kernel.org>
To: kexec@lists.infradead.org
Cc: Tristan <TristanInSec@gmail.com>
Subject: Re: [PATCH kexec-tools 0/3] kexec: bounds and validation fixes for uImage and PE zboot
Date: Tue, 1 Dec 2026 20:03:08 +0000 [thread overview]
Message-ID: <20261201200308.GA456681@horms.kernel.org> (raw)
In-Reply-To: <20261110-2x-overflow-v1-0-8f3598b31a43@kernel.org>
On Tue, Nov 10, 2026 at 11:35:15AM +0000, Simon Horman wrote:
> Hi,
>
> This series addresses two bounds validation issues reported by Tristan
> when processing untrusted or corrupted kernel images in kexec-tools:
>
> 1. In uImage_gz_load(), optional gzip header fields (EXTRA_FIELD,
> ORIG_NAME, COMMENT, HEAD_CRC) were parsed using unbounded scans and
> offset arithmetic without verifying whether the computed offset stayed
> within the input buffer. This could lead to out-of-bounds heap reads
> or buffer length underflow, crashing kexec.
>
> Patch 1 first refactors uImage_gz_load() to use a common goto unwind
> path for freeing the decompression buffer on error.
> Patch 2 adds the necessary bounds and length checks.
>
> 2. In pez_prepare(), payload_offset and payload_size are 32-bit values
> read from untrusted PE zboot headers. Adding them directly could wrap
> around, bypassing the bounds check and causing an out-of-bounds read
> when staging the payload.
>
> Patch 3 checks that the buffer is large enough for the header and
> avoids wrap-around by using defensive subtraction.
>
> ---
> Simon Horman (3):
> uImage: use goto for unwind in uImage_gz_load
> uImage: add bounds checks when parsing gzip headers in uImage_gz_load()
> pe-zboot: fix integer overflow in payload bounds check in pez_prepare()
Applied:
- pe-zboot: fix integer overflow in payload bounds check in pez_prepare()
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=0052381b29f3
- uImage: add bounds checks when parsing gzip headers in uImage_gz_load()
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=ea20da8a3db8
- uImage: use goto for unwind in uImage_gz_load
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=a315e6248d5f
prev parent reply other threads:[~2026-12-01 20:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 11:35 [PATCH kexec-tools 0/3] kexec: bounds and validation fixes for uImage and PE zboot Simon Horman
2026-11-10 11:35 ` [PATCH kexec-tools 1/3] uImage: use goto for unwind in uImage_gz_load Simon Horman
2026-11-10 11:35 ` [PATCH kexec-tools 2/3] uImage: add bounds checks when parsing gzip headers in uImage_gz_load() Simon Horman
2026-11-10 11:35 ` [PATCH kexec-tools 3/3] pe-zboot: fix integer overflow in payload bounds check in pez_prepare() Simon Horman
2026-12-01 20:03 ` Simon Horman [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=20261201200308.GA456681@horms.kernel.org \
--to=horms@kernel.org \
--cc=TristanInSec@gmail.com \
--cc=kexec@lists.infradead.org \
/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