x86/HVM: don't use confusing/non-suitable XSM checks
PATCH 1/1 x86/HVM: don't use confusing/non-suitable XSM checks
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.
xen/arch/x86/hvm/hvm.c +4 -4
@@ -4748,7 +4748,7 @@ long do_hvm_op(unsigned long op, XEN_GUEif ( 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_GUEif ( !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_GUEif ( !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_GUEif ( !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;
xen/arch/x86/mm/mem_access.c +1 -1
@@ -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;
xen/arch/x86/mm/mem_event.c +1 -1
@@ -449,7 +449,7 @@ int do_mem_event_op(int op, uint32_t domif ( 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;
xen/arch/x86/mm/mem_sharing.c +2 -2
@@ -1358,7 +1358,7 @@ int mem_sharing_memop(struct domain *d,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,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);
xen/include/xsm/dummy.h +8 -2
@@ -495,6 +495,12 @@ static XSM_INLINE int xsm_hvm_param(XSM_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_cont 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); }
xen/include/xsm/xsm.h +6 -0
@@ -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_defreturn 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);
xen/xsm/dummy.c +1 -0
@@ -105,6 +105,7 @@ void xsm_fixup_ops (struct xsm_operationset_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);
xen/xsm/flask/hooks.c +1 -0
@@ -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,
x86/HVM: don't use confusing/non-suitable XSM checks
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.
xen/arch/x86/hvm/hvm.c +4 -4
@@ -4748,7 +4748,7 @@ long do_hvm_op(unsigned long op, XEN_GUEif ( 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_GUEif ( !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_GUEif ( !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_GUEif ( !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;
xen/arch/x86/mm/mem_access.c +1 -1
@@ -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;
xen/arch/x86/mm/mem_event.c +1 -1
@@ -449,7 +449,7 @@ int do_mem_event_op(int op, uint32_t domif ( 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;
xen/arch/x86/mm/mem_sharing.c +2 -2
@@ -1358,7 +1358,7 @@ int mem_sharing_memop(struct domain *d,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,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);
xen/include/xsm/dummy.h +8 -2
@@ -495,6 +495,12 @@ static XSM_INLINE int xsm_hvm_param(XSM_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_cont 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); }
xen/include/xsm/xsm.h +6 -0
@@ -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_defreturn 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);
xen/xsm/dummy.c +1 -0
@@ -105,6 +105,7 @@ void xsm_fixup_ops (struct xsm_operationset_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);
xen/xsm/flask/hooks.c +1 -0
@@ -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,
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 10 lines · Jan Beulich
XSM_TARGETchecks following rcu_lock_{,live_}remote_domain_by_id() are rather pointless and potentially confusing. UseXSM_DM_PRIVthere instead.Note that setting flask_ops.hvm_control to
flask_hvm_param()(instead of introducingflask_hvm_control()is intentional - that function is already separating the contol and non-control sub-operations.Signed-off-by Jan Beulich <[email protected]>
Sharing/access/mem_event bits Reviewed-by: Andres Lagar-Cavilla < [email protected]>
Thanks
Andres
Quoted 163 lines
xen/arch/x86/hvm/hvm.c +4
-4@@ -4748,7 +4748,7 @@ long do_hvm_op(unsigned long op, XEN_GUEif ( 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_GUEif ( !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_GUEif ( !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_GUEif ( !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;xen/arch/x86/mm/mem_access.c +1
-1@@ -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;xen/arch/x86/mm/mem_event.c +1
-1@@ -449,7 +449,7 @@ int do_mem_event_op(int op, uint32_t domif ( 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;xen/arch/x86/mm/mem_sharing.c +2
-2@@ -1358,7 +1358,7 @@ int mem_sharing_memop(struct domain *d,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,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);xen/include/xsm/dummy.h +6
-0@@ -495,6 +495,12 @@ static XSM_INLINE int xsm_hvm_param(XSM_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);xen/include/xsm/dummy.h +2
-2@@ -546,13 +552,13 @@ static XSM_INLINE int xsm_mem_event_cont 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);}
xen/include/xsm/xsm.h +6
-0@@ -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_defreturn 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);xen/xsm/dummy.c +1
-0@@ -105,6 +105,7 @@ void xsm_fixup_ops (struct xsm_operationset_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);xen/xsm/flask/hooks.c +1
-0@@ -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,
Signature · 8 lines
[image: Gridcentric Logo] *Scalable, Efficient, Instant-On Virtualization* ------------------------------ *Andres Lagar-Cavilla* Chief Scientist Phone: 647-778-4380 Email: [email protected]
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 9 lines · Jan Beulich
XSM_TARGETchecks following rcu_lock_{,live_}remote_domain_by_id() are rather pointless and potentially confusing. UseXSM_DM_PRIVthere instead.Note that setting flask_ops.hvm_control to
flask_hvm_param()(instead of introducingflask_hvm_control()is intentional - that function is already separating the contol and non-control sub-operations.Signed-off-by Jan Beulich <[email protected]>
Signature · 2 lines
Daniel De Graaf National Security Agency