The params array in hvm can be accessed with get and set functions.
As the index is guest controlled, make sure no out-of-bound accesses
can be performed.
As we cannot influence how future compilers might modify the
instructions that enforce the bounds, we furthermore block speculation,
so that the update is visible in the architectural state.
This is part of the speculative hardening effort.
Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
Acked-by: Jan Beulich <jbeulich@suse.com>
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 ( 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;