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-next>] [day] [month] [year] [list]
Date:	Fri, 13 Apr 2007 14:49:57 -0700
From:	"H. Peter Anvin" <hpa@...or.com>
To:	Jeremy Fitzhardinge <jeremy@...p.org>
Cc:	Andi Kleen <ak@...e.de>, Andrew Morton <akpm@...ux-foundation.org>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	"H. Peter Anvin" <hpa@...or.com>, Zachary Amsden <zach@...are.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [PATCH] i386: For debugging, make the initial page table setup less forgiving.

We just discovered that the accounting for initial memory usage
(head.S: INIT_MAP_BEYOND_END) has been way, way off for a very long
time.  This patch makes the initial page table not round up to the
nearest 4M boundary, but instead stop dead (and zero the rest of the
final page table) as soon as it hits the configured limit.

This patch is intended as a debugging aid.  If it goes into the
kernel, it should go in at the very beginning of a review cycle, as it
may very well expose real failures (without Jeremy's patch to fix the
accounting, it *will* crash.)

Signed-off-by: H. Peter Anvin <hpa@...or.com>

diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
index 3fa7f93..db6735a 100644
--- a/arch/i386/kernel/head.S
+++ b/arch/i386/kernel/head.S
@@ -131,15 +131,27 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
 	movl %ecx,page_pde_offset(%edx)		/* Store kernel PDE entry */
 	addl $4,%edx
 	movl $1024, %ecx
+	/*
+	 * End condition: we must map up to and including
+	 * INIT_MAP_BEYOND_END bytes beyond the end of our
+	 * own page tables; 0x1000 is the size of the page
+	 * table were about to write, and +0x007 is the
+	 * attribute bits.
+	 */
+	leal (INIT_MAP_BEYOND_END+0x1000+0x007)(%edi),%ebp
 11:
 	stosl
 	addl $0x1000,%eax
-	loop 11b
-	/* End condition: we must map up to and including INIT_MAP_BEYOND_END */
-	/* bytes beyond the end of our own page tables; the +0x007 is the attribute bits */
-	leal (INIT_MAP_BEYOND_END+0x007)(%edi),%ebp
 	cmpl %ebp,%eax
-	jb 10b
+	jae 12f
+	loop 11b
+	jmp 10b
+12:
+	/* Clear the remainder of the last page table */
+	decl %ecx
+	xorl %eax,%eax
+	rep; stosl
+	
 	movl %edi,(init_pg_tables_end - __PAGE_OFFSET)
 
 	xorl %ebx,%ebx				/* This is the boot CPU (BSP) */
-
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