mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
domctl: handle XEN_DOMCTL_{,un}bind_pt_irq without acquiring domctl lock
With dedicated locking added, the domctl lock isn't required here anymore.
(It also already isn't used when pt_irq_{create,destroy}_bind() are
invoked for PVH Dom0.) As the handling is in arch-specific code, no code
is being moved, but the 2nd (extensible to other sub-ops like the ones
here) invocation of arch_do_domctl() is being re-used.
This is part of XSA-492.
Fixes: fda49f9b3f ("Add build option to allow more hypercalls from stubdoms")
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
Acked-by: Julien Grall <julien@xen.org>
(cherry picked from commit e263eeaf71)
This commit is contained in:
1 parent
f7ec26e3b7
commit
4e53d41bee
5 files changed
+11
-12
No files matched your search
@@ -104,7 +104,7 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
|
||||
if ( rc )
|
||||
return rc;
|
||||
|
||||
rc = xsm_bind_pt_irq(XSM_HOOK, d, bind);
|
||||
rc = xsm_bind_pt_irq(XSM_DM_PRIV, d, bind);
|
||||
if ( rc )
|
||||
return rc;
|
||||
|
||||
@@ -140,7 +140,7 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
|
||||
if ( irq != virq )
|
||||
return -EINVAL;
|
||||
|
||||
rc = xsm_unbind_pt_irq(XSM_HOOK, d, bind);
|
||||
rc = xsm_unbind_pt_irq(XSM_DM_PRIV, d, bind);
|
||||
if ( rc )
|
||||
return rc;
|
||||
|
||||
|
||||
@@ -568,7 +568,7 @@ long arch_do_domctl(
|
||||
if ( !is_hvm_domain(d) )
|
||||
break;
|
||||
|
||||
ret = xsm_bind_pt_irq(XSM_HOOK, d, bind);
|
||||
ret = xsm_bind_pt_irq(XSM_DM_PRIV, d, bind);
|
||||
if ( ret )
|
||||
break;
|
||||
|
||||
@@ -606,7 +606,7 @@ long arch_do_domctl(
|
||||
if ( !is_hvm_domain(d) )
|
||||
break;
|
||||
|
||||
ret = xsm_unbind_pt_irq(XSM_HOOK, d, bind);
|
||||
ret = xsm_unbind_pt_irq(XSM_DM_PRIV, d, bind);
|
||||
if ( ret )
|
||||
break;
|
||||
|
||||
|
||||
@@ -428,6 +428,8 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
|
||||
}
|
||||
|
||||
case XEN_DOMCTL_ioport_mapping:
|
||||
case XEN_DOMCTL_bind_pt_irq:
|
||||
case XEN_DOMCTL_unbind_pt_irq:
|
||||
ret = arch_do_domctl(op, d, u_domctl);
|
||||
goto domctl_out_unlock_domonly;
|
||||
|
||||
|
||||
@@ -168,12 +168,10 @@ static XSM_INLINE int cf_check xsm_domctl(
|
||||
switch ( cmd )
|
||||
{
|
||||
case XEN_DOMCTL_bind_pt_irq:
|
||||
case XEN_DOMCTL_unbind_pt_irq:
|
||||
return xsm_default_action(XSM_DM_PRIV, current->domain, d);
|
||||
|
||||
case XEN_DOMCTL_getdomaininfo:
|
||||
case XEN_DOMCTL_ioport_mapping:
|
||||
case XEN_DOMCTL_memory_mapping:
|
||||
case XEN_DOMCTL_unbind_pt_irq:
|
||||
ASSERT_UNREACHABLE();
|
||||
return -EILSEQ;
|
||||
|
||||
@@ -540,14 +538,14 @@ static XSM_INLINE int cf_check xsm_unmap_domain_pirq(
|
||||
static XSM_INLINE int cf_check xsm_bind_pt_irq(
|
||||
XSM_DEFAULT_ARG struct domain *d, struct xen_domctl_bind_pt_irq *bind)
|
||||
{
|
||||
XSM_ASSERT_ACTION(XSM_HOOK);
|
||||
XSM_ASSERT_ACTION(XSM_DM_PRIV);
|
||||
return xsm_default_action(action, current->domain, d);
|
||||
}
|
||||
|
||||
static XSM_INLINE int cf_check xsm_unbind_pt_irq(
|
||||
XSM_DEFAULT_ARG struct domain *d, struct xen_domctl_bind_pt_irq *bind)
|
||||
{
|
||||
XSM_ASSERT_ACTION(XSM_HOOK);
|
||||
XSM_ASSERT_ACTION(XSM_DM_PRIV);
|
||||
return xsm_default_action(action, current->domain, d);
|
||||
}
|
||||
|
||||
|
||||
@@ -681,9 +681,11 @@ static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
|
||||
return avc_current_has_perm(ssidref, SECCLASS_DOMAIN, DOMAIN__CREATE, NULL);
|
||||
|
||||
/* These have individual XSM hooks and don't make it here. */
|
||||
case XEN_DOMCTL_bind_pt_irq:
|
||||
case XEN_DOMCTL_getdomaininfo:
|
||||
case XEN_DOMCTL_ioport_mapping:
|
||||
case XEN_DOMCTL_memory_mapping:
|
||||
case XEN_DOMCTL_unbind_pt_irq:
|
||||
ASSERT_UNREACHABLE();
|
||||
return -EILSEQ;
|
||||
|
||||
@@ -694,9 +696,6 @@ static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
|
||||
case XEN_DOMCTL_set_target:
|
||||
case XEN_DOMCTL_vm_event_op:
|
||||
|
||||
/* These have individual XSM hooks (arch/../domctl.c) */
|
||||
case XEN_DOMCTL_bind_pt_irq:
|
||||
case XEN_DOMCTL_unbind_pt_irq:
|
||||
#ifdef CONFIG_X86
|
||||
/* These have individual XSM hooks (arch/x86/domctl.c) */
|
||||
case XEN_DOMCTL_shadow_op:
|
||||
|
||||