From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Andi Kleen <ak@suse.de>
Cc: Chris Wright <chrisw@sous-sol.org>,
virtualization@lists.osdl.org,
Andrew Morton <akpm@linux-foundation.org>,
lkml <linux-kernel@vger.kernel.org>,
"\"Eric W. Biederman\"" <ebiederm@xmission.com>
Subject: [patch 11/32] xen: ignore RW mapping of RO pages in pagetable_init
Date: Sun, 29 Apr 2007 10:28:46 -0700 [thread overview]
Message-ID: <20070429172912.710019000@goop.org> (raw)
In-Reply-To: 20070429172835.284784000@goop.org
[-- Attachment #1: xen-pagetable_init-ignore-ro-mappings.patch --]
[-- Type: text/plain, Size: 2503 bytes --]
When setting up the initial pagetable, which includes mappings of all
low physical memory, ignore a mapping which tries to set the RW bit on
an RO pte. An RO pte indicates a page which is part of the current
pagetable, and so it cannot be allowed to become RW.
Once xen_pagetable_setup_done is called, set_pte reverts to its normal
behaviour.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: ebiederm@xmission.com (Eric W. Biederman)
---
arch/i386/xen/enlighten.c | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
===================================================================
--- a/arch/i386/xen/enlighten.c
+++ b/arch/i386/xen/enlighten.c
@@ -635,7 +635,7 @@ static void xen_write_cr3(unsigned long
/* Early in boot, while setting up the initial pagetable, assume
everything is pinned. */
-static void xen_alloc_pt_init(struct mm_struct *mm, u32 pfn)
+static __init void xen_alloc_pt_init(struct mm_struct *mm, u32 pfn)
{
BUG_ON(mem_map); /* should only be used early */
make_lowmem_page_readonly(__va(PFN_PHYS(pfn)));
@@ -687,9 +687,31 @@ static void *xen_kmap_atomic_pte(struct
}
#endif
+static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte)
+{
+ /* If there's an existing pte, then don't allow _PAGE_RW to be set */
+ if (pte_val_ma(*ptep) & _PAGE_PRESENT)
+ pte = __pte_ma(((pte_val_ma(*ptep) & _PAGE_RW) | ~_PAGE_RW) &
+ pte_val_ma(pte));
+
+ return pte;
+}
+
+/* Init-time set_pte while constructing initial pagetables, which
+ doesn't allow RO pagetable pages to be remapped RW */
+static __init void xen_set_pte_init(pte_t *ptep, pte_t pte)
+{
+ pte = mask_rw_pte(ptep, pte);
+
+ xen_set_pte(ptep, pte);
+}
+
static __init void xen_pagetable_setup_start(pgd_t *base)
{
pgd_t *xen_pgd = (pgd_t *)xen_start_info->pt_base;
+
+ /* special set_pte for pagetable initialization */
+ paravirt_ops.set_pte = xen_set_pte_init;
init_mm.pgd = base;
/*
@@ -737,6 +759,7 @@ static __init void xen_pagetable_setup_d
/* This will work as long as patching hasn't happened yet
(which it hasn't) */
paravirt_ops.alloc_pt = xen_alloc_pt;
+ paravirt_ops.set_pte = xen_set_pte;
if (!xen_feature(XENFEAT_auto_translated_physmap)) {
/*
@@ -919,7 +942,7 @@ static const struct paravirt_ops xen_par
.dup_mmap = xen_dup_mmap,
.exit_mmap = xen_exit_mmap,
- .set_pte = xen_set_pte,
+ .set_pte = NULL, /* see xen_pagetable_setup_* */
.set_pte_at = xen_set_pte_at,
.set_pmd = xen_set_pmd,
--
next prev parent reply other threads:[~2007-04-29 17:28 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-29 17:28 [patch 00/32] xen: Xen implementation for paravirt_ops Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 01/32] xen: Add apply_to_page_range() which applies a function to a pte range Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 02/32] xen: Allocate and free vmalloc areas Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 03/32] xen: Add nosegneg capability to the vsyscall page notes Jeremy Fitzhardinge
2007-04-29 19:08 ` Roland McGrath
2007-04-30 4:54 ` Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 04/32] xen: Add Xen interface header files Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 05/32] xen: Core Xen implementation Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 06/32] xen: Xen virtual mmu Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 07/32] xen: xen event channels Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 08/32] xen: xen time implementation Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 09/32] xen: xen configuration Jeremy Fitzhardinge
2007-04-30 22:36 ` Zachary Amsden
2007-05-01 3:37 ` Andi Kleen
2007-04-29 17:28 ` [patch 10/32] xen: Complete pagetable pinning for Xen Jeremy Fitzhardinge
2007-04-29 17:28 ` Jeremy Fitzhardinge [this message]
2007-04-29 17:28 ` [patch 12/32] xen: fix multicall batching Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 13/32] xen: Account for time stolen by Xen Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 14/32] xen: Implement xen_sched_clock Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 15/32] xen: Xen SMP guest support Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 16/32] xen: Add support for preemption Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 17/32] xen: lazy-mmu operations Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 18/32] xen: deal with negative stolen time Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 19/32] xen: xen time fixups Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 20/32] xen: Use the hvc console infrastructure for Xen console Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 21/32] xen: Add early printk support via hvc console Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 22/32] xen: Add Xen grant table support Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 23/32] xen: Add the Xenbus sysfs and virtual device hotplug driver Jeremy Fitzhardinge
2007-04-29 17:28 ` [patch 24/32] xen: use xenbus_watch_pathfmt rather than watch_path2 Jeremy Fitzhardinge
2007-04-29 17:29 ` [patch 25/32] xen: rename dev_changed to xenbus_dev_changed Jeremy Fitzhardinge
2007-04-29 17:29 ` [patch 26/32] xen: Add Xen virtual block device driver Jeremy Fitzhardinge
2007-04-29 18:16 ` Christoph Hellwig
2007-04-30 18:52 ` Jeremy Fitzhardinge
2007-04-29 17:29 ` [patch 27/32] xen: Add the Xen virtual network " Jeremy Fitzhardinge
2007-04-29 17:59 ` Christoph Hellwig
2007-04-30 18:11 ` Jeremy Fitzhardinge
2007-04-29 17:29 ` [patch 28/32] xen: xen-netfront: use skb.cb for storing private data Jeremy Fitzhardinge
2007-04-29 17:29 ` [patch 29/32] xen: Lockdep fixes for xen-netfront Jeremy Fitzhardinge
2007-04-29 17:29 ` [patch 30/32] xen: diddle netfront Jeremy Fitzhardinge
2007-04-29 17:29 ` [patch 31/32] xen: --- drivers/net/xen-netfront.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Jeremy Fitzhardinge
2007-05-02 6:33 ` Herbert Xu
2007-05-02 6:45 ` Chris Wright
2007-05-02 6:48 ` Jeremy Fitzhardinge
2007-04-29 17:29 ` [patch 32/32] xen: Xen machine operations Jeremy Fitzhardinge
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=20070429172912.710019000@goop.org \
--to=jeremy@goop.org \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=chrisw@sous-sol.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=virtualization@lists.osdl.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;
as well as URLs for NNTP newsgroup(s).