public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm: nVMX: Reorder error checks for emulated VMXON
@ 2016-12-22 23:49 Jim Mattson
  2017-01-04  9:45 ` David Hildenbrand
  2017-01-05 16:56 ` Radim Krčmář
  0 siblings, 2 replies; 3+ messages in thread
From: Jim Mattson @ 2016-12-22 23:49 UTC (permalink / raw)
  To: kvm; +Cc: Jim Mattson

Checks on the operand to VMXON are performed after the check for
legacy mode operation and the #GP checks, according to the pseudo-code
in Intel's SDM.

Signed-off-by: Jim Mattson <jmattson@google.com>
---
 arch/x86/kvm/vmx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index a11f5c9..346befd 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -7174,9 +7174,6 @@ static int handle_vmon(struct kvm_vcpu *vcpu)
 		return 1;
 	}
 
-	if (nested_vmx_check_vmptr(vcpu, EXIT_REASON_VMON, NULL))
-		return 1;
-
 	if (vmx->nested.vmxon) {
 		nested_vmx_failValid(vcpu, VMXERR_VMXON_IN_VMX_ROOT_OPERATION);
 		return kvm_skip_emulated_instruction(vcpu);
@@ -7188,6 +7185,9 @@ static int handle_vmon(struct kvm_vcpu *vcpu)
 		return 1;
 	}
 
+	if (nested_vmx_check_vmptr(vcpu, EXIT_REASON_VMON, NULL))
+		return 1;
+
 	if (cpu_has_vmx_msr_bitmap()) {
 		vmx->nested.msr_bitmap =
 				(unsigned long *)__get_free_page(GFP_KERNEL);
-- 
2.8.0.rc3.226.g39d4020


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

end of thread, other threads:[~2017-01-05 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-22 23:49 [PATCH] kvm: nVMX: Reorder error checks for emulated VMXON Jim Mattson
2017-01-04  9:45 ` David Hildenbrand
2017-01-05 16:56 ` Radim Krčmář

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