x86/vioapic: block speculative out-of-bound accesses
authorNorbert Manthey <nmanthey@amazon.de>
Tue, 26 Feb 2019 15:57:56 +0000 (16:57 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 26 Feb 2019 15:57:56 +0000 (16:57 +0100)
commit346e7d0f4b2179b9e0b09f4ebc98cbb3aae39a2c
tree5544ff70a5966c9305e2884a5d63ddd6d82cea80
parent443d3ab6daee9bf77ec1cb2ea7e252fb0ce616a8
x86/vioapic: block speculative out-of-bound accesses

When interacting with io apic, a guest can specify values that are used
as index to structures, and whose values are not compared against
upper bounds to prevent speculative out-of-bound accesses. This change
prevents these speculative accesses.

Furthermore, variables are initialized and the compiler is asked to not
optimized these initializations, as the uninitialized variables might be
used in a speculative out-of-bound access. Out of the four initialized
variables, two are potentially problematic, namely ones in the functions
vioapic_irq_positive_edge and vioapic_get_trigger_mode.

As the two problematic variables are both used in the common function
gsi_vioapic, the mitigation is implemented there. As the access pattern
of the currently non-guest-controlled functions might change in the
future as well, the other variables are initialized as well.

This is part of the speculative hardening effort.

Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/hvm/vioapic.c