[PATCH kexec-tools 0/3] kexec: bounds and validation fixes for uImage and PE zboot
Simon Horman
horms at kernel.org
Tue Nov 10 03:35:15 PST 2026
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
More information about the kexec
mailing list