aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhenzhong Duan <zhenzhong.duan@oracle.com>2018-07-03 02:49:54 -0400
committerIngo Molnar <mingo@kernel.org>2018-07-03 03:26:10 -0400
commit4fb5f58e8d191f7c81637ad81284e4848afb4244 (patch)
treef2b0d0f92b021ee79e4ec4cf44c4c2697958096b
parent021c91791a5e7e85c567452f1be3e4c2c6cb6063 (diff)
x86/mm/32: Initialize the CR4 shadow before __flush_tlb_all()
On 32-bit kernels, __flush_tlb_all() may have read the CR4 shadow before the initialization of CR4 shadow in cpu_init(). Fix it by adding an explicit cr4_init_shadow() call into start_secondary() which is the first function called on non-boot SMP CPUs - ahead of the __flush_tlb_all() call. ( This is somewhat of a layering violation, but start_secondary() does CR4 bootstrap in the PCID case anyway. ) Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Link: http://lkml.kernel.org/r/b07b6ae9-4b57-4b40-b9bc-50c2c67f1d91@default Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/kernel/smpboot.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index c2f7d1d2a5c3..db9656e13ea0 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -221,6 +221,11 @@ static void notrace start_secondary(void *unused)
221#ifdef CONFIG_X86_32 221#ifdef CONFIG_X86_32
222 /* switch away from the initial page table */ 222 /* switch away from the initial page table */
223 load_cr3(swapper_pg_dir); 223 load_cr3(swapper_pg_dir);
224 /*
225 * Initialize the CR4 shadow before doing anything that could
226 * try to read it.
227 */
228 cr4_init_shadow();
224 __flush_tlb_all(); 229 __flush_tlb_all();
225#endif 230#endif
226 load_current_idt(); 231 load_current_idt();