summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-01-11 18:20:48 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2018-01-11 18:20:48 +0100
commit2aad9b3e0711f8c67c472920cd5b70199fba8520 (patch)
treea59584c6c12cc0a37361d727a6a2b1f57cd6deba /arch/x86
parentbd89525a823ce6edddcedbe9aed79faa1b9cf544 (diff)
parent75f139aaf896d6fdeec2e468ddfa4b2fe469bf40 (diff)
Merge branch 'kvm-insert-lfence' into kvm-master
Topic branch for CVE-2017-5753, avoiding conflicts in the next merge window.
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/vmx.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 427fd3200dd8..3f89f6783aa5 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -899,8 +899,16 @@ static inline short vmcs_field_to_offset(unsigned long field)
{
BUILD_BUG_ON(ARRAY_SIZE(vmcs_field_to_offset_table) > SHRT_MAX);
- if (field >= ARRAY_SIZE(vmcs_field_to_offset_table) ||
- vmcs_field_to_offset_table[field] == 0)
+ if (field >= ARRAY_SIZE(vmcs_field_to_offset_table))
+ return -ENOENT;
+
+ /*
+ * FIXME: Mitigation for CVE-2017-5753. To be replaced with a
+ * generic mechanism.
+ */
+ asm("lfence");
+
+ if (vmcs_field_to_offset_table[field] == 0)
return -ENOENT;
return vmcs_field_to_offset_table[field];