lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1437083021-24488-4-git-send-email-boris.ostrovsky@oracle.com>
Date:	Thu, 16 Jul 2015 17:43:38 -0400
From:	Boris Ostrovsky <boris.ostrovsky@...cle.com>
To:	david.vrabel@...rix.com, konrad.wilk@...cle.com
Cc:	roger.pau@...rix.com, elena.ufimtseva@...cle.com,
	stefano.stabellini@...citrix.com, tim@....org, jbeulich@...e.com,
	andrew.cooper3@...rix.com, ian.campbell@...rix.com,
	ian.jackson@...citrix.com, xen-devel@...ts.xenproject.org,
	linux-kernel@...r.kernel.org, boris.ostrovsky@...cle.com
Subject: [PATCH v2 3/6] xen/x86/pvh: Properly set page tables for 32-bit PVH guests

32-bit PVH guests don't want to write-protect/pin page tables.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@...cle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
---
 arch/x86/xen/mmu.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index dd151b2..b473df8 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1762,8 +1762,9 @@ void __init xen_setup_machphys_mapping(void)
 		machine_to_phys_nr = MACH2PHYS_NR_ENTRIES;
 	}
 #ifdef CONFIG_X86_32
-	WARN_ON((machine_to_phys_mapping + (machine_to_phys_nr - 1))
-		< machine_to_phys_mapping);
+	if (!xen_feature(XENFEAT_auto_translated_physmap))
+		WARN_ON((machine_to_phys_mapping + (machine_to_phys_nr - 1))
+			< machine_to_phys_mapping);
 #endif
 }
 
@@ -1958,15 +1959,18 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
 	initial_page_table[KERNEL_PGD_BOUNDARY] =
 		__pgd(__pa(initial_kernel_pmd) | _PAGE_PRESENT);
 
-	set_page_prot(initial_kernel_pmd, PAGE_KERNEL_RO);
-	set_page_prot(initial_page_table, PAGE_KERNEL_RO);
-	set_page_prot(empty_zero_page, PAGE_KERNEL_RO);
+	if (!xen_feature(XENFEAT_auto_translated_physmap)) {
+		set_page_prot(initial_kernel_pmd, PAGE_KERNEL_RO);
+		set_page_prot(initial_page_table, PAGE_KERNEL_RO);
+		set_page_prot(empty_zero_page, PAGE_KERNEL_RO);
 
-	pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));
+		pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));
 
-	pin_pagetable_pfn(MMUEXT_PIN_L3_TABLE,
-			  PFN_DOWN(__pa(initial_page_table)));
-	xen_write_cr3(__pa(initial_page_table));
+		pin_pagetable_pfn(MMUEXT_PIN_L3_TABLE,
+				  PFN_DOWN(__pa(initial_page_table)));
+		xen_write_cr3(__pa(initial_page_table));
+	} else
+		native_write_cr3(__pa(initial_page_table));
 
 	memblock_reserve(__pa(xen_start_info->pt_base),
 			 xen_start_info->nr_pt_frames * PAGE_SIZE);
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ