Skip to contentSkip to conversation

linux/x86-64: force _PAGE_NX on the 1:1 mapping (matching native)

PATCH New Jan Beulich 1 participant 1 message May 15, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux/x86-64: force _PAGE_NX on the 1:1 mapping (matching native)

arch/x86_64/mm/init-xen.c +7 -10
Index: head-2007-04-27/arch/x86_64/mm/init-xen.c
===================================================================
@@ -479,18 +479,15 @@ phys_pmd_init(pmd_t *pmd_page, unsigned 
 		pte = alloc_static_page(&pte_phys);
 		pte_save = pte;
 		for (k = 0; k < PTRS_PER_PTE; pte++, k++, address += PTE_SIZE) {
+			unsigned long pteval = address | _PAGE_NX | _KERNPG_TABLE;
+
 			if ((address >= end) ||
 			    ((address >> PAGE_SHIFT) >=
-			     xen_start_info->nr_pages)) { 
-				__set_pte(pte, __pte(0)); 
-				continue;
-			}
-			if (make_readonly(address)) {
-				__set_pte(pte, 
-					  __pte(address | (_KERNPG_TABLE & ~_PAGE_RW)));
-				continue;
-			}
-			__set_pte(pte, __pte(address | _KERNPG_TABLE));
+			     xen_start_info->nr_pages))
+				pteval = 0;
+			else if (make_readonly(address))
+				pteval &= ~_PAGE_RW;
+			__set_pte(pte, __pte(pteval & __supported_pte_mask));
 		}
 		pte = pte_save;
 		early_make_page_readonly(pte, XENFEAT_writable_page_tables);