crosvm/kernel_loader
Will Deacon fd4488b70f kernel_loader: Reserve memory according to 'image_size' header field
The arm64 kernel header contains an 'image_size' field indicating the
minimum size of the reserved memory region into which the kernel is
loaded. This is larger than the size of the Image file, as it also takes
into account NOBITS sections such as the .bss, which will be zeroed
during boot.

Although crosvm parses the kernel header, it fails to take 'image_size'
into account and can end up loading the initrd over the .bss if the
section is large enough to cross the next 16MiB alignment boundary after
the end of the Image.

Size the memory reservation according to the 'image_size' field in the
arm64 kernel Image header, warning if it's zero and falling back to the
current behaviour.

BUG=b:322966413
TEST=tools/dev_container tools/run_tests --platform=aarch64

Change-Id: I23316f201d8a7fd9025762be518aa505e716c642
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5249889
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Will Deacon <willdeacon@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
2024-01-31 09:15:04 +00:00
..
src kernel_loader: Reserve memory according to 'image_size' header field 2024-01-31 09:15:04 +00:00
bindgen.sh crosvm: Uprev zerocopy to 0.7.x 2023-10-10 17:34:32 +00:00
Cargo.toml kernel_loader: Add support for LZ4-compressed kernels 2024-01-24 22:48:25 +00:00