arm64: efi: Enable BTI codegen and add PE/COFF annotation
authorArd Biesheuvel <ardb@kernel.org>
Tue, 18 Apr 2023 13:49:48 +0000 (15:49 +0200)
committerArd Biesheuvel <ardb@kernel.org>
Thu, 20 Apr 2023 13:43:45 +0000 (15:43 +0200)
commit8358098b9787caab8bbc93fd78d046afaed43c16
treed00030b3467c7ec515910cf055da391ef08530c5
parent038585573d0544bc717cdc5b3be4e95206d3ee3d
arm64: efi: Enable BTI codegen and add PE/COFF annotation

UEFI heavily relies on so-called protocols, which are essentially
tables populated with pointers to executable code, and these are invoked
indirectly using BR or BLR instructions.

This makes the EFI execution context vulnerable to attacks on forward
edge control flow, and so it would help if we could enable hardware
enforcement (BTI) on CPUs that implement it.

So let's no longer disable BTI codegen for the EFI stub, and set the
newly introduced PE/COFF header flag when the kernel is built with BTI
landing pads.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Mark Brown <broonie@kernel.org>
arch/arm64/kernel/efi-header.S
drivers/firmware/efi/libstub/Makefile