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

[Xen-changelog] [xen-unstable] x86: make show_page_walk() more robust



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1248081015 -3600
# Node ID 62b7fc245d1f110dd04aad6523dedcd2c84178e4
# Parent  69cd50c86a798d3717476fb94065da33320cfaa9
x86: make show_page_walk() more robust

Also add in a missing line in x86-64's do_page_walk().

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/x86_32/traps.c |    6 ++++--
 xen/arch/x86/x86_64/mm.c    |    1 +
 xen/arch/x86/x86_64/traps.c |    9 ++++++---
 3 files changed, 11 insertions(+), 5 deletions(-)

diff -r 69cd50c86a79 -r 62b7fc245d1f xen/arch/x86/x86_32/traps.c
--- a/xen/arch/x86/x86_32/traps.c       Mon Jul 20 10:09:00 2009 +0100
+++ b/xen/arch/x86/x86_32/traps.c       Mon Jul 20 10:10:15 2009 +0100
@@ -164,7 +164,8 @@ void show_page_walk(unsigned long addr)
     printk(" L3[0x%03lx] = %"PRIpte" %08lx\n",
            l3_table_offset(addr), l3e_get_intpte(l3e), pfn);
     unmap_domain_page(l3t);
-    if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) )
+    if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) ||
+         !mfn_valid(mfn) )
         return;
 
     l2t = map_domain_page(mfn);
@@ -176,7 +177,8 @@ void show_page_walk(unsigned long addr)
            (l2e_get_flags(l2e) & _PAGE_PSE) ? "(PSE)" : "");
     unmap_domain_page(l2t);
     if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) ||
-         (l2e_get_flags(l2e) & _PAGE_PSE) )
+         (l2e_get_flags(l2e) & _PAGE_PSE) ||
+         !mfn_valid(mfn) )
         return;
 
     l1t = map_domain_page(mfn);
diff -r 69cd50c86a79 -r 62b7fc245d1f xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c  Mon Jul 20 10:09:00 2009 +0100
+++ b/xen/arch/x86/x86_64/mm.c  Mon Jul 20 10:10:15 2009 +0100
@@ -123,6 +123,7 @@ void *do_page_walk(struct vcpu *v, unsig
     l3e = l3t[l3_table_offset(addr)];
     mfn = l3e_get_pfn(l3e);
     if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) || !mfn_valid(mfn) )
+        return NULL;
     if ( (l3e_get_flags(l3e) & _PAGE_PSE) )
         return mfn_to_virt(mfn) + (addr & ((1UL << L3_PAGETABLE_SHIFT) - 1));
 
diff -r 69cd50c86a79 -r 62b7fc245d1f xen/arch/x86/x86_64/traps.c
--- a/xen/arch/x86/x86_64/traps.c       Mon Jul 20 10:09:00 2009 +0100
+++ b/xen/arch/x86/x86_64/traps.c       Mon Jul 20 10:10:15 2009 +0100
@@ -179,7 +179,8 @@ void show_page_walk(unsigned long addr)
     pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
     printk(" L4[0x%03lx] = %"PRIpte" %016lx\n",
            l4_table_offset(addr), l4e_get_intpte(l4e), pfn);
-    if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) )
+    if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) ||
+         !mfn_valid(mfn) )
         return;
 
     l3t = mfn_to_virt(mfn);
@@ -190,7 +191,8 @@ void show_page_walk(unsigned long addr)
            l3_table_offset(addr), l3e_get_intpte(l3e), pfn,
            (l3e_get_flags(l3e) & _PAGE_PSE) ? " (PSE)" : "");
     if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) ||
-         (l3e_get_flags(l3e) & _PAGE_PSE) )
+         (l3e_get_flags(l3e) & _PAGE_PSE) ||
+         !mfn_valid(mfn) )
         return;
 
     l2t = mfn_to_virt(mfn);
@@ -201,7 +203,8 @@ void show_page_walk(unsigned long addr)
            l2_table_offset(addr), l2e_get_intpte(l2e), pfn,
            (l2e_get_flags(l2e) & _PAGE_PSE) ? "(PSE)" : "");
     if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) ||
-         (l2e_get_flags(l2e) & _PAGE_PSE) )
+         (l2e_get_flags(l2e) & _PAGE_PSE) ||
+         !mfn_valid(mfn) )
         return;
 
     l1t = mfn_to_virt(mfn);

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