]> git.baikalelectronics.ru Git - kernel.git/commit
x86/mm/pti: Do not invoke PTI functions when PTI is disabled
authorThomas Gleixner <tglx@linutronix.de>
Wed, 28 Aug 2019 14:24:47 +0000 (16:24 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 29 Aug 2019 18:52:53 +0000 (20:52 +0200)
commit722cffbdd32f6f17ee6053913e2b910b70dec5fb
tree3ded77bec37e7ec308ef0e12d1b68b087bf127c8
parent9eb2bce55fd101f9c90905920231420a0d84ccea
x86/mm/pti: Do not invoke PTI functions when PTI is disabled

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_entry_text()
     pti_clone_kernel_text()

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 <tglx@linutronix.de>
Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20190828143124.063353972@linutronix.de
arch/x86/mm/pti.c