x86/pv: Handle the Intel-specific MSR_MISC_ENABLE correctly
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 22 Sep 2020 14:09:36 +0000 (16:09 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 22 Sep 2020 14:09:36 +0000 (16:09 +0200)
This MSR doesn't exist on AMD hardware, and switching away from the safe
functions in the common MSR path was an erroneous change.

Partially revert the change.

This is XSA-333.

Fixes: 4fdc932b3cc ("x86/Intel: drop another 32-bit leftover")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wl@xen.org>
xen/arch/x86/pv/emul-priv-op.c

index 7c21076dd0e486e1590acf86a9b8cd1a0581a2f3..85a9fd47670b079b884e032239365d0c13051cbc 100644 (file)
@@ -913,7 +913,8 @@ static int read_msr(unsigned int reg, uint64_t *val,
         return X86EMUL_OKAY;
 
     case MSR_IA32_MISC_ENABLE:
-        rdmsrl(reg, *val);
+        if ( rdmsr_safe(reg, *val) )
+            break;
         *val = guest_misc_enable(*val);
         return X86EMUL_OKAY;
 
@@ -1053,7 +1054,8 @@ static int write_msr(unsigned int reg, uint64_t val,
         break;
 
     case MSR_IA32_MISC_ENABLE:
-        rdmsrl(reg, temp);
+        if ( rdmsr_safe(reg, temp) )
+            break;
         if ( val != guest_misc_enable(temp) )
             goto invalid;
         return X86EMUL_OKAY;