nvmx: implement support for MSR bitmaps
authorRoger Pau Monné <roger.pau@citrix.com>
Tue, 18 Feb 2020 15:27:07 +0000 (16:27 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 18 Feb 2020 15:27:07 +0000 (16:27 +0100)
commitc47984aabead53918e5ba6d43cdb3f1467452739
treee7b19dd823c6b28551d8a3db31c13dc38ecd4e07
parentb3841d991dea4faf0799195313bc33f372af565c
nvmx: implement support for MSR bitmaps

Current implementation of nested VMX has a half baked handling of MSR
bitmaps for the L1 VMM: it maps the L1 VMM provided MSR bitmap, but
doesn't actually load it into the nested vmcs, and thus the nested
guest vmcs ends up using the same MSR bitmap as the L1 VMM.

This is wrong as there's no assurance that the set of features enabled
for the L1 vmcs are the same that L1 itself is going to use in the
nested vmcs, and thus can lead to misconfigurations.

For example L1 vmcs can use x2APIC virtualization and virtual
interrupt delivery, and thus some x2APIC MSRs won't be trapped so that
they can be handled directly by the hardware using virtualization
extensions. On the other hand, the nested vmcs created by L1 VMM might
not use any of such features, so using a MSR bitmap that doesn't trap
accesses to the x2APIC MSRs will be leaking them to the underlying
hardware.

Fix this by crafting a merged MSR bitmap between the one used by L1
and the nested guest.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
xen/arch/x86/hvm/vmx/vvmx.c
xen/include/asm-x86/hvm/vmx/vvmx.h