xc_save: use correct size when unmapping live p2m.
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 29 Sep 2008 10:00:29 +0000 (11:00 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 29 Sep 2008 10:00:29 +0000 (11:00 +0100)
Otherwise we unmap a larger region than was mapped when saving 32 bit
guest from 64 bit tools, leading to badness.

The equivalent change was made to the restore code in
18329:ca7dd77d5365

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxc/xc_domain_save.c

index c1ced27d98f1b19abe50bd45fb1c1ce1c931c3ad..a91041498841312a5e7ccc2d0c9b8af6b5fd14b5 100644 (file)
@@ -727,7 +727,7 @@ static xen_pfn_t *map_and_save_p2m_table(int xc_handle,
  out:
     
     if ( !success && p2m )
-        munmap(p2m, ROUNDUP(p2m_size * sizeof(xen_pfn_t), PAGE_SHIFT));
+        munmap(p2m, P2M_FLL_ENTRIES * PAGE_SIZE);
 
     if ( live_p2m_frame_list_list )
         munmap(live_p2m_frame_list_list, PAGE_SIZE);
@@ -1608,7 +1608,7 @@ int xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
         munmap(live_shinfo, PAGE_SIZE);
 
     if ( live_p2m )
-        munmap(live_p2m, ROUNDUP(p2m_size * sizeof(xen_pfn_t), PAGE_SHIFT));
+        munmap(live_p2m, P2M_FLL_ENTRIES * PAGE_SIZE);
 
     if ( live_m2p )
         munmap(live_m2p, M2P_SIZE(max_mfn));