[HVM] Allow a dom to have nonsense m2p entries when building the p2m
authorTim Deegan <Tim.Deegan@xensource.com>
Thu, 11 Jan 2007 10:08:14 +0000 (10:08 +0000)
committerTim Deegan <Tim.Deegan@xensource.com>
Thu, 11 Jan 2007 10:08:14 +0000 (10:08 +0000)
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
xen/arch/x86/mm/shadow/common.c

index e1a2e4444708a212a051c617f343f9dedd86f543..8cee158842c1bd0bfa20a1656258d39a5c419b66 100644 (file)
@@ -1303,6 +1303,9 @@ shadow_alloc_p2m_table(struct domain *d)
     if ( !shadow_set_p2m_entry(d, gfn, mfn) )
         goto error;
 
+    /* Build a p2m map that matches the m2p entries for this domain's
+     * allocated pages.  Skip any pages that have an explicitly invalid
+     * or obviously bogus m2p entry. */
     for ( entry = d->page_list.next;
           entry != &d->page_list;
           entry = entry->next )
@@ -1318,6 +1321,8 @@ shadow_alloc_p2m_table(struct domain *d)
             (gfn != 0x55555555L)
 #endif
              && gfn != INVALID_M2P_ENTRY
+             && (gfn < 
+                 (RO_MPT_VIRT_END - RO_MPT_VIRT_START) / sizeof (l1_pgentry_t))
              && !shadow_set_p2m_entry(d, gfn, mfn) )
             goto error;
     }