[PATCH RFC 4/5] efi: Add option for handling efi memory protection

From: Baskov Evgeniy
Date: Wed Nov 10 2021 - 05:56:55 EST


Add option to enable handling strict page table permissions
added in previous patches.

Signed-off-by: Baskov Evgeniy <baskov@xxxxxxxxx>
---
drivers/firmware/efi/Kconfig | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index 2c3dac5ecb36..f57a9c865dce 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -243,6 +243,23 @@ config EFI_DISABLE_PCI_DMA
options "efi=disable_early_pci_dma" or "efi=no_disable_early_pci_dma"
may be used to override this option.

+config EFI_STRICT_PGTABLE
+ bool "Handle strict page table permissions in libstub"
+ depends on EFI_STUB && X86
+ default y
+ help
+ Some firmware disables execution of memory allocated in boot loader
+ and/or lower megabyte of physical address space, since it is allowed
+ by specification. That prevents Linux kernel from booting.
+
+ This option makes libstub either create temporary identity mapped
+ page tables with unset non-executable flag on x86_64 or just disable
+ paging altogether on i386 to overcome the issue.
+
+ If firmware does not restrict permissions on identity page tables,
+ temporary page table creation may be disabled with kernel command
+ line option "efi=notemppt".
+
endmenu

config EFI_EMBEDDED_FIRMWARE
--
2.33.1