Commit 8339cae2 authored by Tom Lendacky's avatar Tom Lendacky Committed by Marcelo Henrique Cerri

KVM: x86: Add speculative control CPUID support for guests

CVE-2017-5753
CVE-2017-5715

Provide the guest with the speculative control CPUID related values.
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
(backported from commit cbfe052b7e811a2854162b210f242d3e815cbc17)
Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
parent 8c36ea34
......@@ -65,6 +65,10 @@ u64 kvm_supported_xcr0(void)
#define F(x) bit(X86_FEATURE_##x)
/* These are scattered features in cpufeatures.h. */
#define KVM_CPUID_BIT_SPEC_CTRL 26
#define KF(x) bit(KVM_CPUID_BIT_##x)
int kvm_update_cpuid(struct kvm_vcpu *vcpu)
{
struct kvm_cpuid_entry2 *best;
......@@ -361,6 +365,10 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
const u32 kvm_supported_word10_x86_features =
F(XSAVEOPT) | F(XSAVEC) | F(XGETBV1) | f_xsaves;
/* cpuid 0x80000008.0.ebx */
const u32 kvm_cpuid_80000008_0_ebx_x86_features =
F(IBPB);
/* all calls to cpuid_count() should be made on the same cpu */
get_cpu();
......@@ -586,7 +594,9 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
if (!g_phys_as)
g_phys_as = phys_as;
entry->eax = g_phys_as | (virt_as << 8);
entry->ebx = entry->edx = 0;
entry->ebx &= kvm_cpuid_80000008_0_ebx_x86_features;
cpuid_mask(&entry->ebx, 13 /* CPUID_8000_0008_EBX */);
entry->edx = 0;
break;
}
case 0x80000019:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment