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

[xen master] tools/helpers: fix broken xenstore stubdom init



commit 86a192e511bd826c59ae1643d06fd52a5bc21ca6
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Thu Nov 4 15:42:42 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Nov 4 18:43:20 2021 +0000

    tools/helpers: fix broken xenstore stubdom init
    
    Commit 1787cc167906f3f ("libs/guest: Move the guest ABI check earlier
    into xc_dom_parse_image()") broke starting the xenstore stubdom. This
    is due to a rather special way the xenstore stubdom domain config is
    being initialized: in order to support both, PV and PVH stubdom,
    init-xenstore-domain is using xc_dom_parse_image() to find the correct
    domain type. Unfortunately above commit requires xc_dom_boot_xen_init()
    to have been called before using xc_dom_parse_image(). This requires
    the domid, which is known only after xc_domain_create(), which requires
    the domain type.
    
    In order to break this circular dependency, call xc_dom_boot_xen_init()
    with an arbitrary domid first, and then set dom->guest_domid later.
    
    Fixes: 1787cc167906f3f ("libs/guest: Move the guest ABI check earlier into 
xc_dom_parse_image()")
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Release-acked-by: Ian Jackson <iwj@xxxxxxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 tools/helpers/init-xenstore-domain.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/tools/helpers/init-xenstore-domain.c 
b/tools/helpers/init-xenstore-domain.c
index 6836002f0b..a79662bd1b 100644
--- a/tools/helpers/init-xenstore-domain.c
+++ b/tools/helpers/init-xenstore-domain.c
@@ -132,6 +132,13 @@ static int build(xc_interface *xch)
         }
     }
 
+    rv = xc_dom_boot_xen_init(dom, xch, domid);
+    if ( rv )
+    {
+        fprintf(stderr, "xc_dom_boot_xen_init failed\n");
+        goto err;
+    }
+
     dom->container_type = XC_DOM_HVM_CONTAINER;
     rv = xc_dom_parse_image(dom);
     if ( rv )
@@ -214,16 +221,11 @@ static int build(xc_interface *xch)
     else
         snprintf(cmdline, 512, "--event %d --internal-db", rv);
 
+    dom->guest_domid = domid;
     dom->cmdline = xc_dom_strdup(dom, cmdline);
     dom->xenstore_domid = domid;
     dom->console_evtchn = console_evtchn;
 
-    rv = xc_dom_boot_xen_init(dom, xch, domid);
-    if ( rv )
-    {
-        fprintf(stderr, "xc_dom_boot_xen_init failed\n");
-        goto err;
-    }
     rv = xc_dom_mem_init(dom, memory);
     if ( rv )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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