uint32_t index,
uint64_t new_value)
{
- uint64_t value = d->arch.hvm.params[index];
+ uint64_t value;
int rc;
rc = xsm_hvm_param(XSM_TARGET, d, HVMOP_set_param);
if ( rc )
return rc;
+ /* Make sure we evaluate permissions before loading data of domains. */
+ block_speculation();
+
+ value = d->arch.hvm.params[index];
switch ( index )
{
/* The following parameters should only be changed once. */
struct vcpu *v;
int rc;
- if ( index >= HVM_NR_PARAMS )
- return -EINVAL;
-
rc = hvm_allow_set_param(d, index, value);
if ( rc )
return rc;
+ /* Make sure we evaluate permissions before loading data of domains. */
+ block_speculation();
+
switch ( index )
{
case HVM_PARAM_CALLBACK_IRQ:
return rc;
}
-int hvmop_set_param(
+static int hvmop_set_param(
XEN_GUEST_HANDLE_PARAM(xen_hvm_param_t) arg)
{
struct xen_hvm_param a;
if ( a.index >= HVM_NR_PARAMS )
return -EINVAL;
- /* Make sure the above bound check is not bypassed during speculation. */
- block_speculation();
-
d = rcu_lock_domain_by_any_id(a.domid);
if ( d == NULL )
return -ESRCH;
if ( rc )
return rc;
+ /* Make sure the above domain permissions check is respected. */
+ block_speculation();
+
switch ( index )
{
case HVM_PARAM_ACPI_S_STATE:
if ( a.index >= HVM_NR_PARAMS )
return -EINVAL;
- /* Make sure the above bound check is not bypassed during speculation. */
- block_speculation();
-
d = rcu_lock_domain_by_any_id(a.domid);
if ( d == NULL )
return -ESRCH;