public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@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, 01 Jun 2011 15:36:11 +0300	[thread overview]
Message-ID: <4DE6323B.8090508@redhat.com> (raw)
In-Reply-To: <20110601123203.GA2429@amt.cnet>

On 06/01/2011 03:32 PM, Marcelo Tosatti wrote:
> 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.

Why would C) not fault?  The spte has U=1, any fetch access from kernel 
mode with SMEP=1 will fault.

-- 
error compiling committee.c: too many arguments to function


      reply	other threads:[~2011-06-01 12:36 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
2011-06-01 12:36           ` Avi Kivity [this message]

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=4DE6323B.8090508@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --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