domctl/XSM: pass full struct xen_domctl to xsm_domctl()

Subsequently some sub-ops will want to inspect their sub-sub-ops. Plus
this way we don't need to pass SSIDref separately anymore for
domain_create.

This is part of XSA-492.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
(cherry picked from commit 83f0e11ed1)
This commit is contained in:
Jan Beulich authored and Andrew Cooper committed 2026-06-04 21:47:50 +01:00
1 parent fc86e21be9
commit 5c86d123d7
5 files changed
+12 -14

No files matched your search

+1 -1
View File
@@ -767,7 +767,7 @@ long do_paging_domctl_cont(
if ( d == NULL )
return -ESRCH;
ret = xsm_domctl(XSM_OTHER, d, op.cmd, 0 /* SSIDref not applicable */);
ret = xsm_domctl(XSM_OTHER, d, &op);
if ( !ret )
{
if ( domctl_lock_acquire() )
+1 -3
View File
@@ -515,9 +515,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
break;
}
ret = xsm_domctl(XSM_OTHER, d, op->cmd,
/* SSIDRef only applicable for cmd == createdomain */
op->u.createdomain.ssidref);
ret = xsm_domctl(XSM_OTHER, d, op);
if ( ret )
goto domctl_out_unlock_domonly;
+2 -2
View File
@@ -162,10 +162,10 @@ static XSM_INLINE int cf_check xsm_set_target(
}
static XSM_INLINE int cf_check xsm_domctl(
XSM_DEFAULT_ARG struct domain *d, unsigned int cmd, uint32_t ssidref)
XSM_DEFAULT_ARG struct domain *d, struct xen_domctl *op)
{
XSM_ASSERT_ACTION(XSM_OTHER);
switch ( cmd )
switch ( op->cmd )
{
case XEN_DOMCTL_bind_pt_irq:
case XEN_DOMCTL_getdomaininfo:
+3 -3
View File
@@ -60,7 +60,7 @@ struct xsm_ops {
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, unsigned int cmd, uint32_t ssidref);
int (*domctl)(struct domain *d, struct xen_domctl *op);
int (*sysctl)(int cmd);
int (*readconsole)(uint32_t clear);
@@ -249,9 +249,9 @@ static inline int xsm_set_target(
}
static inline int xsm_domctl(xsm_default_t def, struct domain *d,
unsigned int cmd, uint32_t ssidref)
struct xen_domctl *op)
{
return alternative_call(xsm_ops.domctl, d, cmd, ssidref);
return alternative_call(xsm_ops.domctl, d, op);
}
static inline int xsm_sysctl(xsm_default_t def, int cmd)
+5 -5
View File
@@ -663,10 +663,9 @@ static int cf_check flask_set_target(struct domain *d, struct domain *t)
return rc;
}
static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
uint32_t ssidref)
static int cf_check flask_domctl(struct domain *d, struct xen_domctl *op)
{
switch ( cmd )
switch ( op->cmd )
{
case XEN_DOMCTL_createdomain:
/*
@@ -676,7 +675,8 @@ static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
* Note that d is NULL because we haven't even allocated memory for it
* this early in XEN_DOMCTL_createdomain.
*/
return avc_current_has_perm(ssidref, SECCLASS_DOMAIN, DOMAIN__CREATE, NULL);
return avc_current_has_perm(op->u.createdomain.ssidref, SECCLASS_DOMAIN,
DOMAIN__CREATE, NULL);
/* These have individual XSM hooks and don't make it here. */
case XEN_DOMCTL_bind_pt_irq:
@@ -846,7 +846,7 @@ static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__DT_OVERLAY);
default:
return avc_unknown_permission("domctl", cmd);
return avc_unknown_permission("domctl", op->cmd);
}
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.