Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1610532

Re: [PATCH 2/6] KVM: VMX: cleanup check for invalid EPT violation

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/6] KVM: VMX: cleanup check for invalid EPT violation
Date 2017-03-28 12:20 +0200
Message-ID <tpWoi-65Z-13@gated-at.bofh.it> (permalink)
References <tiOlP-1Pw-3@gated-at.bofh.it> <tiOFb-1Wd-7@gated-at.bofh.it> <tj3Xz-43h-5@gated-at.bofh.it> <tj3XC-43h-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 09/03/2017 11:50, David Hildenbrand wrote:
>> Do we have any define for this magic bit 7?
>>
>> #EPT_EXITQ_GLA_VALID 0x80
>>
> Introducing
> 
> #define EPT_VIOLATION_GLA_VALID_BIT
> #define EPT_VIOLATION_GLA_VALID

Done:

diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
index cc54b7026567..bd084eafdb18 100644
--- a/arch/x86/include/asm/vmx.h
+++ b/arch/x86/include/asm/vmx.h
@@ -516,12 +516,14 @@ struct vmx_msr_entry {
 #define EPT_VIOLATION_READABLE_BIT	3
 #define EPT_VIOLATION_WRITABLE_BIT	4
 #define EPT_VIOLATION_EXECUTABLE_BIT	5
+#define EPT_VIOLATION_GLA_VALID_BIT	7
 #define EPT_VIOLATION_ACC_READ		(1 << EPT_VIOLATION_ACC_READ_BIT)
 #define EPT_VIOLATION_ACC_WRITE		(1 << EPT_VIOLATION_ACC_WRITE_BIT)
 #define EPT_VIOLATION_ACC_INSTR		(1 << EPT_VIOLATION_ACC_INSTR_BIT)
 #define EPT_VIOLATION_READABLE		(1 << EPT_VIOLATION_READABLE_BIT)
 #define EPT_VIOLATION_WRITABLE		(1 << EPT_VIOLATION_WRITABLE_BIT)
 #define EPT_VIOLATION_EXECUTABLE	(1 << EPT_VIOLATION_EXECUTABLE_BIT)
+#define EPT_VIOLATION_GLA_VALID		(1 << EPT_VIOLATION_GLA_VALID_BIT)
 
 /*
  * VM-instruction error numbers
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 7f2f5b790a84..62984d01d7b5 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -6211,7 +6211,7 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu)
 
 	exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
 
-	if ((exit_qualification & 0x80) == 0) {
+	if (!(exit_qualification & EPT_VIOLATION_GLA_VALID)) {
 		printk(KERN_ERR "EPT: Handling EPT violation failed!\n");
 		printk(KERN_ERR "EPT: GPA: 0x%lx, GVA: 0x%lx\n",
 			(long unsigned int)vmcs_read64(GUEST_PHYSICAL_ADDRESS),

and pushed to kvm/queue.

Paolo

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH 2/6] KVM: VMX: cleanup check for invalid EPT violation Paolo Bonzini <pbonzini@redhat.com> - 2017-03-28 12:20 +0200

csiph-web