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