[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] ix86: don't subvert setting NX during 1:1 mapping setup


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Mon, 22 Feb 2016 14:33:03 +0000
  • Delivery-date: Mon, 22 Feb 2016 14:33:11 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1456150644 -3600
#      Mon Feb 22 15:17:24 2016 +0100
# Node ID c13c5210b623867c1ac88b14183a051152b1febd
# Parent  a2856e4ff93b7a8e70c1b2334375ac76d29e01d8
ix86: don't subvert setting NX during 1:1 mapping setup

Since the hypervisor or tool stack don't set that flag upon domain
creation, we shouldn't blindly skip present page table entries.
Instead, if NX is supported/enabled, we need to re-write them with
the flag set.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r a2856e4ff93b -r c13c5210b623 arch/i386/mm/init-xen.c
--- a/arch/i386/mm/init-xen.c   Thu Dec 17 15:42:36 2015 +0100
+++ b/arch/i386/mm/init-xen.c   Mon Feb 22 15:17:24 2016 +0100
@@ -204,12 +204,22 @@ static void __init kernel_physical_mappi
                                pte += pte_ofs;
                                for (; pte_ofs < PTRS_PER_PTE && pfn < 
max_low_pfn; pte++, pfn++, pte_ofs++) {
                                                /* XEN: Only map initial RAM 
allocation. */
-                                               if ((pfn >= max_ram_pfn) || 
pte_present(*pte))
+                                               if (pfn >= max_ram_pfn)
                                                        continue;
-                                               if (is_kernel_text(address))
+                                               if (is_kernel_text(address)) {
+                                                       if (pte_present(*pte))
+                                                               continue;
                                                        set_pte(pte, 
pfn_pte(pfn, PAGE_KERNEL_EXEC));
-                                               else
-                                                       set_pte(pte, 
pfn_pte(pfn, PAGE_KERNEL));
+                                               } else if (pte_present(*pte) &&
+                                                          
!(__supported_pte_mask & _PAGE_NX))
+                                                       continue;
+                                               else {
+                                                       pgprot_t prot = 
PAGE_KERNEL;
+
+                                                       if (pte_present(*pte) 
&& !pte_write(*pte))
+                                                               
pgprot_val(prot) &= ~_PAGE_RW;
+                                                       set_pte(pte, 
pfn_pte(pfn, prot));
+                                               }
                                }
                                pte_ofs = 0;
                        }

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.