xen/pvshim: set max_pages to the value of tot_pages
authorRoger Pau Monne <roger.pau@citrix.com>
Thu, 11 Jan 2018 11:41:20 +0000 (11:41 +0000)
committerWei Liu <wei.liu2@citrix.com>
Tue, 16 Jan 2018 18:34:05 +0000 (18:34 +0000)
So that the guest is not able to deplete the memory pool of the shim
itself by trying to balloon up.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/pv/shim.c

index 6dc1ee45d745c19a9982b9d12a98497030b49ebb..e3e101a5b155d974b241077921281c6615a9ab72 100644 (file)
@@ -204,6 +204,12 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgentry_t *l4start,
                                (hypercall_fn_t *)pv_shim_grant_table_op,
                                (hypercall_fn_t *)pv_shim_grant_table_op);
     guest = d;
+
+    /*
+     * Set the max pages to the current number of pages to prevent the
+     * guest from depleting the shim memory pool.
+     */
+    d->max_pages = d->tot_pages;
 }
 
 static void write_start_info(struct domain *d)