debuggers.hg

changeset 19998:62b7fc245d1f

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@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jul 20 10:10:15 2009 +0100 (2009-07-20)
parents 69cd50c86a79
children e34975d7d8f1
files xen/arch/x86/x86_32/traps.c xen/arch/x86/x86_64/mm.c xen/arch/x86/x86_64/traps.c
line diff
     1.1 --- a/xen/arch/x86/x86_32/traps.c	Mon Jul 20 10:09:00 2009 +0100
     1.2 +++ b/xen/arch/x86/x86_32/traps.c	Mon Jul 20 10:10:15 2009 +0100
     1.3 @@ -164,7 +164,8 @@ void show_page_walk(unsigned long addr)
     1.4      printk(" L3[0x%03lx] = %"PRIpte" %08lx\n",
     1.5             l3_table_offset(addr), l3e_get_intpte(l3e), pfn);
     1.6      unmap_domain_page(l3t);
     1.7 -    if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) )
     1.8 +    if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) ||
     1.9 +         !mfn_valid(mfn) )
    1.10          return;
    1.11  
    1.12      l2t = map_domain_page(mfn);
    1.13 @@ -176,7 +177,8 @@ void show_page_walk(unsigned long addr)
    1.14             (l2e_get_flags(l2e) & _PAGE_PSE) ? "(PSE)" : "");
    1.15      unmap_domain_page(l2t);
    1.16      if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) ||
    1.17 -         (l2e_get_flags(l2e) & _PAGE_PSE) )
    1.18 +         (l2e_get_flags(l2e) & _PAGE_PSE) ||
    1.19 +         !mfn_valid(mfn) )
    1.20          return;
    1.21  
    1.22      l1t = map_domain_page(mfn);
     2.1 --- a/xen/arch/x86/x86_64/mm.c	Mon Jul 20 10:09:00 2009 +0100
     2.2 +++ b/xen/arch/x86/x86_64/mm.c	Mon Jul 20 10:10:15 2009 +0100
     2.3 @@ -123,6 +123,7 @@ void *do_page_walk(struct vcpu *v, unsig
     2.4      l3e = l3t[l3_table_offset(addr)];
     2.5      mfn = l3e_get_pfn(l3e);
     2.6      if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) || !mfn_valid(mfn) )
     2.7 +        return NULL;
     2.8      if ( (l3e_get_flags(l3e) & _PAGE_PSE) )
     2.9          return mfn_to_virt(mfn) + (addr & ((1UL << L3_PAGETABLE_SHIFT) - 1));
    2.10  
     3.1 --- a/xen/arch/x86/x86_64/traps.c	Mon Jul 20 10:09:00 2009 +0100
     3.2 +++ b/xen/arch/x86/x86_64/traps.c	Mon Jul 20 10:10:15 2009 +0100
     3.3 @@ -179,7 +179,8 @@ void show_page_walk(unsigned long addr)
     3.4      pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
     3.5      printk(" L4[0x%03lx] = %"PRIpte" %016lx\n",
     3.6             l4_table_offset(addr), l4e_get_intpte(l4e), pfn);
     3.7 -    if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) )
     3.8 +    if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) ||
     3.9 +         !mfn_valid(mfn) )
    3.10          return;
    3.11  
    3.12      l3t = mfn_to_virt(mfn);
    3.13 @@ -190,7 +191,8 @@ void show_page_walk(unsigned long addr)
    3.14             l3_table_offset(addr), l3e_get_intpte(l3e), pfn,
    3.15             (l3e_get_flags(l3e) & _PAGE_PSE) ? " (PSE)" : "");
    3.16      if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) ||
    3.17 -         (l3e_get_flags(l3e) & _PAGE_PSE) )
    3.18 +         (l3e_get_flags(l3e) & _PAGE_PSE) ||
    3.19 +         !mfn_valid(mfn) )
    3.20          return;
    3.21  
    3.22      l2t = mfn_to_virt(mfn);
    3.23 @@ -201,7 +203,8 @@ void show_page_walk(unsigned long addr)
    3.24             l2_table_offset(addr), l2e_get_intpte(l2e), pfn,
    3.25             (l2e_get_flags(l2e) & _PAGE_PSE) ? "(PSE)" : "");
    3.26      if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) ||
    3.27 -         (l2e_get_flags(l2e) & _PAGE_PSE) )
    3.28 +         (l2e_get_flags(l2e) & _PAGE_PSE) ||
    3.29 +         !mfn_valid(mfn) )
    3.30          return;
    3.31  
    3.32      l1t = mfn_to_virt(mfn);