libxl: fix assertion failure in stub domain creation
PATCH 1/1 libxl: fix assertion failure in stub domain creation
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().
---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Anthony PERARD <[email protected]>
Cc: Roger Pau Monné <[email protected]>
An example of the assertion failure can be seen at:
--- tools/libxl/libxl_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/libxl_dm.c +1 -1
@@ -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 ;
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 19 lines · Paul Durrant
An assertion in
libxl__domain_make():'
soft_reset|| *domid ==INVALID_DOMID'does not hold true for stub domain creation, where
soft_resetis false but the passed in domid == 0. This is easily fixed by changing the initializer inlibxl__spawn_stub_dm().Fixes 75259239d85d ("libxl_create: make 'soft reset' explicit")Signed-off-by Paul Durrant <[email protected]>--- tools/libxl/libxl_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libxl/libxl_dm.c +0
-0
tools/libxl/libxl_dm.c void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) · line 2130
Quoted 5 lines
tools/libxl/libxl_dm.c +1
-1@@ -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 ;
How this works? INVALID_DOMID seems to be directly feed to xc_domain_create(), which is using XEN_DOMCTL_createdomain. But a comment in domctl.h for XEN_DOMCTL_createdomain read:
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.
So, is xc_domain_create going to create a new domain with domid==INVALID_DOMID?
Thanks,
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 36 lines
-----Original Message-----
From: Anthony PERARD <[email protected]>
Sent: 05 February 2020 10:47
To: Durrant, Paul <[email protected]>
Cc: [email protected]; Ian Jackson <[email protected]>; Wei Liu <[email protected]>; Roger Pau Monné <[email protected]>
Subject: Re: [PATCH] libxl: fix assertion failure in stub domain creationtools/libxl/libxl_dm.c void libxl__spawn_stub_dm(libxl__egc *egc,
Quoted 19 lines · Paul Durrant
An assertion in
libxl__domain_make():'
soft_reset|| *domid ==INVALID_DOMID'does not hold true for stub domain creation, where
soft_resetis false but the passed in domid == 0. This is easily fixed by changing the initializer inlibxl__spawn_stub_dm().Fixes 75259239d85d ("libxl_create: make 'soft reset' explicit")Signed-off-by Paul Durrant <[email protected]>--- tools/libxl/libxl_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libxl/libxl_dm.c +0
-0@@ -2127,7 +2127,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc,
libxl__stub_dm_spawn_state*sdss)tools/libxl/libxl_dm.c void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) · line 2130
Quoted 5 lines
tools/libxl/libxl_dm.c +1
-1goto out; } - sdss->pvqemu.guest_domid =0 ; + sdss->pvqemu.guest_domid =INVALID_DOMID ;
Quoted 8 lines
How this works?
INVALID_DOMIDseems to be directly feed toxc_domain_create(), which is usingXEN_DOMCTL_createdomain. But a comment indomctl.hforXEN_DOMCTL_createdomainread:
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.
So, isxc_domain_creategoing to create a new domain with domid==INVALID_DOMID?
As it happens, no. That comment is wrong. It should read "If it is not set to a valid value, an id is auto-allocated and returned".
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Anthony PERARD
Acked-byQuoted 15 lines · Paul
Quoted 6 lines
From: Anthony PERARD <[email protected]>
tools/libxl/libxl_dm.c void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) · line 2130
Quoted 3 lines · Paul Durrant
tools/libxl/libxl_dm.c +1
-1- sdss->pvqemu.guest_domid =0 ; + sdss->pvqemu.guest_domid =INVALID_DOMID ;Quoted 8 lines
How this works?
INVALID_DOMIDseems to be directly feed toxc_domain_create(), which is usingXEN_DOMCTL_createdomain. But a comment indomctl.hforXEN_DOMCTL_createdomainread:
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.
So, isxc_domain_creategoing to create a new domain with domid==INVALID_DOMID?
Quoted 1 line
As it happens, no. That comment is wrong. It should read "If it is not set to a valid value, an id is auto-allocated and returned".
Ok, then:
Thanks,
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel