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] Fix guest_physmap_add_entry sanity checking logic

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Fix guest_physmap_add_entry sanity checking logic
From: "George Dunlap" <George.Dunlap@xxxxxxxxxxxxx>
Date: Tue, 21 Oct 2008 13:03:05 +0100
Delivery-date: Tue, 21 Oct 2008 05:03:30 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition:x-google-sender-auth; bh=RKdNbKsYwdNzI5PNc7AlVvMemyHs7ThgKmAxT2Jt6io=; b=WCO2KSQkcA6jqeAWtkpwX+UOZDWlP3hbiSLAR1FKYdafdO+C4nNTKgq5vboqy3G5mK YTU71GsSYzy/Nl8Dy9Vs/tBX+TQAR10yrEbmQPlmpdt9U+oG0lWT6pVT4Oq6rTtZmQUe iiCznZ3SE9J5MOlKO4AECFmsWeIxxg0q8MedY=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition:x-google-sender-auth; b=GlYtbGNsugxiPvNb2Spe4YT0lJbaIkoZgFp/F5k+kWj/9h7yTbaPBykSpSFdtcuQA2 BAhyZrTJYEQiqrTxGCJ8DSS5WbU61oBH7BCLt/t4wT4LpS1KlL8PVeNn4saiVVhc9aIy YhU+NEPah0azYE1azomR5+yYgOayhcMRO1gAs=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Fix the logic of the p->m and m->p mapping sanity checks and fixup in
guest_physmap_add_entry().

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

diff -r 3b99705155c1 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c     Tue Oct 21 11:44:39 2008 +0100
+++ b/xen/arch/x86/mm/p2m.c     Tue Oct 21 13:00:31 2008 +0100
@@ -956,18 +956,18 @@ guest_physmap_add_entry(struct domain *d
     /* First, remove m->p mappings for existing p->m mappings */
     for ( i = 0; i < (1UL << page_order); i++ )
     {
-        omfn = gfn_to_mfn(d, gfn, &ot);
+        omfn = gfn_to_mfn(d, gfn + i, &ot);
         if ( p2m_is_ram(ot) )
         {
             ASSERT(mfn_valid(omfn));
-            set_gpfn_from_mfn(mfn_x(omfn)+i, INVALID_M2P_ENTRY);
+            set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);
         }
     }

     /* Then, look for m->p mappings for this range and deal with them */
     for ( i = 0; i < (1UL << page_order); i++ )
     {
-        ogfn = mfn_to_gfn(d, _mfn(mfn));
+        ogfn = mfn_to_gfn(d, _mfn(mfn+i));
         if (
 #ifdef __x86_64__
             (ogfn != 0x5555555555555555L)
@@ -975,20 +975,20 @@ guest_physmap_add_entry(struct domain *d
             (ogfn != 0x55555555L)
 #endif
             && (ogfn != INVALID_M2P_ENTRY)
-            && (ogfn != gfn) )
+            && (ogfn != gfn + i) )
         {
             /* This machine frame is already mapped at another physical
              * address */
             P2M_DEBUG("aliased! mfn=%#lx, old gfn=%#lx, new gfn=%#lx\n",
-                      mfn, ogfn, gfn);
+                      mfn + i, ogfn, gfn + i);
             omfn = gfn_to_mfn(d, ogfn, &ot);
             if ( p2m_is_ram(ot) )
             {
                 ASSERT(mfn_valid(omfn));
                 P2M_DEBUG("old gfn=%#lx -> mfn %#lx\n",
                           ogfn , mfn_x(omfn));
-                if ( mfn_x(omfn) == mfn )
-                    p2m_remove_page(d, ogfn, mfn, 0);
+                if ( mfn_x(omfn) == (mfn + i) )
+                    p2m_remove_page(d, ogfn, mfn + i, 0);
             }
         }
     }

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Fix guest_physmap_add_entry sanity checking logic, George Dunlap <=