From: "Stephen C. Tweedie" <sct@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>,
Herbert Xu <herbert.xu@redhat.com>, Susie Li <susie.li@intel.com>,
Steven Rostedt <srostedt@redhat.com>,
"Li, Xin B" <xin.b.li@intel.com>
Subject: Re: [Patch] Fix for x86_64 boot failures due to bad segment setup for protected mode.
Date: Thu, 09 Nov 2006 12:32:32 +0000 [thread overview]
Message-ID: <1163075552.6555.13.camel@sisko.scot.redhat.com> (raw)
In-Reply-To: <C1789DB2.40E9%Keir.Fraser@cl.cam.ac.uk>
Hi,
On Thu, 2006-11-09 at 08:56 +0000, 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'?
I tried to change the code as little as possible to minimise
regressions, as I don't have the full battery of guest OSes to test.
But the intention at least was that the guest shouldn't change much as a
result of the patch. We're still running entirely in vmxassist
VM86_REAL_TO_PROTECTED mode during the change; the actual vmcs does not
get changed until we go to VM86_PROTECTED mode (and not at all if we
return to real mode before getting that far.)
So the guest selectors as far as the CPU is concerned are still the
selectors we set up to run vmxassist; and the selectors in effect as far
as the emulated guest OS code is concerned remains the old 16-bit
segments that vmxassist uses during that emulation.
The numerical offset that the guest sees as a selector when reading
es/ds etc. should not change, as the patch doesn't touch regs at all.
This actually highlights the fact that vmxassist's emulation for real-
to-protected mode is pretty minimal, and in fact it passes the buck to
VMENTER earlier than it should. It does so as soon as CS goes 32-bit,
but the other registers are still 16 bit and there's no theoretical
reason why a guest couldn't try to access 16-bit data/stack segments
from a 32-bit CS. I haven't touched any of that --- the logic is still
that when we drop to true 32-bit VMENTER, segments that were 16-bit are
cleared. I just changed the logic to make sure that we are better at
detecting which segments still contain 16-bit descriptors, and which
ones have been reloaded from the GDT and hence should survive into 32-
bit mode.
The fact that each segment has multiple different interpretations here
--- in the vmxassist context itself, in the guest VMCS, and in the guest
visible register set, doesn't help the discussion so I may have
misunderstood your question or been unclear in my reply!
Cheers,
Stephen
next prev parent reply other threads:[~2006-11-09 12:32 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 [this message]
2006-11-09 12:56 ` Steven Rostedt
[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=1163075552.6555.13.camel@sisko.scot.redhat.com \
--to=sct@redhat.com \
--cc=Keir.Fraser@cl.cam.ac.uk \
--cc=herbert.xu@redhat.com \
--cc=srostedt@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.