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

[PATCH v5 08/11] tools/xenstored: Use priv_domid for manual nodes and permission


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Fri, 25 Jul 2025 19:58:55 -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=6qWkiKC5suZIzWW4U7EhVfJcFngSvVnzgyONjQcceXA=; b=EF10HaPuVoO73IbBqk5ygDDZq7rSOk/jNYkLpH80iCKqGfe7dXBnfhZ9DjgVqWDlwl3ee9O0MTkeXAXJG8/NwpOvaGzfQ2u2pfmqplgYmCdvw6k8RBeS/GllPX2+Itx6GckMr3Zz/XjHMVmBEh+aZSlFKhDGrtCFHeCDf7KBXGhqzK4OELzsXXeky4YH9QYL+5DCHck+6DeguGARINwRyGbPGjD/7jqu40+JXpYIvDn7Orx4IycGsCs3QNLqy1hxBj+bB4Gp07F3xoS1DNX45sGg1n+KbZLkLeI5QbVntoz4XlhZCWCkr3Bs8pPlTwswPqApIhcEQRH77wOKGXr9ow==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lXFBJlqFEQEC+sjEBt6TKIi0UKO4Zu7k0gearcymzO3GwNmT8oBxHwNPis3xitWQylAkMzYUVPL32l/Z9aJVSGWmpqlVO+SHuKV1OHuwc1MjRIQPTgjlBzFrAWqEYc1TWYQxYxq4W0mk+mqBtGTsbTIWX4nq3s8jSrg+Ttmd8Sm+hQXVz5cR1IG+kIzCetpEpxP7TMD0euF9j4rmPP4pOIX83WjLG1tHutqdhAatbF2gWeyA1BihXrZE2amwD5LAhTgCLPHlq3UyoGmlPIGBpSYA5CznP73RM1lzMmFdpZXtqwDrJrlE7cgZJESvh15PwEzXnfQ1I5UbLB5cBT97TQ==
  • Cc: Jason Andryuk <jason.andryuk@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Fri, 25 Jul 2025 23:59:47 +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.

If priv_domid is unset, set to dom0_domid to have a functional
xenstored.

Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
Held off R-b Juergen because of priv_domid setting

v5:
Add unset priv_domid setting
Additional change for continue check inside the loop
---
 tools/xenstored/core.c   |  4 ++--
 tools/xenstored/domain.c | 16 ++++++++--------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index dbf3548a8e..098958f611 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -2266,7 +2266,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);
@@ -2317,7 +2317,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 5e53fe8736..94cbe81ca5 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -1014,7 +1014,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)
@@ -1037,13 +1037,13 @@ static struct domain *introduce_domain(const void *ctx,
                }
                domain->interface = interface;
 
-               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. */
@@ -1311,22 +1311,22 @@ void init_domains(void)
                }
        }
 
-       if (dom0_domid == DOMID_INVALID)
-               dom0_domid = priv_domid;
+       if (priv_domid == DOMID_INVALID)
+               priv_domid = dom0_domid;
 
-       if (dom0_domid == DOMID_INVALID)
+       if (priv_domid == DOMID_INVALID)
                barf("Could not determine xenstore domid\n");
 
        /*
         * Local 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®.