efi: zboot specific mechanism for embedding SBAT section
authorVitaly Kuznetsov <vkuznets@redhat.com>
Tue, 13 May 2025 12:58:07 +0000 (14:58 +0200)
committerArd Biesheuvel <ardb@kernel.org>
Wed, 21 May 2025 13:31:42 +0000 (15:31 +0200)
commit0f9a1739dd0e1ca3942e51dc3ec18f0d68c23be5
treea96e3551e8347d1439132b638807514dec65ca5d
parent0af2f6be1b4281385b618cb86ad946eded089ac8
efi: zboot specific mechanism for embedding SBAT section

SBAT is a mechanism which improves SecureBoot revocations of UEFI binaries
by introducing a generation-based technique. Compromised or vulnerable UEFI
binaries can be prevented from booting by bumping the minimal required
generation for the specific component in the bootloader. More information
on the SBAT can be obtained here:

https://github.com/rhboot/shim/blob/main/SBAT.md

Upstream Linux kernel does not currently participate in any way in SBAT as
there's no existing policy in how SBAT generation number should be
defined. Keep the status quo and provide a mechanism for distro vendors and
anyone else who signs their kernel for SecureBoot to include their own SBAT
data. This leaves the decision on the policy to the vendor. Basically, each
distro implementing SecureBoot today, will have an option to inject their
own SBAT data during kernel build and before it gets signed by their
SecureBoot CA. Different distro do not need to agree on the common SBAT
component names or generation numbers as each distro ships its own 'shim'
with their own 'vendor_cert'/'vendor_db'

Implement support for embedding SBAT data for architectures using
zboot (arm64, loongarch, riscv). Put '.sbat' section in between '.data' and
'.text' as the former also covers '.bss' and thus must be the last one.

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/Kconfig
drivers/firmware/efi/libstub/Makefile.zboot
drivers/firmware/efi/libstub/zboot-header.S
drivers/firmware/efi/libstub/zboot.lds