public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2] arm64: kconfig: Make STRICT_KERNEL_RWX visable.
@ 2026-01-15  2:34 junan
  0 siblings, 0 replies; only message in thread
From: junan @ 2026-01-15  2:34 UTC (permalink / raw)
  To: catalin.marinas, will
  Cc: linux-arm-kernel, linux-kernel, oe-kbuild-all, junan76,
	kernel test robot

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/20260114013859.498148-2-junan76@163.com/

Signed-off-by: junan <junan76@163.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202601141630.sCPCgSYw-lkp@intel.com/
---
 arch/arm64/Kconfig  | 2 ++
 arch/arm64/mm/mmu.c | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 93173f0a09c7..cc3aaffa1e12 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -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
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 8e1d80a7033e..4770204d9e22 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -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)
-- 
2.43.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-01-15  2:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-15  2:34 [PATCH v2] arm64: kconfig: Make STRICT_KERNEL_RWX visable junan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox