wolfBoot/tools
Daniele Lacamera d175c819cd F-4645: bound load_linux kernel size to prevent syssize*16 overflow
load_linux() computed the protected-mode kernel size as the uint32_t
product param.hdr.syssize * 16 (src/x86/linux_loader.c), where syssize
is copied verbatim from the (authenticated) bzImage at offset 0x1f4.
The multiplication wraps for any syssize > 0x0FFFFFFF: syssize=0x10000000
yields kernel_size=0 (DoS), and syssize=0x1FFFFFFF/0xFFFFFFFF yields
kernel_size=0xFFFFFFF0 (~4 GiB). That value fed straight into
memcpy((uint8_t*)KERNEL_LOAD_ADDRESS, linux_image + param_size,
kernel_size) with no cap, overwriting wolfBoot stage2, FSP data, and the
heap (CWE-190 -> CWE-680).

Fix at the root: linux_kernel_size() computes syssize * 16 in 64-bit and
rejects the image (panic) when the result is zero or does not fit in the
destination window [KERNEL_LOAD_ADDRESS, tolum). tolum is the top of low
usable memory the FSP already reports and that the ELF boot path uses as
its load upper bound (src/boot_x86_fsp_payload.c). The kernel load only
runs under WOLFBOOT_FSP (the non-FSP path panics earlier at the memory
map step), so tolum is always available there.

Add unit-linux-loader-syssize regression test (x86 32bit, standalone)
that feeds the PoC overflow values and asserts they are rejected while a
legitimate kernel and the exact-fit boundary are accepted.
2026-06-05 19:33:51 +02:00
..
bin-assemble
…
check_config
…
delta
…
efi
…
elf-parser
…
fdt-parser fit: gzip-compressed kernel + ramdisk (initramfs) support 2026-05-05 10:16:16 +02:00
keytools Continue the ML-DSA renaming 2026-05-19 11:21:20 -07:00
lms
…
renode
…
scripts Add wolfBoot port for STM32N6 (NUCLEO-N657X0-Q) 2026-05-28 16:49:57 +02:00
squashelf
…
test-expect-version
…
test-update-server
…
tpm
…
uart-flash-server
…
unit-tests F-4645: bound load_linux kernel size to prevent syssize*16 overflow 2026-06-05 19:33:51 +02:00
xmss
…
config.mk Add wolfBoot port for STM32N6 (NUCLEO-N657X0-Q) 2026-05-28 16:49:57 +02:00
test-delta.mk
…
test-enc.mk
…
test-renode.mk
…
test.mk Update wolfssl submodule to latest master 2026-05-18 23:02:54 -07:00
wolfboot-rpi-devicetree.diff
…