Skip to contentSkip to conversation

amend "x86/spec-ctrl: CPUID/MSR definitions for L1D_FLUSH"

PATCH In review Jan Beulich 2 participants 3 messages Aug 15, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 amend "x86/spec-ctrl: CPUID/MSR definitions for L1D_FLUSH"

This is part of XSA-273 / CVE-2018-3646.

tools/libxc/xc_cpufeature.h +1 -0
@@ -147,6 +147,7 @@
 /* Intel-defined CPU features, CPUID level 0x00000007:0 (edx) */
 #define X86_FEATURE_IBRSB       26 /* IBRS and IBPB support (used by Intel) */
 #define X86_FEATURE_STIBP       27 /* STIBP */
+#define X86_FEATURE_L1D_FLUSH   28 /* MSR_FLUSH_CMD and L1D flush. */
 #define X86_FEATURE_SSBD        31 /* MSR_SPEC_CTRL.SSBD available */
 
 #endif /* __LIBXC_CPUFEATURE_H */
tools/libxc/xc_cpuid_x86.c +1 -0
@@ -370,6 +370,7 @@ static void xc_cpuid_hvm_policy(
                         bitmaskof(X86_FEATURE_FSGSBASE));
             regs[3] &= (bitmaskof(X86_FEATURE_IBRSB) |
                         bitmaskof(X86_FEATURE_STIBP) |
+                        bitmaskof(X86_FEATURE_L1D_FLUSH) |
                         bitmaskof(X86_FEATURE_SSBD));
         } else
             regs[1] = regs[3] = 0;
xen/arch/x86/hvm/hvm.c +2 -0
@@ -4627,6 +4627,8 @@ void hvm_cpuid(unsigned int input, unsig
             if ( !boot_cpu_has(X86_FEATURE_SC_MSR_HVM) )
                 *edx &= ~(cpufeat_mask(X86_FEATURE_IBRSB) |
                           cpufeat_mask(X86_FEATURE_SSBD));
+            if ( !boot_cpu_has(X86_FEATURE_L1D_FLUSH) )
+                *edx &= ~cpufeat_mask(X86_FEATURE_L1D_FLUSH);
 
             /*
              * Override STIBP to match IBRS.  Guests can safely use STIBP
xen/arch/x86/traps.c +1 -0
@@ -882,6 +882,7 @@ void pv_cpuid(struct cpu_user_regs *regs
                 if ( !boot_cpu_has(X86_FEATURE_SC_MSR_PV) )
                     d &= ~(cpufeat_mask(X86_FEATURE_IBRSB) |
                            cpufeat_mask(X86_FEATURE_SSBD));
+                d &= ~cpufeat_mask(X86_FEATURE_L1D_FLUSH);
 
                 /*
                  * Override STIBP to match IBRS.  Guests can safely use STIBP

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Jan Beulich

This is part of XSA-273 / CVE-2018-3646.

Oops yes.

This isn't strictly needed for security, as L1D Flush is only needed by hypervisors, but its definitely odd to have it missing from 4.6.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 15.08.18 at 09:57, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich

This is part of XSA-273 / CVE-2018-3646.

Quoted 8 lines
Quoted 1 line

Oops yes.

This isn't strictly needed for security, as L1D Flush is only needed by hypervisors, but its definitely odd to have it missing from 4.6.

Right. There are two issues with this patch though: For one I've left a libxl hunk in which was not in fact missing from the original patch. I've removed that. However, this patch depends on an earlier missing adjustment to XSA-263, which I've noticed only when trying to commit the one here. I've sent the other patch a minute ago.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel