Skip to contentSkip to conversation

libxl: fix assertion failure in stub domain creation

PATCH Superseded Paul Durrant 3 participants 4 messages Feb 5, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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().

Fixes 75259239d85d ("libxl_create: make 'soft reset' explicit")

---
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:

http://logs.test-lab.xenproject.org/osstest/logs/146726/test-amd64-amd64-xl-qemut-stubdom-debianhvm-amd64-xsm/10.ts-debian-hvm-install.log

---
 tools/libxl/libxl_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/libxl_dm.c +1 -1
index f758daf3b6..3b1da90167 100644
@@ -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
#1 lore raw
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_reset is false but the passed in domid == 0. This is easily fixed by changing the initializer in libxl__spawn_stub_dm().

Fixes 75259239d85d ("libxl_create: make 'soft reset' explicit")
---
 tools/libxl/libxl_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/libxl_dm.c +0 -0
index f758daf3b6..3b1da90167 100644

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
#2 lore raw
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 creation

tools/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_reset is false but the passed in domid == 0. This is easily fixed by changing the initializer in libxl__spawn_stub_dm().

Fixes 75259239d85d ("libxl_create: make 'soft reset' explicit")
---
 tools/libxl/libxl_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/libxl_dm.c +0 -0
index f758daf3b6..3b1da90167 100644
@@ -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 -1
         goto out;
     }
 
-    sdss->pvqemu.guest_domid = 0;
+    sdss->pvqemu.guest_domid = INVALID_DOMID;
Quoted 8 lines

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?

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

#3 lore raw
Quoted 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_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?

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