All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eugene Korenevsky <ekorenevsky@gmail.com>
To: kvm@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH 5/5] KVM: nVMX: VMWRITE emulation: remove unnecessary check for compatibility mode
Date: Thu, 20 Aug 2015 22:38:20 +0300	[thread overview]
Message-ID: <20150820193820.GA3593@unote> (raw)

VMWRITE instruction is not valid in compatibility mode. This is
checked by nested_vmx_check_permission() function which throws #UD if CS.L=0.
The additional check in is_64_bit_mode() for CS.L=0 is useless.
We should check only EFER.LMA=1 which is done by is_long_mode().

Signed-off-by: Eugene Korenevsky <ekorenevsky@gmail.com>
---
 arch/x86/kvm/vmx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index f39e24f..12bdaae 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -7034,7 +7034,7 @@ static int handle_vmwrite(struct kvm_vcpu *vcpu)
 		field_value = kvm_register_readl(vcpu,
 			(((vmx_instruction_info) >> 3) & 0xf));
 	else {
-		mem_op_size = is_64_bit_mode(vcpu) ? 8 : 4;
+		mem_op_size = is_long_mode(vcpu) ? 8 : 4;
 		if (get_vmx_mem_address(vcpu, exit_qualification,
 		    vmx_instruction_info, false, mem_op_size, &gva))
 			return 1;
-- 
2.1.4


             reply	other threads:[~2015-08-20 19:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-20 19:38 Eugene Korenevsky [this message]
2015-09-07 11:43 ` [PATCH 5/5] KVM: nVMX: VMWRITE emulation: remove unnecessary check for compatibility mode Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150820193820.GA3593@unote \
    --to=ekorenevsky@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.