|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 12/14] XSM: convert remaining domain-related hooks
Make them follow the standard scheme, i.e. taking xsm_default_t as first
argument at call sites. This way they can be covered by the recently
introduced hook machinery.
While there,
- rename flask_domain_{alloc,free}_security() to fit the corresponding
hook names,
- add const to .security_domaininfo()'s first parameter.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v2: New.
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -760,7 +760,7 @@ static void _domain_destroy(struct domai
free_cpumask_var(d->dirty_cpumask);
- xsm_free_security_domain(d);
+ xsm_free_security_domain(XSM_HOOK, d);
lock_profile_deregister_struct(LOCKPROF_TYPE_PERDOM, d);
@@ -987,7 +987,7 @@ struct domain *domain_create(domid_t dom
d->max_vcpus = config->max_vcpus;
}
- if ( (err = xsm_alloc_security_domain(d)) != 0 )
+ if ( (err = xsm_alloc_security_domain(XSM_HOOK, d)) != 0 )
goto fail;
err = -ENOMEM;
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -91,7 +91,7 @@ void getdomaininfo(struct domain *d, str
(is_hvm_domain(d) ? XEN_DOMINF_hvm_guest : 0) |
d->shutdown_code << XEN_DOMINF_shutdownshift;
- xsm_security_domaininfo(d, info);
+ xsm_security_domaininfo(XSM_HOOK, d, info);
info->tot_pages = domain_tot_pages(d);
info->max_pages = d->max_pages;
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -122,8 +122,11 @@ static XSM_INLINE int xsm_set_system_act
}
static XSM_INLINE void xsm_security_domaininfo(
- struct domain *d, struct xen_domctl_getdomaininfo *info)
-{}
+ XSM_DEFAULT_ARG const struct domain *d,
+ struct xen_domctl_getdomaininfo *info)
+{
+ XSM_ASSERT_ACTION(XSM_HOOK);
+}
static XSM_INLINE int xsm_domain_create(
XSM_DEFAULT_ARG struct domain *d, uint32_t ssidref)
@@ -179,13 +182,18 @@ static XSM_INLINE int xsm_sysctl(
return xsm_default_action(action, current->domain, NULL);
}
-static XSM_INLINE int xsm_alloc_security_domain(struct domain *d)
+static XSM_INLINE int xsm_alloc_security_domain(
+ XSM_DEFAULT_ARG struct domain *d)
{
+ XSM_ASSERT_ACTION(XSM_HOOK);
return 0;
}
-static XSM_INLINE void xsm_free_security_domain(struct domain *d)
-{}
+static XSM_INLINE void xsm_free_security_domain(
+ XSM_DEFAULT_ARG struct domain *d)
+{
+ XSM_ASSERT_ACTION(XSM_HOOK);
+}
#ifdef CONFIG_GRANT_TABLE
--- a/xen/include/xsm/hooks.h
+++ b/xen/include/xsm/hooks.h
@@ -20,6 +20,10 @@
XSM_HOOK(int, domain_create, struct domain *, uint32_t)
XSM_HOOK(int, getdomaininfo, struct domain *)
XSM_HOOK(int, get_domain_state, struct domain *)
+XSM_HOOK(void, security_domaininfo, const struct domain *,
+ struct xen_domctl_getdomaininfo *)
+XSM_HOOK(int, alloc_security_domain, struct domain *)
+XSM_HOOK(void, free_security_domain, struct domain *)
#ifdef CONFIG_SYSCTL
XSM_HOOK(int, sysctl, const struct xen_sysctl *)
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -62,8 +62,6 @@ typedef enum xsm_default xsm_default_t;
*/
struct xsm_ops {
int (*set_system_active)(void);
- void (*security_domaininfo)(struct domain *d,
- struct xen_domctl_getdomaininfo *info);
#define XSM_HOOK0(rtype, name) rtype (*name)(void);
#define XSM_HOOK1(rtype, name, type1) \
@@ -79,9 +77,6 @@ struct xsm_ops {
#include "hooks.h"
- int (*alloc_security_domain)(struct domain *d);
- void (*free_security_domain)(struct domain *d);
-
char *(*show_irq_sid)(int irq);
};
@@ -96,12 +91,6 @@ static inline int xsm_set_system_active(
return alternative_call(xsm_ops.set_system_active);
}
-static inline void xsm_security_domaininfo(
- struct domain *d, struct xen_domctl_getdomaininfo *info)
-{
- alternative_vcall(xsm_ops.security_domaininfo, d, info);
-}
-
#define XSM_ALT_void alternative_vcall
#define XSM_ALT_int return alternative_call
#define XSM_ALT_pchar_t return alternative_call
@@ -149,16 +138,6 @@ static inline rtype xsm_ ## name( \
#include "hooks.h"
-static inline int xsm_alloc_security_domain(struct domain *d)
-{
- return alternative_call(xsm_ops.alloc_security_domain, d);
-}
-
-static inline void xsm_free_security_domain(struct domain *d)
-{
- alternative_vcall(xsm_ops.free_security_domain, d);
-}
-
static inline char *xsm_show_irq_sid(int irq)
{
return alternative_call(xsm_ops.show_irq_sid, irq);
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -15,7 +15,6 @@
static const struct xsm_ops __initconst_cf_clobber dummy_ops = {
.set_system_active = xsm_set_system_active,
- .security_domaininfo = xsm_security_domaininfo,
#define XSM_HOOK0(rtype, name) .name = xsm_ ## name,
#define XSM_HOOK1(rtype, name, ...) XSM_HOOK0(rtype, name)
@@ -26,9 +25,6 @@ static const struct xsm_ops __initconst_
#include <xsm/hooks.h>
- .alloc_security_domain = xsm_alloc_security_domain,
- .free_security_domain = xsm_free_security_domain,
-
.show_irq_sid = xsm_show_irq_sid,
};
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -188,7 +188,7 @@ static int avc_unknown_permission(const
return rc;
}
-static int cf_check flask_domain_alloc_security(struct domain *d)
+static int cf_check flask_alloc_security_domain(struct domain *d)
{
struct domain_security_struct *dsec;
@@ -256,7 +256,7 @@ static int cf_check flask_set_system_act
return 0;
}
-static void cf_check flask_domain_free_security(struct domain *d)
+static void cf_check flask_free_security_domain(struct domain *d)
{
struct domain_security_struct *dsec = d->ssid;
@@ -549,7 +549,7 @@ static int cf_check flask_schedop_shutdo
}
static void cf_check flask_security_domaininfo(
- struct domain *d, struct xen_domctl_getdomaininfo *info)
+ const struct domain *d, struct xen_domctl_getdomaininfo *info)
{
info->ssidref = domain_sid(d);
}
@@ -1904,7 +1904,6 @@ static int cf_check flask_get_domain_sta
static const struct xsm_ops __initconst_cf_clobber flask_ops = {
.set_system_active = flask_set_system_active,
- .security_domaininfo = flask_security_domaininfo,
#define XSM_HOOK0(rtype, name) .name = flask_ ## name,
#define XSM_HOOK1(rtype, name, ...) XSM_HOOK0(rtype, name)
@@ -1915,9 +1914,6 @@ static const struct xsm_ops __initconst_
#include <xsm/hooks.h>
- .alloc_security_domain = flask_domain_alloc_security,
- .free_security_domain = flask_domain_free_security,
-
.show_irq_sid = flask_show_irq_sid,
};
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |