All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <srostedt@redhat.com>
To: Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: Wilfred Yu <wilfred.yu@intel.com>,
	Xiaohui Xin <xiaohui.xin@intel.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Susie Li <susie.li@intel.com>, "Li, Xin B" <xin.b.li@intel.com>,
	Herbert Xu <herbert.xu@redhat.com>
Subject: Re: [Patch] Fix for x86_64 boot failures due to bad segment setup for protected mode.
Date: Thu, 09 Nov 2006 07:56:50 -0500	[thread overview]
Message-ID: <45532592.5000303@redhat.com> (raw)
In-Reply-To: <C1789DB2.40E9%Keir.Fraser@cl.cam.ac.uk>

Keir Fraser wrote:
> On 9/11/06 3:49 am, "Stephen C. Tweedie" <sct@redhat.com> wrote:
> 
>> The fix is to save the 16-bit segments *always*, on entry to protected
>> mode when %CR0(PE) is first set; and to clear the saved 16-bit segment
>> and set the 32-bit variant in oldctx whenever a 32-bit segment
>> descriptor is set during the transition to 32-bit CS.  Then, when we
>> finally do the VMENTER, we will set up the VMCS from only the 32-bit
>> segments, clearing the VMCS entries for segments that have not been
>> assigned valid 32-bit segments yet.
> 
> So, after setting CR0.PE but before doing a jump to complete the transition
> to protected mode, is the guest now running with zeroed data selectors but
> with the old 'shadow segment state'? So it can still use its data segments
> until the long jump? Not that I know whether any bootloader would actually
> *want* to access data in that critical region....
> 
> 

Keir,

oldctx.*_sel is basically the shadow selector.  They are not used in 
emulating the code during the single step.  So zeroing them out is fine. 
The regs structure is what is used in calculating getting data in the 
data segments.

The main thing here that Stephen's approach is different to the previous 
approach, is that if a segment descriptor *is* changed (ie. %es for 
Vista) then we have to update the oldctx explicitly for that selector. 
So far the only place we see this is with the "pop %es".  And Stephen 
put in the proper code to update that descriptor.

The old approach would just update all the selectors if they fit inside 
the GDT table, whether or not they were changed or loaded. So when Linux 
had a bad (extremely large) GDT limit, we loaded all the selectors into 
the shadow selector, even though they were bogus.

-- Steve

  parent reply	other threads:[~2006-11-09 12:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-09  3:49 [Patch] Fix for x86_64 boot failures due to bad segment setup for protected mode Stephen C. Tweedie
2006-11-09  8:56 ` Keir Fraser
2006-11-09 12:32   ` Stephen C. Tweedie
2006-11-09 12:56   ` Steven Rostedt [this message]
     [not found] <C178E6D1.438A%keir@xensource.com>
2006-11-09 14:28 ` Steven Rostedt
2006-11-09 17:31 ` Stephen C. Tweedie

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=45532592.5000303@redhat.com \
    --to=srostedt@redhat.com \
    --cc=Keir.Fraser@cl.cam.ac.uk \
    --cc=herbert.xu@redhat.com \
    --cc=susie.li@intel.com \
    --cc=wilfred.yu@intel.com \
    --cc=xen-devel@lists.xensource.com \
    --cc=xiaohui.xin@intel.com \
    --cc=xin.b.li@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 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.