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

[PATCH v6 5/8] tools/xenstored: Use priv_domid for manual nodes and permission


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Fri, 15 Aug 2025 17:35:53 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AYlxeCuUWQFVD2Lqd3WOg1K+vgoKT/PL3YrRM2td0dw=; b=pIm2fIxjHFM3SA1j72JihVfrUzT4324UOXJebFbLkRDcjNZPwwXEz1XN6ADfDCcMMc5CFbJpsKyZRbE0vxU1CvWsnlNG5XlRZRBZvPk0sR8vz3QJ1Q4BGTvjR6OEJO+BwpvLJUhFFg153HAYUlL31QPfTdIGKLVpnXIpYQQXoF/1WLalLircxWlq9PrvswrscFrwDiWARyIzXgEWF7Vbq9EKrmsROdrA8Arsxlv9PF4Gi9ZUpyIY1CLup3+rVK5D5CCNHXZgnKwn13pBr5zqf22/8aeQ0XClK5TTHuRAYHvGxfpTWowVwOMalJayOKqL4LIYHzoOl1nOqKepYrVUWA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UeMN+4wmElynPYLdrILMLDjMIqU8je+i0dolCtvD9JfQjbfQ8Ekp4ZxAZER7pW579S11e5Ae13yPboicOXEfDDz9m5Bob1VGjuJq+MOD9oUhNBPDvy9GLjoPNTrPHbiIT0uV4OSEzgtV1KXliSJD0kvEb2oTaejjj1F1qTulutD3wE+k5fqiYrVS8CQ1ZiUwPMfJGQ9OInnb7IWVlUbQchS3Ry10GWqGvNK+yLD/daGF6q9U8K1/84Nukx79jCdkomC1icON1+FGUohn8bvbp0yHq4hV/vTEI1yadK2z6/MLOMC0GgJFJDfbSJgNGhd2Ir/TgIxnbf5h5W0CMrL6DA==
  • Cc: Jason Andryuk <jason.andryuk@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Fri, 15 Aug 2025 21:36:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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>
---
v5:
R-b Juergen
s/Local/Privileged/ in comment
---
 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))
-- 
2.50.1




 


Rackspace

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