x86/hvm: refactor set param
authorNorbert Manthey <nmanthey@amazon.de>
Fri, 19 Feb 2021 16:24:03 +0000 (17:24 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 19 Feb 2021 16:24:03 +0000 (17:24 +0100)
commit336fbbdf61562e5ae1112f24bc90c1164adf2144
tree2055c23cfdf4b71e48f594834b00dc1bfe938c76
parent76aff7f6336b0ce19559700717537449972531be
x86/hvm: refactor set param

To prevent leaking HVM params via L1TF and similar issues on a
hyperthread pair, let's load values of domains only after performing all
relevant checks, and blocking speculative execution.

For both get and set, the value of the index is already checked in the
outer calling function. The block_speculation calls in hvmop_get_param
and hvmop_set_param are removed, because is_hvm_domain already blocks
speculation.

Furthermore, speculative barriers are re-arranged to make sure we do not
allow guests running on co-located VCPUs to leak hvm parameter values of
other domains.

To improve symmetry between the get and set operations, function
hvmop_set_param is made static.

This is part of the speculative hardening effort.

Reported-by: Hongyan Xia <hongyxia@amazon.co.uk>
Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
xen/arch/x86/hvm/hvm.c