]> www.infradead.org Git - users/jedix/linux-maple.git/commit
arm64: efi: Set NX compat flag in PE/COFF header
authorArd Biesheuvel <ardb@kernel.org>
Fri, 10 Mar 2023 12:30:05 +0000 (13:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Apr 2023 10:10:37 +0000 (12:10 +0200)
commite0169d62efce979eb7dbda3101eea180b69ca793
treee5493c4e35060a4f2a22c02e3a320de9b26a0640
parentec6cd79c4e54a2a5867e0497d269ad4f008216ba
arm64: efi: Set NX compat flag in PE/COFF header

[ Upstream commit 3c66bb1918c262dd52fb4221a8d372619c5da70a ]

The PE/COFF header has a NX compat flag which informs the firmware that
the application does not rely on memory regions being mapped with both
executable and writable permissions at the same time.

This is typically used by the firmware to decide whether it can set the
NX attribute on all allocations it returns, but going forward, it may be
used to enforce a policy that only permits applications with the NX flag
set to be loaded to begin wiht in some configurations, e.g., when Secure
Boot is in effect.

Even though the arm64 version of the EFI stub may relocate the kernel
before executing it, it always did so after disabling the MMU, and so we
were always in line with what the NX compat flag conveys, we just never
bothered to set it.

So let's set the flag now.

Cc: <stable@vger.kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm64/kernel/efi-header.S