On 08.08.23 00:16, Kevin Alarcon Negy wrote:
When building a domain, xc_domain_setmaxmem() is called with target_memkb 
(memory in domain config file).
If a config specifies maxmem > memory, any attempts to increase the domain 
memory size to its max,
outside of xl mem-set or xl mem-max, which already call xc_domain_setmaxmem() 
properly, will fail.

But this is how it should work, no?

With your change the guest could easily balloon itself up to maxmem without it
having been allowed to do so.

The maxmem config option is meant to tell the domain how much memory it should
be prepared to use some time in the future. It isn't meant to allow the domain
to use right now.


Juergen

Changed xc_domain_setmaxmem() call inside libxl__build_pre() to use max_memkb.

Signed-off-by: Kevin Alarcon Negy <[email protected]>
---
  tools/libs/light/libxl_dom.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
index 94fef37401..16aa255aad 100644
--- a/tools/libs/light/libxl_dom.c
+++ b/tools/libs/light/libxl_dom.c
@@ -355,7 +355,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
          return ERROR_FAIL;
      }
- if (xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb + size) < 0) {
+    if (xc_domain_setmaxmem(ctx->xch, domid, info->max_memkb + size) < 0) {
          LOGE(ERROR, "Couldn't set max memory");
          return ERROR_FAIL;
      }

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to