mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] KVM: VMX: Fix check for valid GVA on an EPT violation
@ 2025-11-06  5:28 Sukrit Bhatnagar
  2025-11-06  6:07 ` Xiaoyao Li
  2025-11-10 15:37 ` Sean Christopherson
  0 siblings, 2 replies; 3+ messages in thread
From: Sukrit Bhatnagar @ 2025-11-06  5:28 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Yuan Yao
  Cc: Sukrit.Bhatnagar, kvm, linux-kernel

On an EPT violation, bit 7 of the exit qualification is set if the
guest linear-address is valid. The derived page fault error code
should not be checked for this bit.

Fixes: f3009482512e ("KVM: VMX: Set PFERR_GUEST_{FINAL,PAGE}_MASK if and only if the GVA is valid")
Signed-off-by: Sukrit Bhatnagar <Sukrit.Bhatnagar@sony.com>
---
 arch/x86/kvm/vmx/common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx/common.h b/arch/x86/kvm/vmx/common.h
index bc5ece76533a..412d0829d7a2 100644
--- a/arch/x86/kvm/vmx/common.h
+++ b/arch/x86/kvm/vmx/common.h
@@ -98,7 +98,7 @@ static inline int __vmx_handle_ept_violation(struct kvm_vcpu *vcpu, gpa_t gpa,
 	error_code |= (exit_qualification & EPT_VIOLATION_PROT_MASK)
 		      ? PFERR_PRESENT_MASK : 0;
 
-	if (error_code & EPT_VIOLATION_GVA_IS_VALID)
+	if (exit_qualification & EPT_VIOLATION_GVA_IS_VALID)
 		error_code |= (exit_qualification & EPT_VIOLATION_GVA_TRANSLATED) ?
 			      PFERR_GUEST_FINAL_MASK : PFERR_GUEST_PAGE_MASK;
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: VMX: Fix check for valid GVA on an EPT violation
  2025-11-06  5:28 [PATCH] KVM: VMX: Fix check for valid GVA on an EPT violation Sukrit Bhatnagar
@ 2025-11-06  6:07 ` Xiaoyao Li
  2025-11-10 15:37 ` Sean Christopherson
  1 sibling, 0 replies; 3+ messages in thread
From: Xiaoyao Li @ 2025-11-06  6:07 UTC (permalink / raw)
  To: Sukrit Bhatnagar, Sean Christopherson, Paolo Bonzini,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Yuan Yao
  Cc: kvm, linux-kernel

On 11/6/2025 1:28 PM, Sukrit Bhatnagar wrote:
> On an EPT violation, bit 7 of the exit qualification is set if the
> guest linear-address is valid. The derived page fault error code
> should not be checked for this bit.
> 
> Fixes: f3009482512e ("KVM: VMX: Set PFERR_GUEST_{FINAL,PAGE}_MASK if and only if the GVA is valid")
> Signed-off-by: Sukrit Bhatnagar <Sukrit.Bhatnagar@sony.com>

Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>

> ---
>   arch/x86/kvm/vmx/common.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/vmx/common.h b/arch/x86/kvm/vmx/common.h
> index bc5ece76533a..412d0829d7a2 100644
> --- a/arch/x86/kvm/vmx/common.h
> +++ b/arch/x86/kvm/vmx/common.h
> @@ -98,7 +98,7 @@ static inline int __vmx_handle_ept_violation(struct kvm_vcpu *vcpu, gpa_t gpa,
>   	error_code |= (exit_qualification & EPT_VIOLATION_PROT_MASK)
>   		      ? PFERR_PRESENT_MASK : 0;
>   
> -	if (error_code & EPT_VIOLATION_GVA_IS_VALID)
> +	if (exit_qualification & EPT_VIOLATION_GVA_IS_VALID)
>   		error_code |= (exit_qualification & EPT_VIOLATION_GVA_TRANSLATED) ?
>   			      PFERR_GUEST_FINAL_MASK : PFERR_GUEST_PAGE_MASK;
>   


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: VMX: Fix check for valid GVA on an EPT violation
  2025-11-06  5:28 [PATCH] KVM: VMX: Fix check for valid GVA on an EPT violation Sukrit Bhatnagar
  2025-11-06  6:07 ` Xiaoyao Li
@ 2025-11-10 15:37 ` Sean Christopherson
  1 sibling, 0 replies; 3+ messages in thread
From: Sean Christopherson @ 2025-11-10 15:37 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Yuan Yao,
	Sukrit Bhatnagar
  Cc: kvm, linux-kernel

On Thu, 06 Nov 2025 14:28:51 +0900, Sukrit Bhatnagar wrote:
> On an EPT violation, bit 7 of the exit qualification is set if the
> guest linear-address is valid. The derived page fault error code
> should not be checked for this bit.

Applied to kvm-x86 fixes (and it's in now in kvm/master as this "thank you" is
coming a bit late).  Thanks!

[1/1] KVM: VMX: Fix check for valid GVA on an EPT violation
      https://github.com/kvm-x86/linux/commit/d0164c161923

--
https://github.com/kvm-x86/linux/tree/next

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-10 15:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-06  5:28 [PATCH] KVM: VMX: Fix check for valid GVA on an EPT violation Sukrit Bhatnagar
2025-11-06  6:07 ` Xiaoyao Li
2025-11-10 15:37 ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®