[PATCH 20/23] xsm/silo: Support hwdom/control domains

Jason Andryuk posted 23 patches 3 days ago
[PATCH 20/23] xsm/silo: Support hwdom/control domains
Posted by Jason Andryuk 3 days ago
The is_control_domain() check is not sufficient for a split
hardware/control domain.  Add is_priv_domain() to support allowing for
either control or hardware.

Without this, a xenstore/hardware domain is unable to map a domU's
grants.

This silo check is for grants, events and argo.  The dummy policy
handles other calls, so hardware is prevented from foreign mapping
control's memory with that.

This would need to be expanded for a standalone Xenstore domain.

Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/xsm/silo.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/xsm/silo.c b/xen/xsm/silo.c
index b89b364287..d5e1a554ea 100644
--- a/xen/xsm/silo.c
+++ b/xen/xsm/silo.c
@@ -20,6 +20,11 @@
 #define XSM_NO_WRAPPERS
 #include <xsm/dummy.h>
 
+static always_inline bool is_priv_domain(const struct domain *d)
+{
+    return is_control_domain(d) || is_hardware_domain(d);
+}
+
 /*
  * Check if inter-domain communication is allowed.
  * Return true when pass check.
@@ -29,8 +34,8 @@ static bool silo_mode_dom_check(const struct domain *ldom,
 {
     const struct domain *currd = current->domain;
 
-    return (is_control_domain(currd) || is_control_domain(ldom) ||
-            is_control_domain(rdom) || ldom == rdom);
+    return (is_priv_domain(currd) || is_priv_domain(ldom) ||
+            is_priv_domain(rdom) || ldom == rdom);
 }
 
 static int cf_check silo_evtchn_unbound(
-- 
2.48.1