Skip to contentSkip to conversation

arm64: kconfig: Make STRICT_KERNEL_RWX visable.

PATCH New junan 1 participant 1 message Jan 15 arm64

lore
Share & tools
lore

junan

author
#0 lore raw

PATCH v2 1/1 arm64: kconfig: Make STRICT_KERNEL_RWX visable.

Make "STRICT_KERNEL_RWX" visable to menuconfig on arm64 platform.

Breakpoints can not be set when using kgdb/kdb if "STRICT_KERNEL_RWX" equals to "y", but it has a default value "y" and is not visable in menuconfig on arm64.

Link to kgdb/kdb doc: https://docs.kernel.org/process/debugging/kgdb.html

Changes in v2:
- Fix link error of "rodata_enabled" when allnoconfig is set
- link to v1: https://lore.kernel.org/linux-arm-kernel/[email protected]/

---
 arch/arm64/Kconfig  | 2 ++
 arch/arm64/mm/mmu.c | 4 ++++
 2 files changed, 6 insertions(+)
arch/arm64/Kconfig +2 -0
index 93173f0a09c7..cc3aaffa1e12 100644
@@ -52,6 +52,8 @@ config ARM64
 	select ARCH_STACKWALK
 	select ARCH_HAS_STRICT_KERNEL_RWX
 	select ARCH_HAS_STRICT_MODULE_RWX
+	select ARCH_OPTIONAL_KERNEL_RWX		if ARCH_HAS_STRICT_KERNEL_RWX
+	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_HAS_SYSCALL_WRAPPER
arch/arm64/mm/mmu.c +4 -0
index 8e1d80a7033e..4770204d9e22 100644
@@ -1314,7 +1314,11 @@ void __init kpti_install_ng_mappings(void)
 
 static pgprot_t __init kernel_exec_prot(void)
 {
+#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
 	return rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC;
+#else
+	return PAGE_KERNEL_EXEC;
+#endif
 }
 
 static int __init map_entry_trampoline(void)
Signature · 1 line
2.43.0