x86/vMSI: avoid speculative out of bounds accesses
authorJan Beulich <jbeulich@suse.com>
Thu, 4 Jul 2019 14:06:27 +0000 (16:06 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 4 Jul 2019 14:06:27 +0000 (16:06 +0200)
commitbe15c231e7e351ea8dbcabf62f952537c637343d
tree401e14f5cd750abf59d37d76c7d92826b088ae56
parent1f2ccbd40c85e383799d59f9dfc1cffa5e18c920
x86/vMSI: avoid speculative out of bounds accesses

Array indexes used in the MMIO read/write emulation functions are
derived from guest controlled values. Restrict their ranges to limit the
side effects of speculative execution.

Note that the index into .msi_ad[] may also be speculatively out of
bounds, by exactly one (indexes 0...3 are possible while the array has
just 3 elements). This is not a problem with the current data layout, as
such overrun of the array would either touch the next element of the
parent array or (for the last entry of the parent array) access the
subsequent acc_valid bit array.

This is part of the speculative hardening effort.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/hvm/vmsi.c