[lkml]   [2019]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 5.3 175/344] x86/mm/pti: Do not invoke PTI functions when PTI is disabled
From: Thomas Gleixner <>

[ Upstream commit 990784b57731192b7d90c8d4049e6318d81e887d ]

When PTI is disabled at boot time either because the CPU is not affected or
PTI has been disabled on the command line, the boot code still calls into
pti_finalize() which then unconditionally invokes:


pti_clone_kernel_text() was called unconditionally before the 32bit support
was added and 32bit added the call to pti_clone_entry_text().

The call has no side effects as cloning the page tables into the available
second one, which was allocated for PTI does not create damage. But it does
not make sense either and in case that this functionality would be extended
later this might actually lead to hard to diagnose issues.

Neither function should be called when PTI is runtime disabled. Make the
invocation conditional.

Signed-off-by: Thomas Gleixner <>
Reviewed-by: Dave Hansen <>
Acked-by: Ingo Molnar <>
Acked-by: Song Liu <>
Acked-by: Peter Zijlstra (Intel) <>
Signed-off-by: Sasha Levin <>
arch/x86/mm/pti.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
index b196524759ec5..ba22b50f4eca2 100644
--- a/arch/x86/mm/pti.c
+++ b/arch/x86/mm/pti.c
@@ -666,6 +666,8 @@ void __init pti_init(void)
void pti_finalize(void)
+ if (!boot_cpu_has(X86_FEATURE_PTI))
+ return;
* We need to clone everything (again) that maps parts of the
* kernel image.

 \ /
  Last update: 2019-10-03 19:01    [W:0.747 / U:2.576 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site