[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/23] tools/xenstored: Automatically set dom0_domid and priv_domid
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jason Andryuk <jason.andryuk@xxxxxxx>
- Date: Thu, 6 Mar 2025 17:03:31 -0500
- 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=TIFP0yUwDgWt/wxdaqwbVpnFqSs0Z5n/kZ01lqaZPKE=; b=uPg281JgquqpLDpTLIHKCBxpFFVjr4C2jzLjtIF04srQc7ghytxiLoKkKI+xb1YH9W+bIBuqQe77VqxiHgrAumJ3kqASiOPZwz/bk/qhLFEtGb1XT9Lds+J9V9ssPamCqPOZ6q5dG9K+z1sTfUMEe1faBQNKqQdQnhrq/S9Le5Y8ft30Yyxw9fRvkIy1KqObT10uKtthn3o3EiWl3R3rbaFzjLWVQmZWMNxgs5Y+2njbhUazb0yC7NJ+G4KpPbyROBasMQh0b4RJqmf9PQHZJ5fwtozpnb/XaEddQ0nIh+YbGtO1/Wi0wu8cZGAVK1oleD1HifohFkul4uj/ElYodg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xcsW3wdzI+XDR2piqXad7ZdUfq3ZY/rcJLCahasoTxYKJHp1K6gjAqUOEMzngL0XFhS7ytPF9GZXkR9palzqw/hJA7bxfW6shsjCvQBi/qDn/kdV/8onqwR342EMtU7tkU7BWFjVRdFwqaDCbTx5C5hh9cGTI1l5hKW2D6xvx/zLI3FYk7kW/lGc/oGPeh33xmcga2f0T09EEg/OuA+zOldAnmjlf2niMsK5pB+p842A7IFNjii6qeI5NqLZoA2cet2wWfZUZXvQiCNfOaN9PuUXIsH/dzY+ixS8XpktxGM8zJHy8eEGL8A2wVjCtbg4MZAIwhxVd7wuYS61gb2SGQ==
- Cc: Jason Andryuk <jason.andryuk@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
- Delivery-date: Thu, 06 Mar 2025 22:40:58 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
With split hardware and control domains, each domain should be
privileged with respect to xenstore. When adding domains to xenstore,
look at their privilege and add them to xenstored as appropriate.
dom0_domid is used for the hardware domain, and priv_domid is used for a
control domain.
Only one of each is allowed for now.
Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
tools/xenstored/domain.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index 64c8fd0cc3..f2394cd6e9 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -795,6 +795,20 @@ static struct domain
*find_or_alloc_existing_domain(unsigned int domid)
return domain;
}
+static void domain_set_privileged(struct domain *domain)
+{
+ xc_domaininfo_t dominfo;
+
+ if ( !get_domain_info(domain->domid, &dominfo) )
+ return;
+
+ if ( dominfo.flags & XEN_DOMINF_priv )
+ priv_domid = domain->domid;
+
+ if ( dominfo.flags & XEN_DOMINF_hardware )
+ dom0_domid = domain->domid;
+}
+
static int new_domain(struct domain *domain, int port, bool restore)
{
int rc;
@@ -831,6 +845,8 @@ static int new_domain(struct domain *domain, int port, bool
restore)
domain->conn->domain = domain;
domain->conn->id = domain->domid;
+ domain_set_privileged(domain);
+
return 0;
}
--
2.48.1
|