]> xenbits.xensource.com Git - xen.git/commit
XSM/domctl: Fix permission checks on XEN_DOMCTL_createdomain
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 8 Aug 2024 11:51:09 +0000 (13:51 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 8 Aug 2024 11:51:09 +0000 (13:51 +0200)
commit98fda0718f79c44e5753e7ef481ca61c8361e234
tree831be3e8af6a3d8b9bb37ffe1a1ff6bf88ec416b
parentb3fc8ffcca50d5a52130734f8a037a580b7c9500
XSM/domctl: Fix permission checks on XEN_DOMCTL_createdomain

The XSM checks for XEN_DOMCTL_createdomain are problematic.  There's a split
between xsm_domctl() called early, and flask_domain_create() called quite late
during domain construction.

All XSM implementations except Flask have a simple IS_PRIV check in
xsm_domctl(), and operate as expected when an unprivileged domain tries to
make a hypercall.

Flask however foregoes any action in xsm_domctl() and defers everything,
including the simple "is the caller permitted to create a domain" check, to
flask_domain_create().

As a consequence, when XSM Flask is active, and irrespective of the policy
loaded, all domains irrespective of privilege can:

 * Mutate the global 'rover' variable, used to track the next free domid.
   Therefore, all domains can cause a domid wraparound, and combined with a
   voluntary reboot, choose their own domid.

 * Cause a reasonable amount of a domain to be constructed before ultimately
   failing for permission reasons, including the use of settings outside of
   supported limits.

In order to remediate this, pass the ssidref into xsm_domctl() and at least
check that the calling domain privileged enough to create domains.

Take the opportunity to also fix the sign of the cmd parameter to be unsigned.

This issue has not been assigned an XSA, because Flask is experimental and not
security supported.

Reported-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
master commit: ee32b9b29af449d38aad0a1b3a81aaae586f5ea7
master date: 2024-07-30 17:42:17 +0100
xen/arch/x86/mm/paging.c
xen/common/domctl.c
xen/include/xsm/dummy.h
xen/include/xsm/xsm.h
xen/xsm/flask/hooks.c