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

[Xen-changelog] [xen-unstable] x86, hvm: Don't ever call the shadow code to fix a page fault in an



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1229513782 0
# Node ID 22e3666ee483be177a94225d80ac8be0ae6bb6eb
# Parent  a76b4e00e1862035240ec6403a8f081be61b1e2b
x86, hvm: Don't ever call the shadow code to fix a page fault in an
external-mode guest if the fault came from Xen; it would be making
changes to the wrong pagetables, potentially causing a pagefault loop
in Xen.

Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
---
 xen/arch/x86/traps.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff -r a76b4e00e186 -r 22e3666ee483 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Tue Dec 16 13:14:25 2008 +0000
+++ b/xen/arch/x86/traps.c      Wed Dec 17 11:36:22 2008 +0000
@@ -1160,15 +1160,17 @@ static int fixup_page_fault(unsigned lon
     if ( in_irq() || !(regs->eflags & X86_EFLAGS_IF) )
         return 0;
 
+    /* Faults from external-mode guests are handled by shadow/hap */
+    if ( paging_mode_external(d) && guest_mode(regs) )
+    {
+        int ret = paging_fault(addr, regs);
+        if ( ret == EXCRET_fault_fixed )
+            trace_trap_two_addr(TRC_PV_PAGING_FIXUP, regs->eip, addr);
+        return ret;
+    }
+
     if ( unlikely(IN_HYPERVISOR_RANGE(addr)) )
     {
-        if ( paging_mode_external(d) && guest_mode(regs) )
-        {
-            int ret = paging_fault(addr, regs);
-            if ( ret == EXCRET_fault_fixed )
-                trace_trap_two_addr(TRC_PV_PAGING_FIXUP, regs->eip, addr);
-            return ret;
-        }
         if ( !(regs->error_code & PFEC_reserved_bit) &&
              (addr >= GDT_LDT_VIRT_START) && (addr < GDT_LDT_VIRT_END) )
             return handle_gdt_ldt_mapping_fault(
@@ -1185,7 +1187,9 @@ static int fixup_page_fault(unsigned lon
          ptwr_do_page_fault(v, addr, regs) )
         return EXCRET_fault_fixed;
 
-    if ( paging_mode_enabled(d) )
+    /* For non-external shadowed guests, we fix up both their own 
+     * pagefaults and Xen's, since they share the pagetables. */
+    if ( paging_mode_enabled(d) && !paging_mode_external(d) )
     {
         int ret = paging_fault(addr, regs);
         if ( ret == EXCRET_fault_fixed )

_______________________________________________
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®.