projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bebc608
)
KVM: x86: Add memory barrier on vmcs field lookup
author
Andrew Honig
<
[email protected]
>
Wed, 10 Jan 2018 18:12:03 +0000
(10:12 -0800)
committer
Paolo Bonzini
<
[email protected]
>
Thu, 11 Jan 2018 17:20:31 +0000
(18:20 +0100)
This adds a memory barrier when performing a lookup into
the vmcs_field_to_offset_table. This is related to
CVE-2017-5753.
Signed-off-by: Andrew Honig <
[email protected]
>
Reviewed-by: Jim Mattson <
[email protected]
>
Cc:
[email protected]
Signed-off-by: Paolo Bonzini <
[email protected]
>
arch/x86/kvm/vmx.c
patch
|
blob
|
history
diff --git
a/arch/x86/kvm/vmx.c
b/arch/x86/kvm/vmx.c
index a6f4f095f8f4eb4aa5b4bae2a21dd66cccd824e7..7f8fcc5ce664debcfe640066143e2158c7098abc 100644
(file)
--- a/
arch/x86/kvm/vmx.c
+++ b/
arch/x86/kvm/vmx.c
@@
-884,8
+884,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];