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]
Date:	Thu, 13 Dec 2012 14:01:59 -0800
From:	Yinghai Lu <yinghai@...nel.org>
To:	Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...e.hu>,
	"H. Peter Anvin" <hpa@...or.com>
Cc:	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH v6 05/27] x86, 64bit: clear ident mapping when kernel is above 512G

After following patch:
	x86, 64bit: Set extra ident mapping for whole kernel range

We have extra ident mapping for kernel that is loaded above 1G.

So need to clear extra pgd entry when kernel is loaded above 512g.

Signed-off-by: Yinghai Lu <yinghai@...nel.org>
---
 arch/x86/kernel/head64.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 037df57..3ef9ce6 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -29,7 +29,17 @@
 static void __init zap_identity_mappings(void)
 {
 	pgd_t *pgd = pgd_offset_k(0UL);
+	unsigned long pa_text = __pa_symbol(_text);
+	unsigned long pa_end = __pa_symbol(_end);
+
 	pgd_clear(pgd);
+
+	/* When kernel is loaded above 512G */
+	if (pa_text >= PGDIR_SIZE)
+		pgd_clear(pgd + pgd_index(pa_text));
+	if (pa_end - 1 >= PGDIR_SIZE)
+		pgd_clear(pgd + pgd_index(pa_end - 1));
+
 	__flush_tlb_all();
 }
 
-- 
1.7.10.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