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

[xen staging] tools/xenstored: Use priv_domid for manual nodes and permission



commit c67def341a1d1f35ed5c681f3001496be2ad5ea6
Author:     Jason Andryuk <jason.andryuk@xxxxxxx>
AuthorDate: Fri Aug 15 17:35:53 2025 -0400
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Aug 19 11:03:57 2025 +0200

    tools/xenstored: Use priv_domid for manual nodes and permission
    
    Usually, priv_domid == dom0_domid == 0, and that is what is expected.
    If we rename s/dom0_domid/store_domid/, it seems more likely we want to
    actually have the priv_domid as the owner.
    
    That leads to follow on changes to ensure that the priv_domid is created
    first.
    
    Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
    Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
---
 tools/xenstored/core.c   |  4 ++--
 tools/xenstored/domain.c | 14 +++++++-------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index d447e1167e..7a65ddb585 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -2269,7 +2269,7 @@ struct connection *get_connection_by_id(unsigned int 
conn_id)
 static void manual_node(const char *name, const char *child)
 {
        struct node *node;
-       struct xs_permissions perms = { .id = dom0_domid,
+       struct xs_permissions perms = { .id = priv_domid,
                                        .perms = XS_PERM_NONE };
 
        node = talloc_zero(NULL, struct node);
@@ -2320,7 +2320,7 @@ void setup_structure(bool live_update)
                manual_node("/tool/xenstored", NULL);
                manual_node("@releaseDomain", NULL);
                manual_node("@introduceDomain", NULL);
-               domain_nbentry_fix(dom0_domid, 5, true);
+               domain_nbentry_fix(priv_domid, 5, true);
        }
 }
 
diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index c74bafa165..bcc63104b7 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -1026,7 +1026,7 @@ static struct domain *introduce_domain(const void *ctx,
        struct domain *domain;
        int rc;
        struct xenstore_domain_interface *interface;
-       bool is_master_domain = (domid == xenbus_master_domid());
+       bool is_priv_domain = (domid == priv_domid);
 
        domain = find_or_alloc_domain(ctx, domid);
        if (!domain)
@@ -1051,13 +1051,13 @@ static struct domain *introduce_domain(const void *ctx,
                if (!restore)
                        interface->server_features = domain->features;
 
-               if (is_master_domain)
+               if (is_priv_domain)
                        setup_structure(restore);
 
                /* Now domain belongs to its connection. */
                talloc_steal(domain->conn, domain);
 
-               if (!is_master_domain && !restore)
+               if (!is_priv_domain && !restore)
                        fire_special_watches("@introduceDomain");
        } else {
                /* Use XS_INTRODUCE for recreating the xenbus event-channel. */
@@ -1392,15 +1392,15 @@ void init_domains(void)
                barf("Could not determine xenstore domid\n");
 
        /*
-        * Local domid must be first to setup structures for firing the special
-        * watches.
+        * Privileged domid must be first to setup structures for firing the
+        * special watches.
         */
-       if (init_domain(dom0_domid))
+       if (init_domain(priv_domid))
                introduce_count++;
 
        for (unsigned int i = 0; i < nr_domids; i++) {
                domid = domids[i];
-               if (domid == dom0_domid)
+               if (domid == priv_domid)
                        continue;
 
                if (init_domain(domid))
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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