RFC efi/zboot: Encapsulate ELF image for arm64
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest4 patches 9 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | efi/libstub: Avoid legacy decompressor zlib/zstd wrappersdrivers/ drivers/ drivers/ +3 more | +163 | 7 replies | |
| 2/4 | efi/zboot: Add support for ELF payloadsarch/ drivers/ drivers/ +7 more | +223 | 0 replies | |
| 3/4 | arm64/boot: Populate vmlinux ELF program headersarch/ | +22 | 0 replies | |
| 4/4 | efi/arm64: Use ELF payload for EFI zbootarch/ arch/ drivers/ +1 more | +0 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC PATCH 0/4] efi/zboot: Encapsulate ELF image for arm64
From: Ard Biesheuvel <[email protected]>
The EFI zboot image format was introduced to provide a way to distribute an EFI bootable image for architectures such as arm64, RISC-V and Loongarch supporting both compression and EFI secure boot signing.
To make this format easy to digest for other consumers than EFI firmware (e.g., qemu or kexec), the file header describes the compression type and the offset and size of the compressed image inside the file. Additional metadata of the payload is currently injected using ELF symbols (currently, the size of the executable image's code region on arm64), but this information is not accessible to other consumers unless it is exposed either via the header, or via the payload itself.
It would be better to have a structured format inside the container, so that any annotation can be added without the need to tweak the EFI zboot header layout. On x86, the legacy decompressor encapsulates an ELF image, so that ELF notes can be used for arbitrary metadata, and this is heavily used by Xen.
Let's implement something similar for the generic EFI zboot format. This removes the need for per-arch hacks to inject symbols, and makes a future alignment of EFI zboot with x86 more feasible as well.
So switch to the ELF format for the EFI zboot payload, but implement it in such a way that decompressing the entire ELF image is unnecessary. Instead, decompress the ELF file header and program headers first, and discard any file data that is not covered by a PT_LOAD program header (and therefore not part of the executable's memory image).
The latter approach permits EFI zboot to be used with unstripped ELF binaries, making EFI zboot suitable for future use as a hybrid bootable image and debug symbol library for the running kernel.
Ard Biesheuvel (4):
efi/libstub: Avoid legacy decompressor zlib/zstd wrappers efi/zboot: Add support for ELF payloads arm64/boot: Populate vmlinux ELF program headers efi/arm64: Use ELF payload for EFI zboot
arch/arm64/boot/Makefile | 4 - arch/arm64/include/asm/efi.h | 2 +- arch/arm64/kernel/image-vars.h | 4 - arch/arm64/kernel/vmlinux.lds.S | 33 ++-- drivers/firmware/efi/libstub/Makefile | 9 +- drivers/firmware/efi/libstub/Makefile.zboot | 6 + drivers/firmware/efi/libstub/arm64-stub.c | 2 +- drivers/firmware/efi/libstub/arm64.c | 20 +-- drivers/firmware/efi/libstub/efistub.h | 9 ++ drivers/firmware/efi/libstub/zboot-decompress-gzip.c | 77 ++++++++++ drivers/firmware/efi/libstub/zboot-decompress-zstd.c | 91 +++++++++++ drivers/firmware/efi/libstub/zboot-decompress.c | 161 ++++++++++++++++++++ drivers/firmware/efi/libstub/zboot.c | 58 ++----- drivers/firmware/efi/libstub/zboot.lds | 7 +- 14 files changed, 391 insertions(+), 92 deletions(-) create mode 100644 drivers/firmware/efi/libstub/zboot-decompress-gzip.c create mode 100644 drivers/firmware/efi/libstub/zboot-decompress-zstd.c create mode 100644 drivers/firmware/efi/libstub/zboot-decompress.c
base-commit: 78d4f34e2115b517bcbfe7ec0d018bbbb6f9b0b8
Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog