From: Ian Campbell <Ian.Campbell@eu.citrix.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: "H. Peter Anvin" <hpa@linux.intel.com>,
Borislav Petkov <bp@alien8.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH] x86: use pgd accessors when cloning a pgd range.
Date: Wed, 27 Oct 2010 19:02:08 +0100 [thread overview]
Message-ID: <1288202528.10179.106.camel@localhost.localdomain> (raw)
In-Reply-To: <4CC866B0.8000802@goop.org>
On Wed, 2010-10-27 at 18:51 +0100, Jeremy Fitzhardinge wrote:
> On 10/27/2010 10:42 AM, H. Peter Anvin wrote:
> > Ian's message just mentioned "a failure" and never described in any way what
> > kind of "failure" it was.
>
> It would be a pagefault from Xen preventing a direct write to the pgd
> level of an active pagetable. At the point in setup_arch() where it
> does the first clone_pgd_range() we're already running on swapper_pg_dir
> and the copy from initial_page_table is outright wrong.
I'd missed that aspect, yes the contents of initial_page_table are
wrong. I'm not sure now how my patch to clone_pgd_range even made a
difference...
> As Ian suggests, we could switch Xen to use initial_page_table at boot
> then move to swapper_pg_dir in the same way native does.
Accidentally did that in private mail, for everyone else the gory
details are:
> xen_setup_kernel_pagetable operates on initial_page_table instead of
> swapper_pg_dir. We do not pin initial_page_table apart from the
> implicit
> one from writing it to cr3 (it is necessarily r/o though).
>
> So we enter setup_arch running on initial_page_table and with
> swapper_pg_dir mapped r/w, which is how it looks on native too. So at
> this point the:
> clone_pgd_range(swapper_pg_dir + KERNEL_PGD_BOUNDARY,
> initial_page_table + KERNEL_PGD_BOUNDARY,
> KERNEL_PGD_PTRS);
> works just fine and we reach:
> load_cr3(swapper_pg_dir);
>
> Then in __xen_write_cr3 we notice the first attempt to switch to
> swapper_pg_dir and only at that point do we make it r/o and pin it.
> When
> we then actually do the switch to swapper_pg_dir that releases the
> implicit pin on initial_page_table so we can make it r/o again.
>
> The later on we reach the:
> clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY,
> swapper_pg_dir + KERNEL_PGD_BOUNDARY,
> KERNEL_PGD_PTRS);
> which will succeed because initial_page_table is r/w again.
>
> We don't care about the pin on initial_page_table because we should
> never need it again.
Ian.
next prev parent reply other threads:[~2010-10-27 18:02 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 8:50 Ian Campbell
2010-10-27 10:40 ` Borislav Petkov
2010-10-27 16:50 ` Jeremy Fitzhardinge
2010-10-27 17:18 ` H. Peter Anvin
2010-10-27 17:31 ` Jeremy Fitzhardinge
2010-10-27 17:42 ` H. Peter Anvin
2010-10-27 17:51 ` Ian Campbell
2010-10-27 17:51 ` Jeremy Fitzhardinge
2010-10-27 18:02 ` Ian Campbell [this message]
2010-10-27 18:11 ` H. Peter Anvin
2010-10-27 18:51 ` Jeremy Fitzhardinge
2010-10-27 19:00 ` H. Peter Anvin
2010-10-27 19:02 ` H. Peter Anvin
2010-10-27 17:44 ` Borislav Petkov
2010-10-27 17:54 ` Jeremy Fitzhardinge
2010-10-27 17:58 ` Ian Campbell
2010-10-28 9:23 ` Ian Campbell
2010-10-28 11:20 ` Borislav Petkov
2010-10-28 11:53 ` Ian Campbell
2010-10-28 15:49 ` H. Peter Anvin
2010-10-28 15:48 ` H. Peter Anvin
2010-11-03 15:35 ` Ian Campbell
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=1288202528.10179.106.camel@localhost.localdomain \
--to=ian.campbell@eu.citrix.com \
--cc=bp@alien8.de \
--cc=hpa@linux.intel.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®