diff --git a/tools/flask/policy/modules/guest_features.te b/tools/flask/policy/modules/guest_features.te index d00769e1d21b..ca52257ca4a8 100644 --- a/tools/flask/policy/modules/guest_features.te +++ b/tools/flask/policy/modules/guest_features.te @@ -6,10 +6,11 @@ allow domain_type xen_t:xen tmem_op; allow domain_type xen_t:xen2 pmu_use; # Allow all domains: -# to register single-sender (unicast) rings to partner with any domain; and -# to register any-sender (wildcard) rings that can be sent to by any domain. +# to register single-sender (unicast) rings to partner with any domain; +# to register any-sender (wildcard) rings that can be sent to by any domain; +# and send messages to rings. allow domain_type xen_t:argo { register_any_source }; -allow domain_type domain_type:argo { register_single_source }; +allow domain_type domain_type:argo { send register_single_source }; # Allow guest console output to the serial console. This is used by PV Linux # and stub domains for early boot output, so don't audit even when we deny it. diff --git a/xen/common/argo.c b/xen/common/argo.c index a4c4bfcc5fde..64fc711b2b67 100644 --- a/xen/common/argo.c +++ b/xen/common/argo.c @@ -1943,6 +1943,14 @@ sendv(struct domain *src_d, const xen_argo_addr_t *src_addr, goto out_unlock; } + ret = xsm_argo_send(src_d, dst_d); + if ( ret ) + { + gprintk(XENLOG_ERR, "argo: XSM REJECTED %i -> %i\n", + src_addr->domain_id, dst_addr->domain_id); + goto out_unlock; + } + read_lock(&dst_d->argo->rings_L2_rwlock); ring_info = find_ring_info_by_match(dst_d, dst_addr->aport, diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index 96118aa0caa7..7daf1f0b277a 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -732,6 +732,12 @@ static XSM_INLINE int xsm_argo_register_any_source(struct domain *d) return 0; } +static XSM_INLINE int xsm_argo_send(const struct domain *d, + const struct domain *t) +{ + return 0; +} + #endif /* CONFIG_ARGO */ #include diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h index e32a6453a79e..7c69efe9c18c 100644 --- a/xen/include/xsm/xsm.h +++ b/xen/include/xsm/xsm.h @@ -185,6 +185,7 @@ struct xsm_operations { int (*argo_register_single_source) (const struct domain *d, const struct domain *t); int (*argo_register_any_source) (const struct domain *d); + int (*argo_send) (const struct domain *d, const struct domain *t); #endif }; @@ -715,6 +716,11 @@ static inline xsm_argo_register_any_source(const struct domain *d) return xsm_ops->argo_register_any_source(d); } +static inline int xsm_argo_send(const struct domain *d, const struct domain *t) +{ + return xsm_ops->argo_send(d, t); +} + #endif /* CONFIG_ARGO */ #endif /* XSM_NO_WRAPPERS */ diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c index ed236b09b326..ffac774126ec 100644 --- a/xen/xsm/dummy.c +++ b/xen/xsm/dummy.c @@ -155,5 +155,6 @@ void __init xsm_fixup_ops (struct xsm_operations *ops) #ifdef CONFIG_ARGO set_to_dummy_if_null(ops, argo_register_single_source); set_to_dummy_if_null(ops, argo_register_any_source); + set_to_dummy_if_null(ops, argo_send); #endif } diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c index fcb74871d92a..76c012c6e798 100644 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -1732,6 +1732,12 @@ static int flask_argo_register_any_source(const struct domain *d) return avc_has_perm(domain_sid(d), SECINITSID_XEN, SECCLASS_ARGO, ARGO__REGISTER_ANY_SOURCE, NULL); } + +static int flask_argo_send(const struct domain *d, const struct domain *t) +{ + return domain_has_perm(d, t, SECCLASS_ARGO, ARGO__SEND); +} + #endif long do_flask_op(XEN_GUEST_HANDLE_PARAM(xsm_op_t) u_flask_op); @@ -1871,6 +1877,7 @@ static struct xsm_operations flask_ops = { #ifdef CONFIG_ARGO .argo_register_single_source = flask_argo_register_single_source, .argo_register_any_source = flask_argo_register_any_source, + .argo_send = flask_argo_send, #endif }; diff --git a/xen/xsm/flask/policy/access_vectors b/xen/xsm/flask/policy/access_vectors index fb95c9741853..f6c53770608d 100644 --- a/xen/xsm/flask/policy/access_vectors +++ b/xen/xsm/flask/policy/access_vectors @@ -541,4 +541,6 @@ class argo # Domain requesting registration of a communication ring # to receive messages from any other domain. register_any_source + # Domain sending a message to another domain. + send }