diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-01-13 08:14:01 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-01-13 08:14:01 +0000 |
commit | b3eb2c1e8b4cf199aa4bf8188685c3059c420a60 (patch) | |
tree | d8eb7d4c8ba276a0f422af101f52ac54aa240781 /tools/libxc/xc_domain_save.c | |
parent | 9fececad98aa1259a9896edf7e7931822e3eef87 (diff) | |
download | xen-b3eb2c1e8b4cf199aa4bf8188685c3059c420a60.tar.gz xen-b3eb2c1e8b4cf199aa4bf8188685c3059c420a60.tar.bz2 xen-b3eb2c1e8b4cf199aa4bf8188685c3059c420a60.zip |
x86: add and use XEN_DOMCTL_getpageframeinfo3
To support wider than 28-bit MFNs, add XEN_DOMCTL_getpageframeinfo3
(with the type replacing the passed in MFN rather than getting or-ed
into it) to properly back xc_get_pfn_type_batch().
With xc_get_pfn_type_batch() only used internally to libxc, move its
prototype from xenctrl.h to xc_private.h.
This also fixes a couple of bugs in pre-existing code:
- the failure path for init_mem_info() leaked minfo->pfn_type,
- one error path of the XEN_DOMCTL_getpageframeinfo2 handler used
put_domain() where rcu_unlock_domain() was meant, and
- the XEN_DOMCTL_getpageframeinfo2 handler could call
xsm_getpageframeinfo() with an invalid struct page_info pointer.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'tools/libxc/xc_domain_save.c')
-rw-r--r-- | tools/libxc/xc_domain_save.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c index 87ec7dbbd6..cdaefb7a73 100644 --- a/tools/libxc/xc_domain_save.c +++ b/tools/libxc/xc_domain_save.c @@ -959,6 +959,12 @@ int xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters, /* Get the size of the P2M table */ dinfo->p2m_size = xc_memory_op(xc_handle, XENMEM_maximum_gpfn, &dom) + 1; + if ( dinfo->p2m_size > ~XEN_DOMCTL_PFINFO_LTAB_MASK ) + { + ERROR("Cannot save this big a guest"); + goto out; + } + /* Domain is still running at this point */ if ( live ) { @@ -1296,17 +1302,11 @@ int xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters, else { /* Get page types */ - for ( j = 0; j < batch; j++ ) - ((uint32_t *)pfn_type)[j] = pfn_type[j]; - if ( xc_get_pfn_type_batch(xc_handle, dom, batch, - (uint32_t *)pfn_type) ) + if ( xc_get_pfn_type_batch(xc_handle, dom, batch, pfn_type) ) { ERROR("get_pfn_type_batch failed"); goto out; } - for ( j = batch-1; j >= 0; j-- ) - pfn_type[j] = ((uint32_t *)pfn_type)[j] & - XEN_DOMCTL_PFINFO_LTAB_MASK; for ( j = 0; j < batch; j++ ) { |