aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/tmem_xen.h
diff options
context:
space:
mode:
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>2013-01-11 10:46:43 +0000
committerDaniel De Graaf <dgdegra@tycho.nsa.gov>2013-01-11 10:46:43 +0000
commita655abfd8a4bf03de9c9a8d820125be8323d64f8 (patch)
treed88e4bae8739dce5e0fd4e5c030a1dd6b8ddb2b0 /xen/include/xen/tmem_xen.h
parent0d7f18b01f69c6b89aa3654bd2b11e24f41aaf71 (diff)
downloadxen-a655abfd8a4bf03de9c9a8d820125be8323d64f8.tar.gz
xen-a655abfd8a4bf03de9c9a8d820125be8323d64f8.tar.bz2
xen-a655abfd8a4bf03de9c9a8d820125be8323d64f8.zip
tmem: add XSM hooks
This adds a pair of XSM hooks for tmem operations: xsm_tmem_op which controls any use of tmem, and xsm_tmem_control which allows use of the TMEM_CONTROL operations. By default, all domains can use tmem while only IS_PRIV domains can use control operations. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com> Committed-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/include/xen/tmem_xen.h')
-rw-r--r--xen/include/xen/tmem_xen.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/xen/include/xen/tmem_xen.h b/xen/include/xen/tmem_xen.h
index 36a8d9f9ed..ad1ddd5605 100644
--- a/xen/include/xen/tmem_xen.h
+++ b/xen/include/xen/tmem_xen.h
@@ -16,6 +16,7 @@
#include <xen/guest_access.h> /* copy_from_guest */
#include <xen/hash.h> /* hash_long */
#include <xen/domain_page.h> /* __map_domain_page */
+#include <xsm/xsm.h> /* xsm_tmem_control */
#include <public/tmem.h>
#ifdef CONFIG_COMPAT
#include <compat/tmem.h>
@@ -326,9 +327,14 @@ static inline bool_t tmh_set_client_from_id(
return rc;
}
+static inline bool_t tmh_current_permitted(void)
+{
+ return !xsm_tmem_op(XSM_HOOK);
+}
+
static inline bool_t tmh_current_is_privileged(void)
{
- return IS_PRIV(current->domain);
+ return !xsm_tmem_control(XSM_PRIV);
}
static inline uint8_t tmh_get_first_byte(pfp_t *pfp)