diff mbox series

[RFC,v1,23/34] KVM: x86: mmu: fix: update present_mask in spte_read_protect()

Message ID 20200722160121.9601-24-alazar@bitdefender.com (mailing list archive)
State New, archived
Headers show
Series VM introspection - EPT Views and Virtualization Exceptions | expand

Commit Message

Adalbert Lazăr July 22, 2020, 4:01 p.m. UTC
From: Ștefan Șicleru <ssicleru@bitdefender.com>

shadow_present_mask is not 0ull if #VE support is enabled.
If #VE support is enabled, shadow_present_mask is updated in
vmx_enable_tdp() with VMX_EPT_SUPPRESS_VE_BIT.

Signed-off-by: Ștefan Șicleru <ssicleru@bitdefender.com>
Signed-off-by: Adalbert Lazăr <alazar@bitdefender.com>
---
 arch/x86/kvm/mmu/mmu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 810e22f41306..28ab4a1ba25a 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -1601,7 +1601,13 @@  static bool spte_write_protect(u64 *sptep, bool pt_protect)
 static bool spte_read_protect(u64 *sptep)
 {
 	u64 spte = *sptep;
-	bool exec_only_supported = (shadow_present_mask == 0ull);
+	bool exec_only_supported;
+
+	if (kvm_ve_supported)
+		exec_only_supported =
+		    (shadow_present_mask == VMX_EPT_SUPPRESS_VE_BIT);
+	else
+		exec_only_supported = (shadow_present_mask == 0ull);
 
 	rmap_printk("rmap_read_protect: spte %p %llx\n", sptep, *sptep);