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

[PATCH v1 17/25] xen: add stub for XEN_DOMCTL_getdomaininfo


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Sun, 3 Aug 2025 17:47:30 +0800
  • 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=+h9q/PP5jXzGM6xOoOoRa7u5M0CRIcPBia1p5+URbJg=; b=yi4WVS/GYmwmQNBViuG0HGPCmVfhgQmk8pdq1JjReF+GVPUceU/4HdWmxPP91d6WqfacCVOgk0oSPN2oncPwdSb161BHXFlNoL90s+pgi9Wg9gQZwWqgLpd7eAVEILNOJS1MJd+/PyT5TKeHi1mX893MCROTcMqVN6LItdmqh+fIQ8FElODxBPbLLrNeCASUpUWGQl4lAmc17pRODfPRVK+Oj6xpWU9op5JBdlYxr6GUtrjQimR+kqdYoz6ND+9NEqYEVWv1v0hkX2fqY3YcwgDeJJSzrMTMfLd44LqkpE0ppiNlzlc43UTeo/uERR8EsEf9ZbA4nPeM66tkC+8rWw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DJCCcFQKtd/M/hJJOBghEGzWqpyMhumLwgPSb8bOiQqNBCf956s/B9msExdCfTmiDNCHmRplEx2YjOmtnp1rxv9+8BYtRKQnjb550NXhDSOXjkkTFEjO1aLIA++yQx9iXsmmhK954RbbNneuKd+JtYnp2dRBxU7IuRvqmDUjFQ9ZFMZ2KvnBSH2YvkMcdX4CP5RcccYJiCxzYQuNYHVrURBEa4BgkL1j98cIwo/sdC2Yl9l5lVOj+qMyAv56OfKfYklgkQROSAKKE6f5Td8M8NJQlum3j5JzYTQ9DSVhjvCMGb2C5JKB/FVAkOlezD6NSZXS+ogPi7JmVeNgdP2TgA==
  • Cc: <ray.huang@xxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, "Julien Grall" <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Sun, 03 Aug 2025 09:50:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Function getdomaininfo() is designed for XEN_DOMCTL_getdomaininfo domctl-op
to get per-domain info in userspace, so it shall be guarded with CONFIG_DOMCTL.
We need to provide stub for getdomaininfo(), as it still could be invoked
by XEN_SYSCTL_getdomaininfolist sysctl-op when CONFIG_DOMCTL=n.
The same logic goes for xsm_getdomaininfo() too.

Signed-off-by: Penny Zheng <Penny.Zheng@xxxxxxx>
---
 xen/include/xen/domain.h | 5 +++++
 xen/include/xsm/xsm.h    | 6 +++++-
 xen/xsm/dummy.c          | 2 +-
 xen/xsm/flask/hooks.c    | 4 ++--
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h
index b45ac91760..55befdb256 100644
--- a/xen/include/xen/domain.h
+++ b/xen/include/xen/domain.h
@@ -31,8 +31,13 @@ int vcpu_up(struct vcpu *v);
 
 void setup_system_domains(void);
 
+#ifdef CONFIG_DOMCTL
 struct xen_domctl_getdomaininfo;
 void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info);
+#else
+static inline void getdomaininfo(struct domain *d,
+                                 struct xen_domctl_getdomaininfo *info) {}
+#endif /* CONFIG_DOMCTL */
 void arch_get_domain_info(const struct domain *d,
                           struct xen_domctl_getdomaininfo *info);
 
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 55f8d0903e..db98496869 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -55,8 +55,8 @@ struct xsm_ops {
     void (*security_domaininfo)(struct domain *d,
                                 struct xen_domctl_getdomaininfo *info);
     int (*domain_create)(struct domain *d, uint32_t ssidref);
-    int (*getdomaininfo)(struct domain *d);
 #ifdef CONFIG_DOMCTL
+    int (*getdomaininfo)(struct domain *d);
     int (*domctl_scheduler_op)(struct domain *d, int op);
 #endif
 #ifdef CONFIG_SYSCTL
@@ -240,7 +240,11 @@ static inline int xsm_domain_create(
 
 static inline int xsm_getdomaininfo(xsm_default_t def, struct domain *d)
 {
+#ifdef CONFIG_DOMCTL
     return alternative_call(xsm_ops.getdomaininfo, d);
+#else
+    return -EOPNOTSUPP;
+#endif
 }
 
 static inline int xsm_get_domain_state(xsm_default_t def, struct domain *d)
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index cd5358dd1e..b7eb061e9b 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -17,8 +17,8 @@ static const struct xsm_ops __initconst_cf_clobber dummy_ops 
= {
     .set_system_active             = xsm_set_system_active,
     .security_domaininfo           = xsm_security_domaininfo,
     .domain_create                 = xsm_domain_create,
-    .getdomaininfo                 = xsm_getdomaininfo,
 #ifdef CONFIG_DOMCTL
+    .getdomaininfo                 = xsm_getdomaininfo,
     .domctl_scheduler_op           = xsm_domctl_scheduler_op,
 #endif
 #ifdef CONFIG_SYSCTL
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 2975d2906f..9f829aa53b 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -604,12 +604,12 @@ static int cf_check flask_domain_create(struct domain *d, 
uint32_t ssidref)
     return rc;
 }
 
+#ifdef CONFIG_DOMCTL
 static int cf_check flask_getdomaininfo(struct domain *d)
 {
     return current_has_perm(d, SECCLASS_DOMAIN, DOMAIN__GETDOMAININFO);
 }
 
-#ifdef CONFIG_DOMCTL
 static int cf_check flask_domctl_scheduler_op(struct domain *d, int op)
 {
     switch ( op )
@@ -1895,8 +1895,8 @@ static const struct xsm_ops __initconst_cf_clobber 
flask_ops = {
     .set_system_active = flask_set_system_active,
     .security_domaininfo = flask_security_domaininfo,
     .domain_create = flask_domain_create,
-    .getdomaininfo = flask_getdomaininfo,
 #ifdef CONFIG_DOMCTL
+    .getdomaininfo = flask_getdomaininfo,
     .domctl_scheduler_op = flask_domctl_scheduler_op,
 #endif
 #ifdef CONFIG_SYSCTL
-- 
2.34.1




 


Rackspace

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