[PATCH] x86_64: Reload init_mm on leaving lazy mm

Linux Kernel Mailing List <[email protected]> Thu, 07 Apr 2005 12:22:58 +0000
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1503, 2005/04/07 09:22:58-03:00, [email protected]

	[PATCH] x86_64: Reload init_mm on leaving lazy mm
	
	Reload init_mm on leaving lazy mm
	
	This avoids some problems with CPUs seeing already freed pagetables
	in CR3.
	
	Index: linux/arch/x86_64/kernel/smp.c
	===================================================================



 smp.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


diff -Nru a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c
--- a/arch/x86_64/kernel/smp.c	2005-04-07 11:04:19 -07:00
+++ b/arch/x86_64/kernel/smp.c	2005-04-07 11:04:19 -07:00
@@ -228,7 +228,8 @@
 		BUG();
 	clear_bit(cpu, &cpu_tlbstate[cpu].active_mm->cpu_vm_mask);
 	/* flush TLB before it goes away. this stops speculative prefetches */
-	__flush_tlb(); 
+	*read_pda(level4_pgt) = __pa(init_mm.pgd) | _PAGE_TABLE;
+	__flush_tlb();
 }
 
 /*