Skip to content

Commit 979c7c0

Browse files
Zhenzhong Duangregkh
authored andcommitted
x86/mm/32: Initialize the CR4 shadow before __flush_tlb_all()
[ Upstream commit 4fb5f58 ] 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 <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Link: http://lkml.kernel.org/r/b07b6ae9-4b57-4b40-b9bc-50c2c67f1d91@default Signed-off-by: Ingo Molnar <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent bf6c973 commit 979c7c0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/x86/kernel/smpboot.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ static void notrace start_secondary(void *unused)
223223
#ifdef CONFIG_X86_32
224224
/* switch away from the initial page table */
225225
load_cr3(swapper_pg_dir);
226+
/*
227+
* Initialize the CR4 shadow before doing anything that could
228+
* try to read it.
229+
*/
230+
cr4_init_shadow();
226231
__flush_tlb_all();
227232
#endif
228233
load_current_idt();

0 commit comments

Comments
 (0)