[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] libxc: remove stale error check for domain size in xc_sr_save_x86_hvm.c



commit 26a896cde21c6d03de367190034fcc150b1bf2d8
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Tue Sep 26 14:02:56 2017 +0200
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Fri Oct 27 12:03:04 2017 +0100

    libxc: remove stale error check for domain size in xc_sr_save_x86_hvm.c
    
    Long ago domains to be saved were limited to 1TB size due to the
    migration stream v1 limitations which used a 32 bit value for the
    PFN and the frame type (4 bits) leaving only 28 bits for the PFN.
    
    Migration stream V2 uses a 64 bit value for this purpose, so there
    is no need to refuse saving (or migrating) domains larger than 1 TB.
    
    For 32 bit toolstacks there is still a size limit, as domains larger
    than about 1TB will lead to an exhausted virtual address space of the
    saving process. So keep the test for 32 bit, but don't base it on the
    page type macros. As a migration could lead to the situation where a
    32 bit toolstack would have to handle such a large domain (in case the
    sending side is 64 bit) the same test should be added for restoring a
    domain.
    
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Release-acked-by: Julien Grall <julien.grall@xxxxxxxxxx>
---
 tools/libxc/xc_sr_restore_x86_hvm.c | 9 +++++++++
 tools/libxc/xc_sr_save_x86_hvm.c    | 5 ++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/tools/libxc/xc_sr_restore_x86_hvm.c 
b/tools/libxc/xc_sr_restore_x86_hvm.c
index 1dca853..227c485 100644
--- a/tools/libxc/xc_sr_restore_x86_hvm.c
+++ b/tools/libxc/xc_sr_restore_x86_hvm.c
@@ -148,6 +148,15 @@ static int x86_hvm_setup(struct xc_sr_context *ctx)
               ctx->restore.guest_page_size);
         return -1;
     }
+#ifdef __i386__
+    /* Very large domains (> 1TB) will exhaust virtual address space. */
+    if ( ctx->restore.p2m_size > 0x0fffffff )
+    {
+        errno = E2BIG;
+        PERROR("Cannot restore this big a guest");
+        return -1;
+    }
+#endif
 
     return 0;
 }
diff --git a/tools/libxc/xc_sr_save_x86_hvm.c b/tools/libxc/xc_sr_save_x86_hvm.c
index e17bb59..97a8c49 100644
--- a/tools/libxc/xc_sr_save_x86_hvm.c
+++ b/tools/libxc/xc_sr_save_x86_hvm.c
@@ -148,12 +148,15 @@ static int x86_hvm_setup(struct xc_sr_context *ctx)
         PERROR("Unable to obtain the guest p2m size");
         return -1;
     }
-    if ( nr_pfns > ~XEN_DOMCTL_PFINFO_LTAB_MASK )
+#ifdef __i386__
+    /* Very large domains (> 1TB) will exhaust virtual address space. */
+    if ( nr_pfns > 0x0fffffff )
     {
         errno = E2BIG;
         PERROR("Cannot save this big a guest");
         return -1;
     }
+#endif
 
     ctx->save.p2m_size = nr_pfns;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.