mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
domctl/XSM: drop scheduler_op hook
Integrate the checking with xsm_domctl(), now that it has the full op
struct passed. As a positive side effect, permissions are then checked at
the same early point with and without Flask.
This is part of XSA-492.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
(cherry picked from commit 3ba374d388)
This commit is contained in:
1 parent
53cd1f0cf5
commit
ffc0d278e7
5 files changed
+4
-22
No files matched your search
@@ -2058,10 +2058,6 @@ long sched_adjust(struct domain *d, struct xen_domctl_scheduler_op *op)
|
||||
{
|
||||
long ret;
|
||||
|
||||
ret = xsm_domctl_scheduler_op(XSM_HOOK, d, op->cmd);
|
||||
if ( ret )
|
||||
return ret;
|
||||
|
||||
if ( op->sched_id != dom_scheduler(d)->sched_id )
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
@@ -141,13 +141,6 @@ static XSM_INLINE int cf_check xsm_getdomaininfo(
|
||||
return xsm_default_action(action, current->domain, d);
|
||||
}
|
||||
|
||||
static XSM_INLINE int cf_check xsm_domctl_scheduler_op(
|
||||
XSM_DEFAULT_ARG struct domain *d, int cmd)
|
||||
{
|
||||
XSM_ASSERT_ACTION(XSM_HOOK);
|
||||
return xsm_default_action(action, current->domain, d);
|
||||
}
|
||||
|
||||
static XSM_INLINE int cf_check xsm_sysctl_scheduler_op(XSM_DEFAULT_ARG int cmd)
|
||||
{
|
||||
XSM_ASSERT_ACTION(XSM_HOOK);
|
||||
|
||||
@@ -57,7 +57,6 @@ struct xsm_ops {
|
||||
struct xen_domctl_getdomaininfo *info);
|
||||
int (*domain_create)(struct domain *d, uint32_t ssidref);
|
||||
int (*getdomaininfo)(struct domain *d);
|
||||
int (*domctl_scheduler_op)(struct domain *d, int op);
|
||||
int (*sysctl_scheduler_op)(int op);
|
||||
int (*set_target)(struct domain *d, struct domain *e);
|
||||
int (*domctl)(struct domain *d, struct xen_domctl *op);
|
||||
@@ -229,12 +228,6 @@ static inline int xsm_getdomaininfo(xsm_default_t def, struct domain *d)
|
||||
return alternative_call(xsm_ops.getdomaininfo, d);
|
||||
}
|
||||
|
||||
static inline int xsm_domctl_scheduler_op(
|
||||
xsm_default_t def, struct domain *d, int cmd)
|
||||
{
|
||||
return alternative_call(xsm_ops.domctl_scheduler_op, d, cmd);
|
||||
}
|
||||
|
||||
static inline int xsm_sysctl_scheduler_op(xsm_default_t def, int cmd)
|
||||
{
|
||||
return alternative_call(xsm_ops.sysctl_scheduler_op, cmd);
|
||||
|
||||
@@ -18,7 +18,6 @@ static const struct xsm_ops __initconst_cf_clobber dummy_ops = {
|
||||
.security_domaininfo = xsm_security_domaininfo,
|
||||
.domain_create = xsm_domain_create,
|
||||
.getdomaininfo = xsm_getdomaininfo,
|
||||
.domctl_scheduler_op = xsm_domctl_scheduler_op,
|
||||
.sysctl_scheduler_op = xsm_sysctl_scheduler_op,
|
||||
.set_target = xsm_set_target,
|
||||
.domctl = xsm_domctl,
|
||||
|
||||
@@ -607,7 +607,7 @@ static int cf_check flask_getdomaininfo(struct domain *d)
|
||||
return current_has_perm(d, SECCLASS_DOMAIN, DOMAIN__GETDOMAININFO);
|
||||
}
|
||||
|
||||
static int cf_check flask_domctl_scheduler_op(struct domain *d, int op)
|
||||
static int flask_domctl_scheduler_op(struct domain *d, int op)
|
||||
{
|
||||
switch ( op )
|
||||
{
|
||||
@@ -691,7 +691,6 @@ static int cf_check flask_domctl(struct domain *d, struct xen_domctl *op)
|
||||
return -EILSEQ;
|
||||
|
||||
/* These have individual XSM hooks (common/domctl.c) */
|
||||
case XEN_DOMCTL_scheduler_op:
|
||||
case XEN_DOMCTL_set_target:
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
@@ -739,6 +738,9 @@ static int cf_check flask_domctl(struct domain *d, struct xen_domctl *op)
|
||||
case XEN_DOMCTL_setdomainhandle:
|
||||
return current_has_perm(d, SECCLASS_DOMAIN, DOMAIN__SETDOMAINHANDLE);
|
||||
|
||||
case XEN_DOMCTL_scheduler_op:
|
||||
return flask_domctl_scheduler_op(d, op->u.scheduler_op.cmd);
|
||||
|
||||
case XEN_DOMCTL_set_ext_vcpucontext:
|
||||
case XEN_DOMCTL_set_vcpu_msrs:
|
||||
case XEN_DOMCTL_setvcpucontext:
|
||||
@@ -1849,7 +1851,6 @@ static const struct xsm_ops __initconst_cf_clobber flask_ops = {
|
||||
.security_domaininfo = flask_security_domaininfo,
|
||||
.domain_create = flask_domain_create,
|
||||
.getdomaininfo = flask_getdomaininfo,
|
||||
.domctl_scheduler_op = flask_domctl_scheduler_op,
|
||||
.sysctl_scheduler_op = flask_sysctl_scheduler_op,
|
||||
.set_target = flask_set_target,
|
||||
.domctl = flask_domctl,
|
||||
|
||||