|
|
9ae3a8 |
From 151cbf5d444ab746d05dc0757ec972df8880d0ec Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
Date: Wed, 13 Dec 2017 15:43:39 -0200
|
|
|
9ae3a8 |
Subject: [PATCH 1/3] target-i386: cpu: add new CPUID bits for indirect branch
|
|
|
9ae3a8 |
predictor restrictions
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
9ae3a8 |
Message-id: <20171213174341.20684-2-ehabkost@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: n/a
|
|
|
9ae3a8 |
O-Subject: [CONFIDENTIAL][RHEL-7.5 qemu-kvm PATCH v2 1/3] target-i386: cpu:
|
|
|
9ae3a8 |
add new CPUID bits for indirect branch predictor restrictions
|
|
|
9ae3a8 |
Bugzilla: CVE-2017-5715
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
target-i386/cpu.c | 19 ++++++++++++++++++-
|
|
|
9ae3a8 |
target-i386/cpu.h | 1 +
|
|
|
9ae3a8 |
2 files changed, 19 insertions(+), 1 deletion(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
|
|
|
9ae3a8 |
index 539d659..335689b 100644
|
|
|
9ae3a8 |
--- a/target-i386/cpu.c
|
|
|
9ae3a8 |
+++ b/target-i386/cpu.c
|
|
|
9ae3a8 |
@@ -172,6 +172,17 @@ static const char *cpuid_7_0_edx_feature_name[] = {
|
|
|
9ae3a8 |
NULL, NULL, NULL, NULL,
|
|
|
9ae3a8 |
NULL, NULL, NULL, NULL,
|
|
|
9ae3a8 |
NULL, NULL, NULL, NULL,
|
|
|
9ae3a8 |
+ NULL, NULL, "spec-ctrl", "stibp",
|
|
|
9ae3a8 |
+ NULL, "arch-facilities", NULL, NULL,
|
|
|
9ae3a8 |
+};
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+static const char *cpuid_80000008_ebx_feature_name[] = {
|
|
|
9ae3a8 |
+ NULL, NULL, NULL, NULL,
|
|
|
9ae3a8 |
+ NULL, NULL, NULL, NULL,
|
|
|
9ae3a8 |
+ NULL, NULL, NULL, NULL,
|
|
|
9ae3a8 |
+ "ibpb", NULL, NULL, NULL,
|
|
|
9ae3a8 |
+ NULL, NULL, NULL, NULL,
|
|
|
9ae3a8 |
+ NULL, NULL, NULL, NULL,
|
|
|
9ae3a8 |
NULL, NULL, NULL, NULL,
|
|
|
9ae3a8 |
NULL, NULL, NULL, NULL,
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
@@ -314,6 +325,12 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
|
|
|
9ae3a8 |
.cpuid_reg = R_EDX,
|
|
|
9ae3a8 |
.tcg_features = TCG_7_0_EDX_FEATURES,
|
|
|
9ae3a8 |
},
|
|
|
9ae3a8 |
+ [FEAT_8000_0008_EBX] = {
|
|
|
9ae3a8 |
+ .feat_names = cpuid_80000008_ebx_feature_name,
|
|
|
9ae3a8 |
+ .cpuid_eax = 0x80000008,
|
|
|
9ae3a8 |
+ .cpuid_needs_ecx = false, .cpuid_ecx = 0,
|
|
|
9ae3a8 |
+ .cpuid_reg = R_EBX,
|
|
|
9ae3a8 |
+ },
|
|
|
9ae3a8 |
[FEAT_XSAVE] = {
|
|
|
9ae3a8 |
.feat_names = cpuid_xsave_feature_name,
|
|
|
9ae3a8 |
.cpuid_eax = 0xd,
|
|
|
9ae3a8 |
@@ -2470,7 +2487,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
|
|
|
9ae3a8 |
*eax = 0x00000020; /* 32 bits physical */
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- *ebx = 0;
|
|
|
9ae3a8 |
+ *ebx = env->features[FEAT_8000_0008_EBX];
|
|
|
9ae3a8 |
*ecx = 0;
|
|
|
9ae3a8 |
*edx = 0;
|
|
|
9ae3a8 |
if (cs->nr_cores * cs->nr_threads > 1) {
|
|
|
9ae3a8 |
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
|
|
|
9ae3a8 |
index 78b8072..1e5c980 100644
|
|
|
9ae3a8 |
--- a/target-i386/cpu.h
|
|
|
9ae3a8 |
+++ b/target-i386/cpu.h
|
|
|
9ae3a8 |
@@ -406,6 +406,7 @@ typedef enum FeatureWord {
|
|
|
9ae3a8 |
FEAT_7_0_EDX, /* CPUID[EAX=7,ECX=0].EDX */
|
|
|
9ae3a8 |
FEAT_8000_0001_EDX, /* CPUID[8000_0001].EDX */
|
|
|
9ae3a8 |
FEAT_8000_0001_ECX, /* CPUID[8000_0001].ECX */
|
|
|
9ae3a8 |
+ FEAT_8000_0008_EBX, /* CPUID[8000_0008].EBX */
|
|
|
9ae3a8 |
FEAT_C000_0001_EDX, /* CPUID[C000_0001].EDX */
|
|
|
9ae3a8 |
FEAT_KVM, /* CPUID[4000_0001].EAX (KVM_CPUID_FEATURES) */
|
|
|
9ae3a8 |
FEAT_SVM, /* CPUID[8000_000A].EDX */
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|