Skip to contentSkip to conversation

tools/libxl: Fix assertion failure when trying to build a nested-virt PVH domain

PATCH In review Andrew Cooper 3 participants 5 messages Jan 26, 2018 – Jan 29, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libxl: Fix assertion failure when trying to build a nested-virt PVH domain

xl: libxl.c:339: libxl_defbool_val: Assertion `!libxl_defbool_is_default(db)' failed.

This happens because initiate_domain_create() checks for type != HVM, then pokes at the hvm union. Check for == HVM instead so the union access is correctly guarded.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>

---
 tools/libxl/libxl_create.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/libxl_create.c +1 -1
index 3812e67..c4981352 100644
@@ -939,7 +939,7 @@ static void initiate_domain_create(libxl__egc *egc,
 
     if (d_config->c_info.type != LIBXL_DOMAIN_TYPE_PV &&
         (libxl_defbool_val(d_config->b_info.nested_hvm) &&
-        ((d_config->c_info.type != LIBXL_DOMAIN_TYPE_HVM &&
+        ((d_config->c_info.type == LIBXL_DOMAIN_TYPE_HVM &&
           libxl_defbool_val(d_config->b_info.u.hvm.altp2m)) ||
         (d_config->b_info.altp2m != LIBXL_ALTP2M_MODE_DISABLED)))) {
         ret = ERROR_INVAL;
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw

Andrew Cooper writes ("[PATCH] tools/libxl: Fix assertion failure when trying to build a nested-virt PVH domain"):

Quoted 7 lines

xl: libxl.c:339: libxl_defbool_val: Assertion `!libxl_defbool_is_default(db)' failed.

This happens because initiate_domain_create() checks for type != HVM, then pokes at the hvm union. Check for == HVM instead so the union access is correctly guarded.

This bug will be in a lot of stable branches. Do we care about fixing this bug for them ? It's UB in libxl but only if nested_hvm is enabled.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 7 lines · Ian Jackson

Andrew Cooper writes ("[PATCH] tools/libxl: Fix assertion failure when trying to build a nested-virt PVH domain"):

Quoted 6 lines

xl: libxl.c:339: libxl_defbool_val: Assertion `!libxl_defbool_is_default(db)' failed.

This happens because initiate_domain_create() checks for type != HVM, then pokes at the hvm union. Check for == HVM instead so the union access is correctly guarded.

Quoted 5 lines
Quoted 1 line

This bug will be in a lot of stable branches. Do we care about fixing this bug for them ? It's UB in libxl but only if nested_hvm is enabled.

I'm not the check is overly old to begin with.  We should probably fix it in the maintained branches.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 8 lines · Andrew Cooper
Quoted 7 lines · Ian Jackson

Andrew Cooper writes ("[PATCH] tools/libxl: Fix assertion failure when trying to build a nested-virt PVH domain"):

Quoted 6 lines

xl: libxl.c:339: libxl_defbool_val: Assertion `!libxl_defbool_is_default(db)' failed.

This happens because initiate_domain_create() checks for type != HVM, then pokes at the hvm union. Check for == HVM instead so the union access is correctly guarded.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

This bug will be in a lot of stable branches. Do we care about fixing this bug for them ? It's UB in libxl but only if nested_hvm is enabled.

I'm not the check is overly old to begin with.  We should probably fix it in the maintained branches.

AFAICT this was introduced by my type = 'pvh' work, sorry. It should only need backporting to 4.10 and the 4.8.3pre-shim-comet branches.

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw

Roger Pau Monné writes ("Re: [Xen-devel] [PATCH] tools/libxl: Fix assertion failure when trying to build a nested-virt PVH domain"):

Quoted 1 line · Andrew Cooper

...

Quoted 5 lines
Quoted 2 lines

I'm not the check is overly old to begin with.  We should probably fix it in the maintained branches.

AFAICT this was introduced by my type = 'pvh' work, sorry. It should only need backporting to 4.10 and the 4.8.3pre-shim-comet branches.

Thanks.

I think under the circumstances we should probably do this right away.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel