Thread (7 messages) 7 messages, 2 authors, 2019-11-06

Re: [PATCH v6 4/4] arm64: Use a variable to store non-global mappings decision

From: Catalin Marinas <catalin.marinas@arm.com>
Date: 2019-11-06 10:24:35

On Tue, Nov 05, 2019 at 09:48:54PM +0000, Mark Brown wrote:
quoted hunk ↗ jump to hunk
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 60c929f3683b..8462a358a1dc 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -679,6 +679,13 @@ void __init paging_init(void)
 	cpu_replace_ttbr1(lm_alias(swapper_pg_dir));
 	init_mm.pgd = swapper_pg_dir;
 
+        /*
+         * If know now we are going to need KPTI then use non-global
+         * mappings from the start, avoiding the cost of rewriting
+         * everything later.
+         */
+        arm64_use_ng_mappings = kaslr_requires_kpti();
This really needs to be done before map_kernel() and map_mem() in
paging_init(). Tested this series and most of the linear map does not
have the nG bit when it should (/sys/kernel/debug/kernel_page_tables).

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help