]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Set NXCOMPAT bit in PE header
authorMichael Brown <mcb30@ipxe.org>
Wed, 22 Nov 2023 23:36:35 +0000 (23:36 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 23 Nov 2023 13:21:42 +0000 (13:21 +0000)
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>
src/util/elf2efi.c

index 4ed016c0f25c99e3c91628b47b6c79faa1c20149..f4d591d1e3e092a0c40e963ce357832d30028a65 100644 (file)
@@ -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,
                },
        },