xen/flask: Wire up missing hypercalls
cover xen/flask: Wire up missing hypercalls
It's been noted by Juergen that recently added XEN_DOMCTL_set_llc_colors is not wired up in FLASK. While preparing a fix, I noticed two other Arm hypercalls from the past that were missing the linking as well. These two are latent bugs while the LLC one is a release blocker for 4.20.
Michal Orzel (3):
xen/flask: Wire up XEN_DOMCTL_vuart_op
xen/flask: Wire up XEN_DOMCTL_dt_overlay
xen/flask: Wire up XEN_DOMCTL_set_llc_colors
tools/flask/policy/modules/dom0.te | 2 +- tools/flask/policy/modules/xen.if | 4 ++-- xen/xsm/flask/hooks.c | 9 +++++++++ xen/xsm/flask/policy/access_vectors | 6 ++++++ 4 files changed, 18 insertions(+), 3 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/3 xen/flask: Wire up XEN_DOMCTL_vuart_op
Addition of FLASK permission for this hypercall was overlooked in the original patch. Fix it. The only VUART operation is initialization that can occur only during domain creation.
--- tools/flask/policy/modules/xen.if | 2 +- xen/xsm/flask/hooks.c | 3 +++ xen/xsm/flask/policy/access_vectors | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-)
tools/flask/policy/modules/xen.if +1 -1
@@ -54,7 +54,7 @@ define(`create_domain_common', ` allow $1 $2:domain2 { set_cpu_policy settsc setscheduler setclaim set_vnumainfo get_vnumainfo cacheflush psr_cmt_op psr_alloc soft_reset - resource_map get_cpu_policy }; + resource_map get_cpu_policy vuart_op }; allow $1 $2:security check_context; allow $1 $2:shadow enable; allow $1 $2:mmu { map_read map_write adjust memorymap physmap pinpage mmuext_op updatemp };
xen/xsm/flask/hooks.c +3 -0
@@ -832,6 +832,9 @@ static int cf_check flask_domctl(struct domain *d, unsigned int cmd,case XEN_DOMCTL_soft_reset:return current_has_perm (d,SECCLASS_DOMAIN2 ,DOMAIN2__SOFT_RESET ); +case XEN_DOMCTL_vuart_op: +return current_has_perm (d,SECCLASS_DOMAIN2 ,DOMAIN2__VUART_OP ); +case XEN_DOMCTL_get_cpu_policy:return current_has_perm (d,SECCLASS_DOMAIN2 ,DOMAIN2__GET_CPU_POLICY );
xen/xsm/flask/policy/access_vectors +2 -0
@@ -251,6 +251,8 @@ class domain2 resource_map # XEN_DOMCTL_get_cpu_policy get_cpu_policy +# XEN_DOMCTL_vuart_op + vuart_op } # Similar to class domain, but primarily contains domctls related to HVM domains
Signature · 1 line
2.25.1
Re: [for-4.20][PATCH 1/3] xen/flask: Wire up XEN_DOMCTL_vuart_op
Quoted 6 lines · Michal Orzel
Addition of FLASK permission for this hypercall was overlooked in the original patch. Fix it. The only VUART operation is initialization that can occur only during domain creation.
Fixes 86039f2e8c20 ("xen/arm: vpl011: Add a new domctl API to initialize vpl011")Signed-off-by Michal Orzel <[email protected]>
PATCH 2/3 xen/flask: Wire up XEN_DOMCTL_dt_overlay
In reply to Michal OrzelAddition 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.
--- 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(-)
tools/flask/policy/modules/dom0.te +1 -1
@@ -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 };
tools/flask/policy/modules/xen.if +1 -1
@@ -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)
xen/xsm/flask/hooks.c +3 -0
@@ -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); }
xen/xsm/flask/policy/access_vectors +2 -0
@@ -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
Signature · 1 line
2.25.1
Re: [for-4.20][PATCH 2/3] xen/flask: Wire up XEN_DOMCTL_dt_overlay
Quoted 7 lines · Michal Orzel
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 <[email protected]>
PATCH 3/3 xen/flask: Wire up XEN_DOMCTL_set_llc_colors
In reply to Michal OrzelAddition of FLASK permission for this hypercall was overlooked in the original patch. Fix it. Setting LLC colors is only possible during domain creation.
--- tools/flask/policy/modules/xen.if | 2 +- xen/xsm/flask/hooks.c | 3 +++ xen/xsm/flask/policy/access_vectors | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-)
tools/flask/policy/modules/xen.if +1 -1
@@ -54,7 +54,7 @@ define(`create_domain_common', ` allow $1 $2:domain2 { set_cpu_policy settsc setscheduler setclaim set_vnumainfo get_vnumainfo cacheflush psr_cmt_op psr_alloc soft_reset - resource_map get_cpu_policy vuart_op }; + resource_map get_cpu_policy vuart_op set_llc_colors }; allow $1 $2:security check_context; allow $1 $2:shadow enable; allow $1 $2:mmu { map_read map_write adjust memorymap physmap pinpage mmuext_op updatemp };
xen/xsm/flask/hooks.c +3 -0
@@ -847,6 +847,9 @@ static int cf_check flask_domctl(struct domain *d, unsigned int cmd,case XEN_DOMCTL_dt_overlay:return current_has_perm (d,SECCLASS_DOMAIN2 ,DOMAIN2__DT_OVERLAY ); +case XEN_DOMCTL_set_llc_colors: +return current_has_perm (d,SECCLASS_DOMAIN2 ,DOMAIN2__SET_LLC_COLORS ); +default :return avc_unknown_permission ("domctl" , cmd); }
xen/xsm/flask/policy/access_vectors +2 -0
@@ -255,6 +255,8 @@ class domain2 vuart_op # XEN_DOMCTL_dt_overlay dt_overlay +# XEN_DOMCTL_set_llc_colors + set_llc_colors } # Similar to class domain, but primarily contains domctls related to HVM domains
Signature · 1 line
2.25.1
Re: [for-4.20][PATCH 3/3] xen/flask: Wire up XEN_DOMCTL_set_llc_colors
Quoted 6 lines · Michal Orzel
Addition of FLASK permission for this hypercall was overlooked in the original patch. Fix it. Setting LLC colors is only possible during domain creation.
Fixes 6985aa5e0c3c ("xen: extend domctl interface for cache coloring")Signed-off-by Michal Orzel <[email protected]>
Hi Michal,
Quoted 4 lines · Michal Orzel
It's been noted by Juergen that recently added
XEN_DOMCTL_set_llc_colorsis not wired up in FLASK. While preparing a fix, I noticed two other Arm hypercalls from the past that were missing the linking as well. These two are latent bugs while the LLC one is a release blocker for 4.20.
Thanks.
~ Oleksii
Quoted 12 lines
Michal Orzel (3):
xen/flask: Wire upXEN_DOMCTL_vuart_op
xen/flask: Wire upXEN_DOMCTL_dt_overlay
xen/flask: Wire upXEN_DOMCTL_set_llc_colorstools/flask/policy/modules/dom0.te | 2 +- tools/flask/policy/modules/xen.if | 4 ++-- xen/xsm/flask/hooks.c | 9 +++++++++ xen/xsm/flask/policy/access_vectors | 6 ++++++ 4 files changed, 18 insertions(+), 3 deletions(-)