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: <1405452884-25688-11-git-send-email-toshi.kani@hp.com>
Date:	Tue, 15 Jul 2014 13:34:43 -0600
From:	Toshi Kani <toshi.kani@...com>
To:	hpa@...or.com, tglx@...utronix.de, mingo@...hat.com,
	akpm@...ux-foundation.org, arnd@...db.de, konrad.wilk@...cle.com,
	plagnioj@...osoft.com, tomi.valkeinen@...com
Cc:	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	stefan.bader@...onical.com, luto@...capital.net, airlied@...il.com,
	bp@...en8.de, Toshi Kani <toshi.kani@...com>
Subject: [RFC PATCH 10/11] x86, xen: Cleanup PWT/PCD bit manipulation in Xen

This patch cleans up the PWT & PCD bit manipulation for the kernel
memory types in Xen, and uses _PAGE_CACHE_<type> macros, instead.
This keeps the Xen code independent from the PAT slot assignment.

Signed-off-by: Toshi Kani <toshi.kani@...com>
---
 arch/x86/xen/enlighten.c |    2 +-
 arch/x86/xen/mmu.c       |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index ffb101e..1917bef 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1557,7 +1557,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
 #if 0
 	if (!xen_initial_domain())
 #endif
-		__supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);
+		__supported_pte_mask &= ~_PAGE_CACHE_MASK;
 
 	__supported_pte_mask |= _PAGE_IOMAP;
 
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index e8a1201..8ef154a 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -438,7 +438,7 @@ __visible pteval_t xen_pte_val(pte_t pte)
 	/* If this is a WC pte, convert back from Xen WC to Linux WC */
 	if ((pteval & (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT)) == _PAGE_PAT) {
 		WARN_ON(!pat_enabled);
-		pteval = (pteval & ~_PAGE_PAT) | _PAGE_PWT;
+		pteval = (pteval & ~_PAGE_PAT) | _PAGE_CACHE_WC;
 	}
 #endif
 	if (xen_initial_domain() && (pteval & _PAGE_IOMAP))
@@ -465,11 +465,11 @@ PV_CALLEE_SAVE_REGS_THUNK(xen_pgd_val);
  * 0                     WB       WB     WB
  * 1            PWT      WC       WT     WT
  * 2        PCD          UC-      UC-    UC-
- * 3        PCD PWT      UC       UC     UC
+ * 3        PCD PWT      WT       UC     UC
  * 4    PAT              WB       WC     WB
  * 5    PAT     PWT      WC       WP     WT
  * 6    PAT PCD          UC-      rsv    UC-
- * 7    PAT PCD PWT      UC       rsv    UC
+ * 7    PAT PCD PWT      WT       rsv    UC
  */
 
 void xen_set_pat(u64 pat)
@@ -492,7 +492,7 @@ __visible pte_t xen_make_pte(pteval_t pte)
 	 * but we could see hugetlbfs mappings, I think.).
 	 */
 	if (pat_enabled && !WARN_ON(pte & _PAGE_PAT)) {
-		if ((pte & (_PAGE_PCD | _PAGE_PWT)) == _PAGE_PWT)
+		if ((pte & _PAGE_CACHE_MASK) == _PAGE_CACHE_WC)
 			pte = (pte & ~(_PAGE_PCD | _PAGE_PWT)) | _PAGE_PAT;
 	}
 #endif
--
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