diff options
| author | Aristo Chen <[email protected]> | 2026-06-05 15:42:49 +0000 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-06-17 09:53:20 -0600 |
| commit | 2ff26c1e37858ba0b2fd12c82e114a3cedcb317a (patch) | |
| tree | 0d621c87f59d70981f97162534e191c58c3da7a6 /doc/develop/bootstd | |
| parent | d3eee4d3b120f2fe30932b2f29d935cc9ac9ddb3 (diff) | |
bootm: fix overflow of the noload kernel decompression buffer
For a compressed kernel_noload image, bootm_load_os() allocates a
decompression buffer sized to ALIGN(image_len * 4, SZ_1M), assuming the
kernel compresses by no more than a factor of four. It then passes
CONFIG_SYS_BOOTM_LEN, rather than the size of that buffer, to
image_decomp() as the output limit. The decompressors honour the limit
they are given, so a kernel that decompresses to more than four times
its compressed size is written past the end of the allocated buffer and
corrupts adjacent memory.
Pass the allocation size to image_decomp() and handle_decomp_error() so
decompression stops at the buffer boundary and fails cleanly when the
image is too large, instead of overflowing. The regular non-noload
paths are unchanged and continue to use CONFIG_SYS_BOOTM_LEN. When the
failure is triggered by the smaller per-image buffer, print a note so
that handle_decomp_error()'s generic advice to increase
CONFIG_SYS_BOOTM_LEN does not mislead the reader.
Fixes: 69544c4fd8b1 ("bootm: Support kernel_noload with compression")
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Aristo Chen <[email protected]>
Diffstat (limited to 'doc/develop/bootstd')
0 files changed, 0 insertions, 0 deletions
