diff mbox series

[v2] x86/msr: don't inject #GP when trying to read FEATURE_CONTROL

Message ID 20201229165801.89974-1-roger.pau@citrix.com (mailing list archive)
State New
Headers show
Series [v2] x86/msr: don't inject #GP when trying to read FEATURE_CONTROL | expand

Commit Message

Roger Pau Monné Dec. 29, 2020, 4:58 p.m. UTC
Windows 10 will triple fault if #GP is injected when attempting to
read the FEATURE_CONTROL MSR on Intel or compatible hardware. Fix this
by injecting a #GP only when the vendor doesn't support the MSR, even
if there are no features to expose.

Fixes: 39ab598c50a2 ('x86/pv: allow reading FEATURE_CONTROL MSR')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Changes since v1:
 - Allow Shanghai CPUs to access FEATURE_CONTROL without #GP.
 xen/arch/x86/msr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series


diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index be8e363862..6dfd3d5f97 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -176,7 +176,8 @@  int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     switch ( msr )
-        if ( !cp->basic.vmx && !vmce_has_lmce(v) )
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR |
+                                 X86_VENDOR_SHANGHAI)) )
             goto gp_fault;
         *val = IA32_FEATURE_CONTROL_LOCK;