WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Fix x86/64 pagetable initialisation so that only things

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Fix x86/64 pagetable initialisation so that only things that
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 24 Aug 2005 15:24:14 +0000
Delivery-date: Wed, 24 Aug 2005 15:22:57 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID c42a9e2f6c5b270cbcbfc9b918de9b66750448b3
# Parent  bca2fd76995ea8c811cc52a7edaabaeae03a677a
Fix x86/64 pagetable initialisation so that only things that
need to be are mapped read-only.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r bca2fd76995e -r c42a9e2f6c5b 
linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c
--- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c    Wed Aug 24 15:21:48 2005
+++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c    Wed Aug 24 15:22:44 2005
@@ -441,6 +441,31 @@
        *dst = val;
 }
 
+static inline int make_readonly(unsigned long paddr)
+{
+    int readonly = 0;
+
+    /* Make new page tables read-only. */
+    if ((paddr < ((table_start << PAGE_SHIFT) + tables_space)) &&
+        (paddr >= (table_start << PAGE_SHIFT)))
+        readonly = 1;
+
+    /* Make old page tables read-only. */
+    if ((paddr < ((xen_start_info.pt_base - __START_KERNEL_map) +
+                  (xen_start_info.nr_pt_frames << PAGE_SHIFT))) &&
+        (paddr >= (xen_start_info.pt_base - __START_KERNEL_map)))
+        readonly = 1;
+
+    /*
+     * No need for writable mapping of kernel image. This also ensures that
+     * page and descriptor tables embedded inside don't have writable mappings.
+     */
+    if ((paddr >= __pa_symbol(&_text)) && (paddr < __pa_symbol(&_end)))
+        readonly = 1;
+
+    return readonly;
+}
+
 void __init phys_pud_init(pud_t *pud, unsigned long address, unsigned long end)
 { 
         long i, j, k; 
@@ -477,9 +502,7 @@
                         pte = alloc_low_page(&pte_phys);
                         pte_save = pte;
                         for (k = 0; k < PTRS_PER_PTE; pte++, k++, paddr += 
PTE_SIZE) {
-                                if (paddr < (table_start << PAGE_SHIFT) 
-                                    + tables_space)
-                                {
+                                if (make_readonly(paddr)) {
                                         __set_pte(pte, 
                                                 __pte(paddr | (_KERNPG_TABLE & 
~_PAGE_RW)));
                                         continue;
diff -r bca2fd76995e -r c42a9e2f6c5b xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Wed Aug 24 15:21:48 2005
+++ b/xen/arch/x86/mm.c Wed Aug 24 15:22:44 2005
@@ -1449,8 +1449,10 @@
                     if ( ((x & PGT_type_mask) != PGT_l2_page_table) ||
                          ((type & PGT_type_mask) != PGT_l1_page_table) )
                         MEM_LOG("Bad type (saw %" PRtype_info
-                                "!= exp %" PRtype_info ") for pfn %lx",
-                                x, type, page_to_pfn(page));
+                                "!= exp %" PRtype_info ") "
+                                "for mfn %lx (pfn %x)",
+                                x, type, page_to_pfn(page),
+                                machine_to_phys_mapping[page_to_pfn(page)]);
                     return 0;
                 }
                 else if ( (x & PGT_va_mask) == PGT_va_mutable )

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Fix x86/64 pagetable initialisation so that only things that, Xen patchbot -unstable <=