Skip to content

Commit 3c66bb1

Browse files
committed
arm64: efi: Set NX compat flag in PE/COFF header
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: <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 3c60f67 commit 3c66bb1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm64/kernel/efi-header.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
.long .Lefi_header_end - .L_head // SizeOfHeaders
6767
.long 0 // CheckSum
6868
.short IMAGE_SUBSYSTEM_EFI_APPLICATION // Subsystem
69-
.short 0 // DllCharacteristics
69+
.short IMAGE_DLL_CHARACTERISTICS_NX_COMPAT // DllCharacteristics
7070
.quad 0 // SizeOfStackReserve
7171
.quad 0 // SizeOfStackCommit
7272
.quad 0 // SizeOfHeapReserve

0 commit comments

Comments
 (0)