All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: kvm@vger.kernel.org, mtosatti@redhat.com
Subject: Re: [PATCHv2 1/6] KVM: emulator: drop RPL check from linearize() function
Date: Mon, 11 Feb 2013 19:25:13 +0200	[thread overview]
Message-ID: <20130211172513.GB27881@redhat.com> (raw)
In-Reply-To: <51192330.7050507@siemens.com>

On Mon, Feb 11, 2013 at 05:58:24PM +0100, Jan Kiszka wrote:
> On 2012-12-20 15:57, Gleb Natapov wrote:
> > According to Intel SDM Vol3 Section 5.5 "Privilege Levels" and 5.6
> > "Privilege Level Checking When Accessing Data Segments" RPL checking is
> > done during loading of a segment selector, not during data access. We
> > already do checking during segment selector loading, so drop the check
> > during data access. Checking RPL during data access triggers #GP if
> > after transition from real mode to protected mode RPL bits in a segment
> > selector are set.
> > 
> > Signed-off-by: Gleb Natapov <gleb@redhat.com>
> > ---
> >  arch/x86/kvm/emulate.c |    7 +------
> >  1 file changed, 1 insertion(+), 6 deletions(-)
> > 
> > diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> > index c7547b3..a3d31e3 100644
> > --- a/arch/x86/kvm/emulate.c
> > +++ b/arch/x86/kvm/emulate.c
> > @@ -665,7 +665,7 @@ static int __linearize(struct x86_emulate_ctxt *ctxt,
> >  	ulong la;
> >  	u32 lim;
> >  	u16 sel;
> > -	unsigned cpl, rpl;
> > +	unsigned cpl;
> >  
> >  	la = seg_base(ctxt, addr.seg) + addr.ea;
> >  	switch (ctxt->mode) {
> > @@ -699,11 +699,6 @@ static int __linearize(struct x86_emulate_ctxt *ctxt,
> >  				goto bad;
> >  		}
> >  		cpl = ctxt->ops->cpl(ctxt);
> > -		if (ctxt->mode == X86EMUL_MODE_REAL)
> > -			rpl = 0;
> > -		else
> > -			rpl = sel & 3;
> > -		cpl = max(cpl, rpl);
> >  		if (!(desc.type & 8)) {
> >  			/* data segment */
> >  			if (cpl > desc.dpl)
> > 
> 
> I suppose this one is queued for 3.8 and stable already, right? We
> happen to hit the case reliably while booting an older SUSE guest on an
> AMD host.
> 
The patch was in the middle of the pile of vmx real mode fixes. I had
no reports that it can be triggered on its own, so it was not queued
neither to 3.8 nor to stable. Is it a regression?  If yes what version
the bug appears in?

--
			Gleb.

  reply	other threads:[~2013-02-11 17:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-20 14:57 [PATCHv2 0/6] more VMX real mode emulation fixes Gleb Natapov
2012-12-20 14:57 ` [PATCHv2 1/6] KVM: emulator: drop RPL check from linearize() function Gleb Natapov
2013-02-11 16:58   ` Jan Kiszka
2013-02-11 17:25     ` Gleb Natapov [this message]
2013-02-11 17:31       ` Jan Kiszka
2013-02-11 17:40         ` Gleb Natapov
2013-02-11 17:50           ` Gleb Natapov
2013-02-11 18:05             ` Jan Kiszka
2013-02-11 18:40               ` Gleb Natapov
2012-12-20 14:57 ` [PATCHv2 2/6] KVM: emulator: implement fninit, fnstsw, fnstcw Gleb Natapov
2012-12-20 14:57 ` [PATCHv2 3/6] KVM: VMX: make rmode_segment_valid() more strict Gleb Natapov
2012-12-20 14:57 ` [PATCHv2 4/6] KVM: VMX: fix emulation of invalid guest state Gleb Natapov
2012-12-20 14:57 ` [PATCHv2 5/6] KVM: VMX: Do not fix segment register during vcpu initialization Gleb Natapov
2012-12-20 14:57 ` [PATCHv2 6/6] KVM: VMX: handle IO when emulation is due to #GP in real mode Gleb Natapov
2012-12-20 15:25   ` Alex Williamson
2012-12-20 16:43     ` Gleb Natapov
2012-12-20 22:58       ` Alex Williamson
2012-12-21  8:01         ` Gleb Natapov
2012-12-22 11:06     ` Avi Kivity
2012-12-23  9:44       ` Gleb Natapov
2013-01-03 12:53 ` [PATCHv2 0/6] more VMX real mode emulation fixes Marcelo Tosatti

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=20130211172513.GB27881@redhat.com \
    --to=gleb@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@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.