x86emul: avoid speculative out of bounds accesses
authorJan Beulich <jbeulich@suse.com>
Thu, 4 Jul 2019 14:05:18 +0000 (16:05 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 4 Jul 2019 14:05:18 +0000 (16:05 +0200)
commit1f2ccbd40c85e383799d59f9dfc1cffa5e18c920
tree164a8c5c4f6bc7f23bf6b5059cd3ba4899701ef1
parent90bef5822dda473055b8aa466450686e3311bf2d
x86emul: avoid speculative out of bounds accesses

There are a few array accesses here the indexes of which are (at least
indirectly) driven by the guest. Use array_access_nospec() to bound
such accesses. In the {,_}decode_gpr() cases replace existing guarding
constructs.

To deal with an otherwise occurring #include cycle, drop the inclusion
of asm/x86_emulate.h from asm/processor.h. This include had been
introduced for obtaining the struct cpuid_leaf declaration, which has
since moved into the x86 helper library.

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/x86_emulate.c
xen/arch/x86/x86_emulate/x86_emulate.c
xen/arch/x86/x86_emulate/x86_emulate.h
xen/include/asm-x86/processor.h