From 78ebf99c08552cdc0fe3d84eac3fc0dbeccf7eca Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Mon, 21 May 2018 17:54:49 -0400 Subject: [PATCH] KVM: VMX: Expose SSBD properly to guests. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The X86_FEATURE_SSBD is an synthetic CPU feature - that is it bit location has no relevance to the real CPUID 0x7.EBX[31] bit position. For that we need the new CPU feature name. Fixes: 52817587e706 ("x86/cpufeatures: Disentangle SSBD enumeration") CC: Paolo Bonzini Cc: "Radim Krčmář" Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: stable@vger.kernel.org Signed-off-by: Konrad Rzeszutek Wilk CVE-2018-3639 (x86) (backported from https://patchwork.kernel.org/patch/10416823/) Signed-off-by: Tyler Hicks Signed-off-by: Stefan Bader --- arch/x86/kernel/cpu/scattered.c | 2 +- arch/x86/kvm/cpuid.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index d0295774a485..029e2ce20d12 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -26,7 +26,7 @@ static const struct cpuid_bit cpuid_bits[] = { { X86_FEATURE_AVX512_4FMAPS, CPUID_EDX, 3, 0x00000007, 0 }, { X86_FEATURE_SPEC_CTRL, CPUID_EDX, 26, 0x00000007, 0 }, { X86_FEATURE_ARCH_CAPABILITIES,CPUID_EDX, 29, 0x00000007, 0 }, - { X86_FEATURE_SSBD, CPUID_EDX, 31, 0x00000007, 0 }, + { X86_FEATURE_SPEC_CTRL_SSBD, CPUID_EDX, 31, 0x00000007, 0 }, { X86_FEATURE_CAT_L3, CPUID_EBX, 1, 0x00000010, 0 }, { X86_FEATURE_CAT_L2, CPUID_EBX, 2, 0x00000010, 0 }, { X86_FEATURE_CDP_L3, CPUID_ECX, 2, 0x00000010, 1 }, diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index a6199c9c1b63..2690ad201ed5 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -71,7 +71,7 @@ u64 kvm_supported_xcr0(void) #define KVM_CPUID_BIT_AVX512_4VNNIW 2 #define KVM_CPUID_BIT_AVX512_4FMAPS 3 #define KVM_CPUID_BIT_SPEC_CTRL 26 -#define KVM_CPUID_BIT_SSBD 31 +#define KVM_CPUID_BIT_SPEC_CTRL_SSBD 31 #define KF(x) bit(KVM_CPUID_BIT_##x) int kvm_update_cpuid(struct kvm_vcpu *vcpu) @@ -390,7 +390,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, /* cpuid 7.0.edx*/ const u32 kvm_cpuid_7_0_edx_x86_features = KF(AVX512_4VNNIW) | KF(AVX512_4FMAPS) | - KF(SPEC_CTRL) | KF(SSBD); + KF(SPEC_CTRL) | KF(SPEC_CTRL_SSBD); /* cpuid 0x80000008.0.ebx */ const u32 kvm_cpuid_80000008_0_ebx_x86_features = -- 2.39.5