summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2023-11-23 00:36:35 +0100
committerMichael Brown2023-11-23 14:21:42 +0100
commita9e89787d08df46daee85a871ba256daf84c6f34 (patch)
tree3309759681031b5eb837474bf6eed36d0b5d50d2
parent[efi] Treat writable sections as data sections (diff)
downloadipxe-a9e89787d08df46daee85a871ba256daf84c6f34.tar.gz
ipxe-a9e89787d08df46daee85a871ba256daf84c6f34.tar.xz
ipxe-a9e89787d08df46daee85a871ba256daf84c6f34.zip
[efi] Set NXCOMPAT bit in PE header
Indicate that the binary is compatible with W^X protections by setting the NXCOMPAT bit in the DllCharacteristics field of the PE header. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/util/elf2efi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c
index 4ed016c0..f4d591d1 100644
--- a/src/util/elf2efi.c
+++ b/src/util/elf2efi.c
@@ -225,6 +225,8 @@ static struct pe_header efi_pe_header = {
.FileAlignment = EFI_FILE_ALIGN,
.SizeOfImage = EFI_IMAGE_ALIGN,
.SizeOfHeaders = sizeof ( efi_pe_header ),
+ .DllCharacteristics =
+ IMAGE_DLLCHARACTERISTICS_NX_COMPAT,
.NumberOfRvaAndSizes = NUMBER_OF_DIRECTORY_ENTRIES,
},
},