WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] x86: adjust reserved bit page fault handling

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] x86: adjust reserved bit page fault handling
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Fri, 01 Feb 2008 08:45:22 +0000
Delivery-date: Fri, 01 Feb 2008 00:45:14 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
One could even debate whether reserved bit faults are always fatal (and
should never be propagated to the guest)...

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: 2008-01-28/xen/arch/x86/traps.c
===================================================================
--- 2008-01-28.orig/xen/arch/x86/traps.c        2008-01-28 11:31:44.000000000 
+0100
+++ 2008-01-28/xen/arch/x86/traps.c     2008-01-30 11:47:39.000000000 +0100
@@ -823,6 +823,17 @@ asmlinkage void do_machine_check(struct 
     machine_check_vector(regs, regs->error_code);
 }
 
+static inline void reserved_bit_page_fault(int guest, unsigned long addr,
+                                           struct cpu_user_regs *regs)
+{
+    if ( guest )
+        gdprintk(XENLOG_ERR, "reserved bit in page table entry: ");
+    else
+        dprintk(XENLOG_ERR, "reserved bit in page table entry: ");
+    show_page_walk(addr);
+    show_execution_state(regs);
+}
+
 void propagate_page_fault(unsigned long addr, u16 error_code)
 {
     struct trap_info *ti;
@@ -852,6 +863,8 @@ void propagate_page_fault(unsigned long 
                v->domain->domain_id, v->vcpu_id, error_code);
         show_page_walk(addr);
     }
+    else if ( unlikely(error_code & PFEC_reserved_bit) )
+        reserved_bit_page_fault(1, addr, guest_cpu_user_regs());
 }
 
 static int handle_gdt_ldt_mapping_fault(
@@ -1034,8 +1047,10 @@ static int fixup_page_fault(unsigned lon
     struct vcpu   *v = current;
     struct domain *d = v->domain;
 
-    /* No fixups in interrupt context or when interrupts are disabled. */
-    if ( in_irq() || !(regs->eflags & X86_EFLAGS_IF) )
+    /* No fixups in interrupt context, when interrupts are disabled, or
+     * when a reserved bit was found to be set. */
+    if ( in_irq() || !(regs->eflags & X86_EFLAGS_IF) ||
+         (regs->error_code & PFEC_reserved_bit) )
         return 0;
 
     if ( unlikely(IN_HYPERVISOR_RANGE(addr)) )
@@ -1101,6 +1116,8 @@ asmlinkage void do_page_fault(struct cpu
         if ( likely((fixup = search_exception_table(regs->eip)) != 0) )
         {
             perfc_incr(copy_user_faults);
+            if ( unlikely(regs->error_code & PFEC_reserved_bit) )
+                reserved_bit_page_fault(0, addr, regs);
             regs->eip = fixup;
             return;
         }




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