Skip to content

Commit f29dfa5

Browse files
pa1guptaIngo Molnar
authored and
Ingo Molnar
committedAug 6, 2020
x86/bugs/multihit: Fix mitigation reporting when VMX is not in use
On systems that have virtualization disabled or unsupported, sysfs mitigation for X86_BUG_ITLB_MULTIHIT is reported incorrectly as: $ cat /sys/devices/system/cpu/vulnerabilities/itlb_multihit KVM: Vulnerable System is not vulnerable to DoS attack from a rogue guest when virtualization is disabled or unsupported in the hardware. Change the mitigation reporting for these cases. Fixes: b8e8c83 ("kvm: mmu: ITLB_MULTIHIT mitigation") Reported-by: Nelson Dsouza <nelson.dsouza@linux.intel.com> Co-developed-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Tony Luck <tony.luck@intel.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/0ba029932a816179b9d14a30db38f0f11ef1f166.1594925782.git.pawan.kumar.gupta@linux.intel.com
1 parent 76d1025 commit f29dfa5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed
 

‎Documentation/admin-guide/hw-vuln/multihit.rst

+4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ The possible values in this file are:
8080
- The processor is not vulnerable.
8181
* - KVM: Mitigation: Split huge pages
8282
- Software changes mitigate this issue.
83+
* - KVM: Mitigation: VMX unsupported
84+
- KVM is not vulnerable because Virtual Machine Extensions (VMX) is not supported.
85+
* - KVM: Mitigation: VMX disabled
86+
- KVM is not vulnerable because Virtual Machine Extensions (VMX) is disabled.
8387
* - KVM: Vulnerable
8488
- The processor is vulnerable, but no mitigation enabled
8589

‎arch/x86/kernel/cpu/bugs.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <asm/intel-family.h>
3232
#include <asm/e820/api.h>
3333
#include <asm/hypervisor.h>
34+
#include <asm/tlbflush.h>
3435

3536
#include "cpu.h"
3637

@@ -1549,7 +1550,12 @@ static ssize_t l1tf_show_state(char *buf)
15491550

15501551
static ssize_t itlb_multihit_show_state(char *buf)
15511552
{
1552-
if (itlb_multihit_kvm_mitigation)
1553+
if (!boot_cpu_has(X86_FEATURE_MSR_IA32_FEAT_CTL) ||
1554+
!boot_cpu_has(X86_FEATURE_VMX))
1555+
return sprintf(buf, "KVM: Mitigation: VMX unsupported\n");
1556+
else if (!(cr4_read_shadow() & X86_CR4_VMXE))
1557+
return sprintf(buf, "KVM: Mitigation: VMX disabled\n");
1558+
else if (itlb_multihit_kvm_mitigation)
15531559
return sprintf(buf, "KVM: Mitigation: Split huge pages\n");
15541560
else
15551561
return sprintf(buf, "KVM: Vulnerable\n");

0 commit comments

Comments
 (0)