x86/efistub: Prefer EFI memory attributes protocol over DXE services
authorArd Biesheuvel <ardb@kernel.org>
Mon, 7 Aug 2023 16:27:14 +0000 (18:27 +0200)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 7 Aug 2023 18:54:15 +0000 (20:54 +0200)
commit11078876b7a6a1b7226344fecab968945c806832
treea0918972b5fa740fd458782c3f0e06be57e59ec4
parentcb1c9e02b0c13032c3aec325643453ba48e96e17
x86/efistub: Prefer EFI memory attributes protocol over DXE services

Currently, the EFI stub relies on DXE services in some cases to clear
non-execute restrictions from page allocations that need to be
executable. This is dodgy, because DXE services are not specified by
UEFI but by PI, and they are not intended for consumption by OS loaders.
However, no alternative existed at the time.

Now, there is a new UEFI protocol that should be used instead, so if it
exists, prefer it over the DXE services calls.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20230807162720.545787-18-ardb@kernel.org
drivers/firmware/efi/libstub/x86-stub.c