linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: nVMX: Fix consistency check on injected exception error code
@ 2019-10-01 16:21 Sean Christopherson
  2019-10-01 16:28 ` Jim Mattson
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Christopherson @ 2019-10-01 16:21 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář
  Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, linux-kernel, Nadav Amit

Current versions of Intel's SDM incorrectly state that "bits 31:15 of
the VM-Entry exception error-code field" must be zero.  In reality, bits
31:16 must be zero, i.e. error codes are 16-bit values.

The bogus error code check manifests as an unexpected VM-Entry failure
due to an invalid code field (error number 7) in L1, e.g. when injecting
a #GP with error_code=0x9f00.

Nadav previously reported the bug[*], both to KVM and Intel, and fixed
the associated kvm-unit-test.

[*] https://patchwork.kernel.org/patch/11124749/

Reported-by: Nadav Amit <namit@vmware.com>
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 arch/x86/kvm/vmx/nested.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 41abc62c9a8a..e76eb4f07f6c 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -2610,7 +2610,7 @@ static int nested_check_vm_entry_controls(struct kvm_vcpu *vcpu,
 
 		/* VM-entry exception error code */
 		if (CC(has_error_code &&
-		       vmcs12->vm_entry_exception_error_code & GENMASK(31, 15)))
+		       vmcs12->vm_entry_exception_error_code & GENMASK(31, 16)))
 			return -EINVAL;
 
 		/* VM-entry interruption-info field: reserved bits */
-- 
2.22.0


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

* Re: [PATCH] KVM: nVMX: Fix consistency check on injected exception error code
  2019-10-01 16:21 [PATCH] KVM: nVMX: Fix consistency check on injected exception error code Sean Christopherson
@ 2019-10-01 16:28 ` Jim Mattson
  2019-10-03 10:32   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Mattson @ 2019-10-01 16:28 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: Paolo Bonzini, Radim Krčmář,
	Vitaly Kuznetsov, Wanpeng Li, Joerg Roedel, kvm list, LKML,
	Nadav Amit

On Tue, Oct 1, 2019 at 9:21 AM Sean Christopherson
<sean.j.christopherson@intel.com> wrote:
>
> Current versions of Intel's SDM incorrectly state that "bits 31:15 of
> the VM-Entry exception error-code field" must be zero.  In reality, bits
> 31:16 must be zero, i.e. error codes are 16-bit values.
>
> The bogus error code check manifests as an unexpected VM-Entry failure
> due to an invalid code field (error number 7) in L1, e.g. when injecting
> a #GP with error_code=0x9f00.
>
> Nadav previously reported the bug[*], both to KVM and Intel, and fixed
> the associated kvm-unit-test.
>
> [*] https://patchwork.kernel.org/patch/11124749/
>
> Reported-by: Nadav Amit <namit@vmware.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Reviewed-by: Jim Mattson <jmattson@google.com>

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

* Re: [PATCH] KVM: nVMX: Fix consistency check on injected exception error code
  2019-10-01 16:28 ` Jim Mattson
@ 2019-10-03 10:32   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2019-10-03 10:32 UTC (permalink / raw)
  To: Jim Mattson, Sean Christopherson
  Cc: Radim Krčmář,
	Vitaly Kuznetsov, Wanpeng Li, Joerg Roedel, kvm list, LKML,
	Nadav Amit

On 01/10/19 18:28, Jim Mattson wrote:
> Reviewed-by: Jim Mattson <jmattson@google.com>

Queued, thanks.

Paolo

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

end of thread, other threads:[~2019-10-03 10:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-01 16:21 [PATCH] KVM: nVMX: Fix consistency check on injected exception error code Sean Christopherson
2019-10-01 16:28 ` Jim Mattson
2019-10-03 10:32   ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).