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: <20080426095938.GB17905@one.firstfloor.org>
Date:	Sat, 26 Apr 2008 11:59:38 +0200
From:	Andi Kleen <andi@...stfloor.org>
To:	Christoph Lameter <clameter@....com>
Cc:	Andi Kleen <andi@...stfloor.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Jiri Slaby <jirislaby@...il.com>,
	David Miller <davem@...emloft.net>, zdenek.kabelac@...il.com,
	rjw@...k.pl, paulmck@...ux.vnet.ibm.com, akpm@...ux-foundation.org,
	linux-ext4@...r.kernel.org, herbert@...dor.apana.org.au,
	penberg@...helsinki.fi, linux-kernel@...r.kernel.org,
	Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>,
	pageexec@...email.hu, "H. Peter Anvin" <hpa@...or.com>,
	Jeremy Fitzhardinge <jeremy@...p.org>,
	Ingo Molnar <mingo@...e.hu>
Subject: Re: [PATCH 1/1] x86: fix text_poke

On Fri, Apr 25, 2008 at 12:36:33PM -0700, Christoph Lameter wrote:
> On Fri, 25 Apr 2008, Andi Kleen wrote:
> 
> > > And we should really add a lot more sanity checking there.
> > 
> > A debug mode for virt_to_page(),__pa,__va et.al. would probably make sense
> > and would have caught it.
> > 
> > I used to have that partly in the x86-64 port with VIRTUAL_BUG_ON.
> 
> Good idea! Do you have a patch?

Yes. Appended. But it just enables the old NUMA VIRTUAL_BUG_ON()s, more 
work could be done e.g. by instrumenting pa/va and the non NUMA and i386 
case too.

-Andi

---


Add CONFIG option to enable VIRTUAL_BUG_ON()

VIRTUAL_BUG_ON was used in the early days of x86-64 NUMA to debug the 
virtual address to struct page code.

Later it was noped, but the call kept intact.

Add a CONFIG option to enable it as a BUG_ON again. This would have
likely caught the recent text_poke bug.

Signed-off-by: Andi Kleen <andi@...stfloor.org>

Index: linux/arch/x86/Kconfig.debug
===================================================================
--- linux.orig/arch/x86/Kconfig.debug
+++ linux/arch/x86/Kconfig.debug
@@ -245,4 +245,11 @@ config CPA_DEBUG
 	help
 	  Do change_page_attr() self-tests every 30 seconds.
 
+config DEBUG_VIRTUAL
+	bool "Virtual memory translation debugging"
+	depends on DEBUG_KERNEL && NUMA && X86_64
+	help
+	  Enable some costly sanity checks in the NUMA virtual to page
+          code.  This can catch mistakes with virt_to_page() and friends.
+
 endmenu
Index: linux/include/asm-x86/mmzone_64.h
===================================================================
--- linux.orig/include/asm-x86/mmzone_64.h
+++ linux/include/asm-x86/mmzone_64.h
@@ -7,7 +7,11 @@
 
 #ifdef CONFIG_NUMA
 
+#ifdef CONFIG_DEBUG_VIRTUAL
+#define VIRTUAL_BUG_ON(x) BUG_ON(x)
+#else
 #define VIRTUAL_BUG_ON(x)
+#endif
 
 #include <asm/smp.h>
 
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ