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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:	Thu, 8 May 2008 20:56:21 +0200
From:	Vegard Nossum <vegard.nossum@...il.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	Pekka Enberg <penberg@...helsinki.fi>, linux-kernel@...r.kernel.org
Subject: [PATCH] kmemcheck: custom queue size and overflow detection

Hi,

This is also missing from x86.git. Thanks.

Vegard


>From 7966e04efed4c52bc0d09e8aa5ae47e9aa225a6a Mon Sep 17 00:00:00 2001
From: Vegard Nossum <vegard.nossum@...il.com>
Date: Thu, 1 May 2008 19:26:06 +0200
Subject: [PATCH] kmemcheck: custom queue size and overflow detection

Add an option to Kconfig to set the size of the queue/buffer which
kmemcheck uses to report errors. Also keep count on how many times this
buffer was overflowed (e.g. the number of "lost reports") so this can be
printed as well.

Signed-off-by: Vegard Nossum <vegard.nossum@...il.com>
---
 arch/x86/Kconfig.debug      |   11 +++++++++++
 arch/x86/kernel/kmemcheck.c |   14 ++++++++++++--
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 5d3e83a..255d054 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -287,6 +287,17 @@ config KMEMCHECK_ONESHOT_BY_DEFAULT
 
 endchoice
 
+config KMEMCHECK_QUEUE_SIZE
+	int "kmemcheck: error queue size"
+	depends on KMEMCHECK
+	default 64
+	help
+	  Select the maximum number of errors to store in the queue. This
+	  queue will be emptied once every second, so this is effectively a
+	  limit on how many reports to print in one go. Note however, that
+	  if the number of errors occuring between two bursts is larger than
+	  this number, the extra error reports will get lost.
+
 config KMEMCHECK_PARTIAL_OK
 	bool "kmemcheck: allow partially uninitialized memory"
 	depends on KMEMCHECK
diff --git a/arch/x86/kernel/kmemcheck.c b/arch/x86/kernel/kmemcheck.c
index 408ba6d..ebdbe20 100644
--- a/arch/x86/kernel/kmemcheck.c
+++ b/arch/x86/kernel/kmemcheck.c
@@ -61,10 +61,11 @@ struct kmemcheck_error {
  * from the kmemcheck traps, since this may call the console drivers and
  * result in a recursive fault.
  */
-static struct kmemcheck_error error_fifo[32];
+static struct kmemcheck_error error_fifo[CONFIG_KMEMCHECK_QUEUE_SIZE];
 static unsigned int error_count;
 static unsigned int error_rd;
 static unsigned int error_wr;
+static unsigned int error_missed_count;
 
 static struct timer_list kmemcheck_timer;
 
@@ -73,8 +74,10 @@ error_next_wr(void)
 {
 	struct kmemcheck_error *e;
 
-	if (error_count == ARRAY_SIZE(error_fifo))
+	if (error_count == ARRAY_SIZE(error_fifo)) {
+		++error_missed_count;
 		return NULL;
+	}
 
 	e = &error_fifo[error_wr];
 	if (++error_wr == ARRAY_SIZE(error_fifo))
@@ -194,6 +197,13 @@ do_wakeup(unsigned long data)
 {
 	while (error_count > 0)
 		error_recall();
+
+	if (error_missed_count > 0) {
+		printk(KERN_WARNING "kmemcheck: Lost %d error reports because "
+			"the queue was too small\n", error_missed_count);
+		error_missed_count = 0;
+	}
+
 	mod_timer(&kmemcheck_timer, kmemcheck_timer.expires + HZ);
 }
 
-- 
1.5.4.1

--
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