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: "Yang, Wei Y" <wei.y.yang@intel.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [Patch v4 2/4] Add SMEP handling when setting CR4
Date: Wed, 1 Jun 2011 09:32:03 -0300	[thread overview]
Message-ID: <20110601123203.GA2429@amt.cnet> (raw)
In-Reply-To: <4DE53B7E.4070403@redhat.com>

On Tue, May 31, 2011 at 10:03:26PM +0300, Avi Kivity wrote:
> On 05/31/2011 09:48 PM, Marcelo Tosatti wrote:
> >On Tue, May 31, 2011 at 09:05:35PM +0300, Avi Kivity wrote:
> >>  >>    	if (is_long_mode(vcpu)) {
> >>  >>    		if (!(cr4&   X86_CR4_PAE))
> >>  >>    			return 1;
> >>  >
> >>  >A new field in vcpu->arch.mmu.base_role for smep is required
> >>  >for shadow MMU (similar to nxe).
> >>
> >>  I plan to add that with my cr0.wp=0 fixup (it's only needed there, right?)
> >
> >Sptes instantiated when cr4.smep = 0 should not be used when cr4.smep =
> >1, so no (unlikely that guest kernel executes user=1 code anyway, but
> >for consistency with other base_role flags).
> 
> Why not?  The sptes are interpreted exactly the same.
> 
> sptes are interpreted differently when efer.nxe=1 - if bit 63 is
> set, it will fault when nxe=0 and will not fault when nxe=1 (for
> non-fetch accesses).  So we can't share those sptes.

A) CR4.SMEP = 0, spte instantiated via fetch fault of user pte.
B) CR4.SMEP = 1, base_role unchanged.
C) spte instantiated in A) used, but access should fault instead.

Or if you have multiple CPUs with different settings.

> >OK then, you'll fix that.
> >
> 
> Sure.  I'll post the patches as soon as this hits 'next'.
> 
> -- 
> I have a truly marvellous patch that fixes the bug which this
> signature is too narrow to contain.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-06-01 12:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-29 11:41 [Patch v4 2/4] Add SMEP handling when setting CR4 Yang, Wei Y
2011-05-31 17:52 ` Marcelo Tosatti
2011-05-31 18:05   ` Avi Kivity
2011-05-31 18:48     ` Marcelo Tosatti
2011-05-31 19:03       ` Avi Kivity
2011-06-01 12:32         ` Marcelo Tosatti [this message]
2011-06-01 12: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=20110601123203.GA2429@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=wei.y.yang@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox