Skip to content

Commit 4fb5f58

Browse files
Zhenzhong DuanIngo Molnar
authored andcommitted
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 <[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]>
1 parent 021c917 commit 4fb5f58

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
@@ -221,6 +221,11 @@ static void notrace start_secondary(void *unused)
221221
#ifdef CONFIG_X86_32
222222
/* switch away from the initial page table */
223223
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();
224229
__flush_tlb_all();
225230
#endif
226231
load_current_idt();

0 commit comments

Comments
 (0)