Skip to contentSkip to conversation

efi/x86: Set the PE/COFF header's NX compat flag unconditionally

PATCH Applied Ard Biesheuvel 2 participants 2 messages Jan 16, 2024 – Feb 28, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi/x86: Set the PE/COFF header's NX compat flag unconditionally

From: Ard Biesheuvel <[email protected]>

Now that we use the proper section and file alignment, and invoke the EFI memory attributes protocol to manage executable permissions where needed, we can set the NX compat flag unconditionally.

---
 arch/x86/boot/header.S | 4 ----
 1 file changed, 4 deletions(-)
arch/x86/boot/header.S +0 -4
index b2771710ed98..34963501a2c5 100644
@@ -112,11 +112,7 @@ extra_header_fields:
 	.long	salign				# SizeOfHeaders
 	.long	0				# CheckSum
 	.word	IMAGE_SUBSYSTEM_EFI_APPLICATION	# Subsystem (EFI application)
-#ifdef CONFIG_EFI_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
Signature · 1 line
2.43.0.275.g3460e3d667-goog
merge bot Applied
#1 lore raw
The following commit has been merged into the x86/boot branch of tip:

The following commit has been merged into the x86/boot branch of tip:

Commit-ID:     891f8890a4a3663da7056542757022870b499bc1
Gitweb:        https://git.kernel.org/tip/891f8890a4a3663da7056542757022870b499bc1
Author:        Ard Biesheuvel <[email protected]>
AuthorDate:    Tue, 16 Jan 2024 09:53:48 +01:00
Committer:     Borislav Petkov (AMD) <[email protected]>
CommitterDate: Wed, 28 Feb 2024 14:23:55 +01:00

efi/x86: Set the PE/COFF header's NX compat flag unconditionally

Now that the proper section and file alignment is used, and the EFI memory attributes protocol to manage executable permissions where needed is invoked, set the NX compat flag unconditionally.

[ bp: Remove the "we"s. ]

---
 arch/x86/boot/header.S | 4 ----
 1 file changed, 4 deletions(-)
arch/x86/boot/header.S +0 -4
index a1bbedd..b5c79f4 100644
@@ -111,11 +111,7 @@ extra_header_fields:
 	.long	salign				# SizeOfHeaders
 	.long	0				# CheckSum
 	.word	IMAGE_SUBSYSTEM_EFI_APPLICATION	# Subsystem (EFI application)
-#ifdef CONFIG_EFI_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