Skip to content

Commit d41373a

Browse files
xypronpalmer-dabbelt
authored andcommitted
riscv: efi: Set NX compat flag in PE/COFF header
The IMAGE_DLLCHARACTERISTICS_NX_COMPAT informs the firmware that the EFI binary does not rely on pages that are both executable and writable. The flag is used by some distro versions of GRUB to decide if the EFI binary may be executed. As the Linux kernel neither has RWX sections nor needs RWX pages for relocation we should set the flag. Cc: Ard Biesheuvel <ardb@kernel.org> Cc: <stable@vger.kernel.org> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com> Fixes: cb7d2dd ("RISC-V: Add PE/COFF header for EFI stub") Acked-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20240929140233.211800-1-heinrich.schuchardt@canonical.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 33549fc commit d41373a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/riscv/kernel/efi-header.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ extra_header_fields:
6464
.long efi_header_end - _start // SizeOfHeaders
6565
.long 0 // CheckSum
6666
.short IMAGE_SUBSYSTEM_EFI_APPLICATION // Subsystem
67-
.short 0 // DllCharacteristics
67+
.short IMAGE_DLL_CHARACTERISTICS_NX_COMPAT // DllCharacteristics
6868
.quad 0 // SizeOfStackReserve
6969
.quad 0 // SizeOfStackCommit
7070
.quad 0 // SizeOfHeapReserve

0 commit comments

Comments
 (0)