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-changelog

[Xen-changelog] [xen-3.2-testing] Fix restore crash with certain guest m

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.2-testing] Fix restore crash with certain guest memory sizes
From: "Xen patchbot-3.2-testing" <patchbot-3.2-testing@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 14 Aug 2008 10:50:23 -0700
Delivery-date: Thu, 14 Aug 2008 11:34:36 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1218705690 -3600
# Node ID 35812b94d74a9c480c177578a383eed572a21702
# Parent  2bba3c51863b6af1f03f13135207d4fbeea55032
Fix restore crash with certain guest memory sizes

This fixes a crash when restoring guests with certain memory sizes (eg
223MB).  The ROUNDUP in the call to memcpy, was the main offender, but
I didn't care for the inplace resizing of the p2m entries either.

Signed-off-by: Bruce Rogers <brogers@xxxxxxxxxx>
xen-unstable changeset:   18329:ca7dd77d53652aa55be27746540ec50cb9608ec4
xen-unstable date:        Thu Aug 14 10:18:08 2008 +0100
---
 tools/libxc/xc_domain_restore.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff -r 2bba3c51863b -r 35812b94d74a tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c   Wed Aug 13 10:02:07 2008 +0100
+++ b/tools/libxc/xc_domain_restore.c   Thu Aug 14 10:21:30 2008 +0100
@@ -372,7 +372,7 @@ int xc_domain_restore(int xc_handle, int
     }
 
     /* We want zeroed memory so use calloc rather than malloc. */
-    p2m        = calloc(p2m_size, MAX(guest_width, sizeof (xen_pfn_t))); 
+    p2m        = calloc(p2m_size, sizeof(xen_pfn_t));
     pfn_type   = calloc(p2m_size, sizeof(unsigned long));
 
     region_mfn = xg_memalign(PAGE_SIZE, ROUNDUP(
@@ -1162,16 +1162,16 @@ int xc_domain_restore(int xc_handle, int
     }
 
     /* If the domain we're restoring has a different word size to ours,
-     * we need to repack the p2m appropriately */
+     * we need to adjust the live_p2m assignment appropriately */
     if ( guest_width > sizeof (xen_pfn_t) )
         for ( i = p2m_size - 1; i >= 0; i-- )
-            ((uint64_t *)p2m)[i] = p2m[i];
+            ((uint64_t *)live_p2m)[i] = p2m[i];
     else if ( guest_width < sizeof (xen_pfn_t) )
         for ( i = 0; i < p2m_size; i++ )   
-            ((uint32_t *)p2m)[i] = p2m[i];
-
-    memcpy(live_p2m, p2m, ROUNDUP(p2m_size * guest_width, PAGE_SHIFT));
-    munmap(live_p2m, ROUNDUP(p2m_size * guest_width, PAGE_SHIFT));
+            ((uint32_t *)live_p2m)[i] = p2m[i];
+    else
+        memcpy(live_p2m, p2m, p2m_size * sizeof(xen_pfn_t));
+    munmap(live_p2m, P2M_FL_ENTRIES * PAGE_SIZE);
 
     DPRINTF("Domain ready to be built.\n");
     rc = 0;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.2-testing] Fix restore crash with certain guest memory sizes, Xen patchbot-3.2-testing <=