]> xenbits.xensource.com Git - xen.git/commitdiff
x86/HVM: don't use confusing/non-suitable XSM checks
authorJan Beulich <jbeulich@suse.com>
Tue, 20 May 2014 13:56:48 +0000 (15:56 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 20 May 2014 13:56:48 +0000 (15:56 +0200)
XSM_TARGET checks following rcu_lock_{,live_}remote_domain_by_id() are
rather pointless and potentially confusing. Use XSM_DM_PRIV there
instead.

Note that setting flask_ops.hvm_control to flask_hvm_param() (instead
of introducing flask_hvm_control() is intentional - that function is
already separating the contol and non-control sub-operations.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
xen/arch/x86/hvm/hvm.c
xen/arch/x86/mm/mem_access.c
xen/arch/x86/mm/mem_event.c
xen/arch/x86/mm/mem_sharing.c
xen/include/xsm/dummy.h
xen/include/xsm/xsm.h
xen/xsm/dummy.c
xen/xsm/flask/hooks.c

index d2190be19e93680cf81b5679b29822d2af834ba3..efbf6d937a2fcce037c5bbc2ec1c851ff4c9b99b 100644 (file)
@@ -4748,7 +4748,7 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( a.nr > GB(1) >> PAGE_SHIFT )
             goto param_fail2;
 
-        rc = xsm_hvm_param(XSM_TARGET, d, op);
+        rc = xsm_hvm_control(XSM_DM_PRIV, d, op);
         if ( rc )
             goto param_fail2;
 
@@ -4786,7 +4786,7 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( !is_hvm_domain(d) )
             goto param_fail3;
 
-        rc = xsm_hvm_param(XSM_TARGET, d, op);
+        rc = xsm_hvm_control(XSM_DM_PRIV, d, op);
         if ( rc )
             goto param_fail3;
 
@@ -4896,7 +4896,7 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( !is_hvm_domain(d) )
             goto param_fail4;
 
-        rc = xsm_hvm_param(XSM_TARGET, d, op);
+        rc = xsm_hvm_control(XSM_DM_PRIV, d, op);
         if ( rc )
             goto param_fail4;
 
@@ -5026,7 +5026,7 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( !is_hvm_domain(d) )
             goto param_fail8;
 
-        rc = xsm_hvm_param(XSM_TARGET, d, op);
+        rc = xsm_hvm_control(XSM_DM_PRIV, d, op);
         if ( rc )
             goto param_fail8;
 
index 462c3181bc16df45cbedd7ad4e1f05a8051f646e..e8465a5776953846ee190afa0d07eefaadf13fc2 100644 (file)
@@ -47,7 +47,7 @@ int mem_access_memop(unsigned long cmd,
     if ( !is_hvm_domain(d) )
         goto out;
 
-    rc = xsm_mem_event_op(XSM_TARGET, d, XENMEM_access_op);
+    rc = xsm_mem_event_op(XSM_DM_PRIV, d, XENMEM_access_op);
     if ( rc )
         goto out;
 
index 36b9dba16b33b5ec6c9960d1ea4dd58446b3bd98..f84c383870fce07b0049c4dce5bedf09488d5dab 100644 (file)
@@ -449,7 +449,7 @@ int do_mem_event_op(int op, uint32_t domain, void *arg)
     if ( ret )
         return ret;
 
-    ret = xsm_mem_event_op(XSM_TARGET, d, op);
+    ret = xsm_mem_event_op(XSM_DM_PRIV, d, op);
     if ( ret )
         goto out;
 
index 178fe688b7645444b942540eb3e81174544f7bc2..7293f319cba25cd2ea65e8de150b20c0a303748f 100644 (file)
@@ -1358,7 +1358,7 @@ int mem_sharing_memop(struct domain *d, xen_mem_sharing_op_t *mec)
             if ( rc )
                 return rc;
 
-            rc = xsm_mem_sharing_op(XSM_TARGET, d, cd, mec->op);
+            rc = xsm_mem_sharing_op(XSM_DM_PRIV, d, cd, mec->op);
             if ( rc )
             {
                 rcu_unlock_domain(cd);
@@ -1422,7 +1422,7 @@ int mem_sharing_memop(struct domain *d, xen_mem_sharing_op_t *mec)
             if ( rc )
                 return rc;
 
-            rc = xsm_mem_sharing_op(XSM_TARGET, d, cd, mec->op);
+            rc = xsm_mem_sharing_op(XSM_DM_PRIV, d, cd, mec->op);
             if ( rc )
             {
                 rcu_unlock_domain(cd);
index 5de4ad4ed3aa085dae5e7d6bba7eccdf7bd8bdb9..3d4067f43900b669f8a1a07b8c62a71a4a6eb559 100644 (file)
@@ -495,6 +495,12 @@ static XSM_INLINE int xsm_hvm_param(XSM_DEFAULT_ARG struct domain *d, unsigned l
     return xsm_default_action(action, current->domain, d);
 }
 
+static XSM_INLINE int xsm_hvm_control(XSM_DEFAULT_ARG struct domain *d, unsigned long op)
+{
+    XSM_ASSERT_ACTION(XSM_DM_PRIV);
+    return xsm_default_action(action, current->domain, d);
+}
+
 static XSM_INLINE int xsm_hvm_param_nested(XSM_DEFAULT_ARG struct domain *d)
 {
     XSM_ASSERT_ACTION(XSM_PRIV);
@@ -546,13 +552,13 @@ static XSM_INLINE int xsm_mem_event_control(XSM_DEFAULT_ARG struct domain *d, in
 
 static XSM_INLINE int xsm_mem_event_op(XSM_DEFAULT_ARG struct domain *d, int op)
 {
-    XSM_ASSERT_ACTION(XSM_TARGET);
+    XSM_ASSERT_ACTION(XSM_DM_PRIV);
     return xsm_default_action(action, current->domain, d);
 }
 
 static XSM_INLINE int xsm_mem_sharing_op(XSM_DEFAULT_ARG struct domain *d, struct domain *cd, int op)
 {
-    XSM_ASSERT_ACTION(XSM_TARGET);
+    XSM_ASSERT_ACTION(XSM_DM_PRIV);
     return xsm_default_action(action, current->domain, cd);
 }
 
index 0c85ca6c17d82f6238d1e32f9c0f46c1e3d667d4..4799b08f89b3f288d3607e8cf752e1ffa16b6da3 100644 (file)
@@ -137,6 +137,7 @@ struct xsm_operations {
 #endif
 
     int (*hvm_param) (struct domain *d, unsigned long op);
+    int (*hvm_control) (struct domain *d, unsigned long op);
     int (*hvm_param_nested) (struct domain *d);
 
 #ifdef CONFIG_X86
@@ -522,6 +523,11 @@ static inline int xsm_hvm_param (xsm_default_t def, struct domain *d, unsigned l
     return xsm_ops->hvm_param(d, op);
 }
 
+static inline int xsm_hvm_control(xsm_default_t def, struct domain *d, unsigned long op)
+{
+    return xsm_ops->hvm_control(d, op);
+}
+
 static inline int xsm_hvm_param_nested (xsm_default_t def, struct domain *d)
 {
     return xsm_ops->hvm_param_nested(d);
index 80015b17602cb81c258852b3c289f15aa3d025cd..67bce4b50803a622991e7026892698f44ff375c3 100644 (file)
@@ -105,6 +105,7 @@ void xsm_fixup_ops (struct xsm_operations *ops)
     set_to_dummy_if_null(ops, tmem_op);
     set_to_dummy_if_null(ops, tmem_control);
     set_to_dummy_if_null(ops, hvm_param);
+    set_to_dummy_if_null(ops, hvm_control);
     set_to_dummy_if_null(ops, hvm_param_nested);
 
     set_to_dummy_if_null(ops, do_xsm_op);
index 3eb6c1e6fb76bd053cf2b5077dd79c2dbc081613..c0083986186fbb6c4983361fc0eb565cb8fbecab 100644 (file)
@@ -1543,6 +1543,7 @@ static struct xsm_operations flask_ops = {
     .tmem_op = flask_tmem_op,
     .tmem_control = flask_tmem_control,
     .hvm_param = flask_hvm_param,
+    .hvm_control = flask_hvm_param,
     .hvm_param_nested = flask_hvm_param_nested,
 
     .do_xsm_op = do_flask_op,