ia64/xen-unstable

changeset 18937:22e3666ee483

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@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Dec 17 11:36:22 2008 +0000 (2008-12-17)
parents a76b4e00e186
children b33b745cd5ec
files xen/arch/x86/traps.c
line diff
     1.1 --- a/xen/arch/x86/traps.c	Tue Dec 16 13:14:25 2008 +0000
     1.2 +++ b/xen/arch/x86/traps.c	Wed Dec 17 11:36:22 2008 +0000
     1.3 @@ -1160,15 +1160,17 @@ static int fixup_page_fault(unsigned lon
     1.4      if ( in_irq() || !(regs->eflags & X86_EFLAGS_IF) )
     1.5          return 0;
     1.6  
     1.7 +    /* Faults from external-mode guests are handled by shadow/hap */
     1.8 +    if ( paging_mode_external(d) && guest_mode(regs) )
     1.9 +    {
    1.10 +        int ret = paging_fault(addr, regs);
    1.11 +        if ( ret == EXCRET_fault_fixed )
    1.12 +            trace_trap_two_addr(TRC_PV_PAGING_FIXUP, regs->eip, addr);
    1.13 +        return ret;
    1.14 +    }
    1.15 +
    1.16      if ( unlikely(IN_HYPERVISOR_RANGE(addr)) )
    1.17      {
    1.18 -        if ( paging_mode_external(d) && guest_mode(regs) )
    1.19 -        {
    1.20 -            int ret = paging_fault(addr, regs);
    1.21 -            if ( ret == EXCRET_fault_fixed )
    1.22 -                trace_trap_two_addr(TRC_PV_PAGING_FIXUP, regs->eip, addr);
    1.23 -            return ret;
    1.24 -        }
    1.25          if ( !(regs->error_code & PFEC_reserved_bit) &&
    1.26               (addr >= GDT_LDT_VIRT_START) && (addr < GDT_LDT_VIRT_END) )
    1.27              return handle_gdt_ldt_mapping_fault(
    1.28 @@ -1185,7 +1187,9 @@ static int fixup_page_fault(unsigned lon
    1.29           ptwr_do_page_fault(v, addr, regs) )
    1.30          return EXCRET_fault_fixed;
    1.31  
    1.32 -    if ( paging_mode_enabled(d) )
    1.33 +    /* For non-external shadowed guests, we fix up both their own 
    1.34 +     * pagefaults and Xen's, since they share the pagetables. */
    1.35 +    if ( paging_mode_enabled(d) && !paging_mode_external(d) )
    1.36      {
    1.37          int ret = paging_fault(addr, regs);
    1.38          if ( ret == EXCRET_fault_fixed )