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

Re: [PATCH] Xenctrl.domain_setmaxmem: fix 32-bit truncation bug


  • To: Edwin Torok <edwin.torok@xxxxxxxxxx>
  • From: Christian Lindig <christian.lindig@xxxxxxxxxx>
  • Date: Thu, 5 Feb 2026 14:00:51 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MjYYIh7kcfj4y0kz4QRPgWdm7DZlp413o/MTa1EZDzY=; b=oZgBT4W0F+szTq3pY1hnFdSFZteZVcNdRxTggexilSpt7/UEEK/s4gkuYxeHQeDI1RPaUU+eeEPEhv8lGTJSR+TeNe0F74g35tNys7cDBUR2i9FwgEiADo+/XLQNGIXazUBWfiiPJXkY9VAUL4HcODXD3Qwmt+GK/qAHXjv884NTJnxV1ipF6bKvDNPUrpp6CLOrxPq/ICth+B2NO0IXRu34Zja0RkcQy0h07tT6EsTNB1Ts4RpmGorNt5WPKJvItHOJqrPF7+h+xDDRPXJicVEJPobzc44ZUVx9rFEeMOtPZTcVm6XGf5hsvoPcgmKPiNMjZ5/TS05NOKxgWw38RA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rD4evPf3y9NFqvpe7fk6/Xn9Epw8oalgH70R5ORAG+QxuFfO8xFhfxx7YUkAIw9HWOyOLfBuEWLU2wGPZlK3YxCftbShut7Mdg6KYydiGUKY1iDplfsMIYTEJm/ykO1rTCU4oSUqHM9tmnaTbnLD+Z4Kbbr2LXNz+UgF8/AutN9iPcwufFXE5W3Z1YFQK+BcAI9EP059Y6YGYiWsZbvCDR6Iq3Zj4smiTHLrDd+xgUmc//0012KUjtk/3pWyTVN7ZuiTOeei7SUjdFDvZyEa2DEqpW3bAx9KvAMYzTN1jurTUG1pNNLDmGZ3gNW2GYeqsS+QUyrMSiQzsd7dq1AIEQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, David Scott <dave@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Thu, 05 Feb 2026 14:01:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHclqdHSMQLCJJwBEO6hgFHUkkYV7V0IlGA
  • Thread-topic: [PATCH] Xenctrl.domain_setmaxmem: fix 32-bit truncation bug


> On 5 Feb 2026, at 13:56, Edwin Török <edwin.torok@xxxxxxxxxx> wrote:
> 
> Observed when attempting to boot a >4TiB VM:
> 
> After a call to domain_setmaxmem with 6370254848 (KiB),
> the domain's maxmem got set to 2075287552,
> which is exactly 2^32 smaller.
> 
> xc_domain_setmaxmem takes an uint64_t as a parameter,
> and the OCaml value is 64-bit already, so fix the C variable
> to match the type and avoid the truncation.
> 
> Signed-off-by: Edwin Török <edwin.torok@xxxxxxxxxx>
> ---
> tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c 
> b/tools/ocaml/libs/xc/xenctrl_stubs.c
> index ac2a7537d6..c55f73b265 100644
> --- a/tools/ocaml/libs/xc/xenctrl_stubs.c
> +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
> @@ -947,7 +947,7 @@ CAMLprim value stub_xc_domain_setmaxmem(value xch_val, 
> value domid,
> int retval;
> 
> uint32_t c_domid = Int_val(domid);
> - unsigned int c_max_memkb = Int64_val(max_memkb);
> + uint64_t c_max_memkb = Int64_val(max_memkb);
> caml_enter_blocking_section();
> retval = xc_domain_setmaxmem(xch, c_domid, c_max_memkb);
> caml_leave_blocking_section();
> -- 
> 2.47.3
> 

Acked-by: Christian Lindig <christian.lindig@xxxxxxxxx>


 


Rackspace

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