[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Fix long-standing save/restore bug on x86-64.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 24efeacbca51e28778ac574db50dcb152fedc6de
# Parent  459e6131c07dc69eb77e05f65e655f949c4e1a47
Fix long-standing save/restore bug on x86-64. 

Signed-off-by: Steven Hand <steven@xxxxxxxxxxxxx>

diff -r 459e6131c07d -r 24efeacbca51 
linux-2.6-xen-sparse/drivers/xen/core/reboot.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c    Thu Apr  6 14:57:51 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c    Thu Apr  6 15:17:24 2006
@@ -85,6 +85,23 @@
 #define smp_resume()   ((void)0)
 #endif
 
+/* Ensure we run on the idle task page tables so that we will
+   switch page tables before running user space. This is needed
+   on architectures with separate kernel and user page tables
+   because the user page table pointer is not saved/restored. */
+static void switch_idle_mm(void)
+{
+       struct mm_struct *mm = current->active_mm;
+
+       if (mm == &init_mm)
+               return;
+
+       atomic_inc(&init_mm.mm_count);
+       switch_mm(mm, &init_mm, current);
+       current->active_mm = &init_mm;
+       mmdrop(mm);
+}
+
 static int __do_suspend(void *ignore)
 {
        int i, j, k, fpp, err;
@@ -163,6 +180,8 @@
        irq_resume();
 
        time_resume();
+
+       switch_idle_mm();
 
        __sti();
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.