[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[for-4.20][PATCH 2/3] xen/flask: Wire up XEN_DOMCTL_dt_overlay


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Tue, 7 Jan 2025 10:27:18 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=70MCCoZKVTF+PJ0//NYA+xBhWbE0DzeYXdUvfh/3Myg=; b=zJFbMUNKwsMvrQHeteHLsYR4b60q/r7EURIOPdWiUWfTEZqkdmEA/g2SF9XifS8a0/HJGxEi5K7WCYb6nwXItAnk0Z5HLUgnwRi0GB749tvIaqUuV+8AqCgc5FGLhbW1aAULrniG6qf2aYIROW7WRacTuOKMlttbIDHgdMdVbrktmH+0X33Mndq3HbKQgXLLbfRMTNehEvvqurFCCZ+rQn8TzmPZrk7PHX8DlEuEgMRvl39cZiip9VEYrUqbJCsJMOzv2efEnwqFGdSE8hUzOVgITGbuz5qjCzQ/NQjL3IbG0aa/8XGuLasa/pHnGhpDy7M2eo+kcSsF4tToYj1zrw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SXpJhHZ5Aa7nEUxxcttXY9P8C7Y6SzPiDE64Mv8li7JmV82VR6jV67qVC7qjZAy+xvYBQrqEGfLRMC2tnFrPlSPp/22Ti00Qjk6zKhy/o2gGt7myrSGNjuEFs9IGItRUGz4QILKCWSvY0NWaMt4bAkxUWFgaH3O3wqbaImP+1CRIWhT275sCSxKeV+xpU/VFSSqPrHhWAkuSoum0tW1ysgOPOldnX/DWko28PnT9Xm6B+lK/Ub1CZ4yDNXH+HAB62AzYQzv/NIkrrSZfVmYV+byumFOpcLD78VgNYxChU6YYhJh0yF987SL0s+mvCu9oA4eupi/4ohFCbHGcrdtD6A==
  • Cc: Michal Orzel <michal.orzel@xxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, <oleksii.kurochko@xxxxxxxxx>
  • Delivery-date: Tue, 07 Jan 2025 09:27:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Addition of FLASK permission for this hypercall was overlooked in the
original patch. Fix it. The only dt overlay operation is attaching that can
happen only after the domain is created. Dom0 can attach overlay to itself
as well.

Fixes: 4c733873b5c2 ("xen/arm: Add XEN_DOMCTL_dt_overlay and device attachment 
to domains")
Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 tools/flask/policy/modules/dom0.te  | 2 +-
 tools/flask/policy/modules/xen.if   | 2 +-
 xen/xsm/flask/hooks.c               | 3 +++
 xen/xsm/flask/policy/access_vectors | 2 ++
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/flask/policy/modules/dom0.te 
b/tools/flask/policy/modules/dom0.te
index 16b8c9646d1b..f148bfbf274e 100644
--- a/tools/flask/policy/modules/dom0.te
+++ b/tools/flask/policy/modules/dom0.te
@@ -40,7 +40,7 @@ allow dom0_t dom0_t:domain {
 };
 allow dom0_t dom0_t:domain2 {
        set_cpu_policy gettsc settsc setscheduler set_vnumainfo
-       get_vnumainfo psr_cmt_op psr_alloc get_cpu_policy
+       get_vnumainfo psr_cmt_op psr_alloc get_cpu_policy dt_overlay
 };
 allow dom0_t dom0_t:resource { add remove };
 
diff --git a/tools/flask/policy/modules/xen.if 
b/tools/flask/policy/modules/xen.if
index ba9e91d30201..def60da88301 100644
--- a/tools/flask/policy/modules/xen.if
+++ b/tools/flask/policy/modules/xen.if
@@ -94,7 +94,7 @@ define(`manage_domain', `
                        getaddrsize pause unpause trigger shutdown destroy
                        setaffinity setdomainmaxmem getscheduler resume
                        setpodtarget getpodtarget getpagingmempool 
setpagingmempool };
-    allow $1 $2:domain2 set_vnumainfo;
+    allow $1 $2:domain2 { set_vnumainfo dt_overlay };
 ')
 
 # migrate_domain_out(priv, target)
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 5118f86cf030..e263e745d441 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -844,6 +844,9 @@ static int cf_check flask_domctl(struct domain *d, unsigned 
int cmd,
     case XEN_DOMCTL_set_paging_mempool_size:
         return current_has_perm(d, SECCLASS_DOMAIN, DOMAIN__SETPAGINGMEMPOOL);
 
+    case XEN_DOMCTL_dt_overlay:
+        return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__DT_OVERLAY);
+
     default:
         return avc_unknown_permission("domctl", cmd);
     }
diff --git a/xen/xsm/flask/policy/access_vectors 
b/xen/xsm/flask/policy/access_vectors
index 7cbdb7ea6408..78fe37583b18 100644
--- a/xen/xsm/flask/policy/access_vectors
+++ b/xen/xsm/flask/policy/access_vectors
@@ -253,6 +253,8 @@ class domain2
     get_cpu_policy
 # XEN_DOMCTL_vuart_op
     vuart_op
+# XEN_DOMCTL_dt_overlay
+    dt_overlay
 }
 
 # Similar to class domain, but primarily contains domctls related to HVM 
domains
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.