public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 5/5] KVM: VMX: Atomically switch efer if EPT && !EFER.NX
Date: Fri, 30 Apr 2010 14:37:06 -0300	[thread overview]
Message-ID: <20100430173706.GA2358@amt.cnet> (raw)
In-Reply-To: <1272462439-30881-6-git-send-email-avi@redhat.com>


Avi,

This patch breaks WinVista.64 install.

On Wed, Apr 28, 2010 at 04:47:19PM +0300, Avi Kivity wrote:
> When EPT is enabled, we cannot emulate EFER.NX=0 through the shadow page
> tables.  This causes accesses through ptes with bit 63 set to succeed instead
> of failing a reserved bit check.
> 
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
>  arch/x86/kvm/vmx.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index ae22dcf..cc78fee 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -678,6 +678,17 @@ static bool update_transition_efer(struct vcpu_vmx *vmx, int efer_offset)
>  	guest_efer |= host_efer & ignore_bits;
>  	vmx->guest_msrs[efer_offset].data = guest_efer;
>  	vmx->guest_msrs[efer_offset].mask = ~ignore_bits;
> +
> +	clear_atomic_switch_msr(vmx, MSR_EFER);
> +	/* On ept, can't emulate nx, and must switch nx atomically */
> +	if (enable_ept && ((vmx->vcpu.arch.efer ^ host_efer) & EFER_NX)) {
> +		guest_efer = vmx->vcpu.arch.efer;
> +		if (!(guest_efer & EFER_LMA))
> +			guest_efer &= ~EFER_LME;
> +		add_atomic_switch_msr(vmx, MSR_EFER, guest_efer, host_efer);
> +		return false;
> +	}
> +
>  	return true;
>  }
>  
> -- 
> 1.7.0.4

  reply	other threads:[~2010-04-30 17:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-28 13:47 [PATCH 0/5] Fix EFER.NX=0 with EPT Avi Kivity
2010-04-28 13:47 ` [PATCH 1/5] KVM: Let vcpu structure alignment be determined at runtime Avi Kivity
2010-04-28 13:47 ` [PATCH 2/5] KVM: VMX: Add definition for msr autoload entry Avi Kivity
2010-04-28 13:47 ` [PATCH 3/5] KVM: VMX: Add definitions for guest and host EFER autoswitch vmcs entries Avi Kivity
2010-04-28 13:47 ` [PATCH 4/5] KVM: VMX: Add facility to atomically switch MSRs on guest entry/exit Avi Kivity
2010-04-28 13:47 ` [PATCH 5/5] KVM: VMX: Atomically switch efer if EPT && !EFER.NX Avi Kivity
2010-04-30 17:37   ` Marcelo Tosatti [this message]
2010-04-30 17:56     ` Avi Kivity
2010-05-02 10:01       ` Avi Kivity
2010-04-28 23:22 ` [PATCH 0/5] Fix EFER.NX=0 with EPT Marcelo Tosatti
2010-04-30 16:36   ` Avi Kivity

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=20100430173706.GA2358@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox