[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJM55Z-3fPh-qyb_dpaBH12ocV3yheR8Rentg2oz9jCVLAuJBA@mail.gmail.com>
Date: Tue, 1 Oct 2024 03:56:05 -0700
From: Emil Renner Berthing <emil.renner.berthing@...onical.com>
To: Heinrich Schuchardt <heinrich.schuchardt@...onical.com>,
Paul Walmsley <paul.walmsley@...ive.com>, Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>
Cc: Ard Biesheuvel <ardb@...nel.org>,
Emil Renner Berthing <emil.renner.berthing@...onical.com>, linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH 1/1] riscv: efi: Set NX compat flag in PE/COFF header
Heinrich Schuchardt wrote:
> 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@...nel.org>
> Cc: <stable@...r.kernel.org>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@...onical.com>
Makes sense to me. This was applied a year ago on arm64:
3c66bb1918c2 ("arm64: efi: Set NX compat flag in PE/COFF header")
..and before that on x86
24b72bb12e84 ("efi: x86: Set the NX-compatibility flag in the PE header")
Reviewed-by: Emil Renner Berthing <emil.renner.berthing@...onical.com>
> ---
> arch/riscv/kernel/efi-header.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kernel/efi-header.S b/arch/riscv/kernel/efi-header.S
> index 515b2dfbca75..c5f17c2710b5 100644
> --- a/arch/riscv/kernel/efi-header.S
> +++ b/arch/riscv/kernel/efi-header.S
> @@ -64,7 +64,7 @@ extra_header_fields:
> .long efi_header_end - _start // SizeOfHeaders
> .long 0 // CheckSum
> .short IMAGE_SUBSYSTEM_EFI_APPLICATION // Subsystem
> - .short 0 // DllCharacteristics
> + .short IMAGE_DLL_CHARACTERISTICS_NX_COMPAT // DllCharacteristics
> .quad 0 // SizeOfStackReserve
> .quad 0 // SizeOfStackCommit
> .quad 0 // SizeOfHeapReserve
> --
> 2.45.2
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
Powered by blists - more mailing lists