]> git.baikalelectronics.ru Git - kernel.git/commitdiff
efi: x86: Set the NX-compatibility flag in the PE header
authorPeter Jones <pjones@redhat.com>
Tue, 29 Mar 2022 18:47:43 +0000 (14:47 -0400)
committerArd Biesheuvel <ardb@kernel.org>
Tue, 3 May 2022 13:31:28 +0000 (15:31 +0200)
Following Baskov Evgeniy's "Handle UEFI NX-restricted page tables"
patches, it's safe to set this compatibility flag to let loaders know
they don't need to make special accommodations for kernel to load if
pre-boot NX is enabled.

Signed-off-by: Peter Jones <pjones@redhat.com>
Link: https://lore.kernel.org/all/20220329184743.798513-1-pjones@redhat.com/
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
arch/x86/boot/header.S

index 6dbd7e9f74c9caf51a08dcc3cd2924982b2120f1..0352e4589efa2e52636beb9ac169892cce41f619 100644 (file)
@@ -163,7 +163,11 @@ extra_header_fields:
        .long   0x200                           # SizeOfHeaders
        .long   0                               # CheckSum
        .word   IMAGE_SUBSYSTEM_EFI_APPLICATION # Subsystem (EFI application)
+#ifdef CONFIG_DXE_MEM_ATTRIBUTES
+       .word   IMAGE_DLL_CHARACTERISTICS_NX_COMPAT     # DllCharacteristics
+#else
        .word   0                               # DllCharacteristics
+#endif
 #ifdef CONFIG_X86_32
        .long   0                               # SizeOfStackReserve
        .long   0                               # SizeOfStackCommit