All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kexec-tools 0/3] kexec: bounds and validation fixes for uImage and PE zboot
@ 2026-11-10 11:35 Simon Horman
  2026-11-10 11:35 ` [PATCH kexec-tools 1/3] uImage: use goto for unwind in uImage_gz_load Simon Horman
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Simon Horman @ 2026-11-10 11:35 UTC (permalink / raw)
  To: kexec; +Cc: Tristan, Simon Horman

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()

 kexec/kexec-pe-zboot.c |  6 ++++-
 kexec/kexec-uImage.c   | 61 +++++++++++++++++++++++++++++++++-----------------
 2 files changed, 45 insertions(+), 22 deletions(-)

base-commit: 0fd0d8e9ea975696fdc05ad267a65f3efd415612



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-01 20:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH kexec-tools 0/3] kexec: bounds and validation fixes for uImage and PE zboot Simon Horman

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.