|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v1 17/25] xen: add stub for XEN_DOMCTL_getdomaininfo
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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |