x86/vtx: Fix the checking for unknown/invalid MSR_DEBUGCTL bits
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 13 Aug 2018 16:26:21 +0000 (17:26 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 14 Aug 2018 16:03:33 +0000 (17:03 +0100)
commit48fb482ef695c6b193ccfca665e6dd302eb230e2
treed895e522998e0f6c7f3c62976db3ce04a97edd8d
parentfa79f9e762be390b56218437ed317a695a03a5e7
x86/vtx: Fix the checking for unknown/invalid MSR_DEBUGCTL bits

The VPMU_MODE_OFF early-exit in vpmu_do_wrmsr() introduced by c/s
11fe998e56 bypasses all reserved bit checking in the general case.  As a
result, a guest can enable BTS when it shouldn't be permitted to, and
lock up the entire host.

With vPMU active (not a security supported configuration, but useful for
debugging), the reserved bit checking in broken, caused by the original
BTS changeset 1a8aa75ed.

From a correctness standpoint, it is not possible to have two different
pieces of code responsible for different parts of value checking, if
there isn't an accumulation of bits which have been checked.  A
practical upshot of this is that a guest can set any value it
wishes (usually resulting in a vmentry failure for bad guest state).

Therefore, fix this by implementing all the reserved bit checking in the
main MSR_DEBUGCTL block, and removing all handling of DEBUGCTL from the
vPMU MSR logic.

This is XSA-269.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
(cherry picked from commit 2a8a8e99feb950504559196521bc9fd63ed3a962)
xen/arch/x86/cpu/vpmu_intel.c
xen/arch/x86/hvm/vmx/vmx.c