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 15:56:46 +0000 (16:56 +0100)
commit2a8a8e99feb950504559196521bc9fd63ed3a962
treed07d384cf857b862df51ac9a877567919e10cb91
parent9a5c16a3e75778c8a094ca87784d93b74676f46c
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>
xen/arch/x86/cpu/vpmu_intel.c
xen/arch/x86/hvm/vmx/vmx.c