summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-01-16 16:38:52 +0100
committerRadim Krčmář <rkrcmar@redhat.com>2018-01-16 16:39:30 +0100
commit05992edc279237d5803d64578e0c72b604970a49 (patch)
treeff4673fa7203626b9c99e914cee8fad35be8ca70 /arch/x86/kvm
parentKVM: x86: prefer "depends on" to "select" for SEV (diff)
parentKVM: x86: Add memory barrier on vmcs field lookup (diff)
downloadlinux-05992edc279237d5803d64578e0c72b604970a49.tar.xz
linux-05992edc279237d5803d64578e0c72b604970a49.zip
Merge branch 'kvm-insert-lfence'
Topic branch for CVE-2017-5753, avoiding conflicts in the next merge window.
Diffstat (limited to 'arch/x86/kvm')
-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 c1791759f1e6..7b1d71665bc2 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -893,8 +893,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];