]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
libxl: fix assertion failure in stub domain creation
authorPaul Durrant <pdurrant@amazon.com>
Wed, 5 Feb 2020 11:24:12 +0000 (11:24 +0000)
committerWei Liu <wl@xen.org>
Wed, 5 Feb 2020 11:56:27 +0000 (11:56 +0000)
An assertion in libxl__domain_make():

'soft_reset || *domid == INVALID_DOMID'

does not hold true for stub domain creation, where soft_reset is false
but the passed in domid == 0. This is easily fixed by changing the
initializer in libxl__spawn_stub_dm().

NOTE: The comment for XEN_DOMCTL_createdomain in domctl.h is changed to
      reflect reality.

Fixes: 75259239d85d ("libxl_create: make 'soft reset' explicit")
Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Wei Liu <wl@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
tools/libxl/libxl_dm.c
xen/include/public/domctl.h

index f758daf3b6d8d15959fb4a95422a66f3bb28073b..3b1da901672879a055bc4247435358859e09b400 100644 (file)
@@ -2127,7 +2127,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
         goto out;
     }
 
-    sdss->pvqemu.guest_domid = 0;
+    sdss->pvqemu.guest_domid = INVALID_DOMID;
 
     libxl_domain_create_info_init(&dm_config->c_info);
     dm_config->c_info.type = LIBXL_DOMAIN_TYPE_PV;
index 2bb73979237cc429f99da232b4e0da34169a19dc..fec6f6fdd19c6861a8e9f7165ddd2cc8f8789bcc 100644 (file)
@@ -42,7 +42,8 @@
 
 /*
  * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
- * If it is specified as zero, an id is auto-allocated and returned.
+ * If it is specified as an invalid value (0 or >= DOMID_FIRST_RESERVED),
+ * an id is auto-allocated and returned.
  */
 /* XEN_DOMCTL_createdomain */
 struct xen_domctl_createdomain {