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

Re: [Xen-devel] [PATCH] domctl: don't truncate XEN_DOMCTL_max_mem requests



On 22/04/15 12:56, Jan Beulich wrote:
Instead saturate the value if the input can't be represented in the
respective struct domain field.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Do I take it you have a 16TB guest to hand?


--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -944,7 +944,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
 
     case XEN_DOMCTL_max_mem:
     {
-        unsigned long new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT - 10);
+        uint64_t new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT - 10);
 
         spin_lock(&d->page_alloc_lock);
         /*
@@ -952,7 +952,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
          * that the domain will now be allowed to "ratchet" down to new_max. In
          * the meantime, while tot > max, all new allocations are disallowed.
          */
-        d->max_pages = new_max;
+        d->max_pages = min(new_max, (uint64_t)(typeof(d->max_pages))-1);
         spin_unlock(&d->page_alloc_lock);
         break;
     }





_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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