Skip to content

Commit

Permalink
[efi] Set NXCOMPAT bit in PE header
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mcb30 committed Nov 23, 2023
1 parent 678a60f commit a9e8978
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/util/elf2efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
Expand Down

0 comments on commit a9e8978

Please sign in to comment.