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: <20070430174405.GF19966@holomorphy.com>
Date:	Mon, 30 Apr 2007 10:44:05 -0700
From:	William Lee Irwin III <wli@...omorphy.com>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	Christoph Hellwig <hch@...radead.org>,
	Alan Cox <alan@...rguk.ukuu.org.uk>,
	David Chinner <dgc@....com>, Zan Lynx <zlynx@....org>,
	Adrian Bunk <bunk@...sta.de>,
	Linux Kernel <linux-kernel@...r.kernel.org>
Subject: [3/6] make IRQ stacks independently configurable (was: Re: [-mm patch] i386: enable 4k stacks by default)

On Mon, Apr 30, 2007 at 10:38:19AM -0700, William Lee Irwin III wrote:
> Here's what I did for i386 for someone concerned about blowing the stack.

Divorce IRQ stack configuration from CONFIG_4KSTACKS, as it's believed to
be an important safety measure regardless of stack size by some users.

Signed-off-by: William Irwin <wli@...omorphy.com>


Index: stack-paranoia/arch/i386/Kconfig.debug
===================================================================
--- stack-paranoia.orig/arch/i386/Kconfig.debug	2007-04-30 10:32:56.182682722 -0700
+++ stack-paranoia/arch/i386/Kconfig.debug	2007-04-30 10:34:07.058721717 -0700
@@ -35,6 +35,14 @@
 
 	  This option will slow down process creation somewhat.
 
+config IRQSTACKS
+	bool "IRQ stacks"
+	depends on DEBUG_KERNEL
+	help
+	  Arranges for per-cpu interrupt stacks so that interrupts
+	  and interrupt-time processing don't consume space on task
+	  stacks.
+
 config VMALLOC_STACK
 	bool "vmalloc() the stack"
 	depends on DEBUG_KERNEL
@@ -76,8 +84,7 @@
 	  If you say Y here the kernel will use a 4Kb stacksize for the
 	  kernel stack attached to each process/thread. This facilitates
 	  running more threads on a system and also reduces the pressure
-	  on the VM subsystem for higher order allocations. This option
-	  will also use IRQ stacks to compensate for the reduced stackspace.
+	  on the VM subsystem for higher order allocations.
 
 config 8KSTACKS
 	bool "Use 8KB for kernel stacks"
@@ -90,7 +97,6 @@
 	  If you say Y here, the kernel will use a 16KB stacksize.
 	  This impedes running more threads on a system and also increases
 	  the pressure on the VM subsystem for higher order allocations.
-	  This option will also use IRQ stacks to for additional safety.
 
 config 32KSTACKS
 	bool "Use 32KB for kernel stacks"
@@ -98,15 +104,14 @@
 	  If you say Y here, the kernel will use a 32KB stacksize.
 	  This impedes running more threads on a system and also increases
 	  the pressure on the VM subsystem for higher order allocations.
-	  This option will also use IRQ stacks to for additional safety.
 
 config 64KSTACKS
 	bool "Use 64KB for kernel stacks"
+	depends on !IRQSTACKS
 	help
 	  If you say Y here, the kernel will use a 64KB stacksize.
 	  This impedes running more threads on a system and also increases
 	  the pressure on the VM subsystem for higher order allocations.
-	  This option will also use IRQ stacks to for additional safety.
 
 endchoice
 
Index: stack-paranoia/arch/i386/kernel/irq.c
===================================================================
--- stack-paranoia.orig/arch/i386/kernel/irq.c	2007-04-30 10:26:15.967875780 -0700
+++ stack-paranoia/arch/i386/kernel/irq.c	2007-04-30 10:34:07.058721717 -0700
@@ -47,7 +47,7 @@
 #endif
 }
 
-#ifdef CONFIG_4KSTACKS
+#ifdef CONFIG_IRQSTACKS
 /*
  * per-CPU IRQ handling contexts (thread information and stack)
  */
@@ -71,7 +71,7 @@
 	/* high bit used in ret_from_ code */
 	int irq = ~regs->orig_eax;
 	struct irq_desc *desc = irq_desc + irq;
-#ifdef CONFIG_4KSTACKS
+#ifdef CONFIG_IRQSTACKS
 	union irq_ctx *curctx, *irqctx;
 	u32 *isp;
 #endif
@@ -99,7 +99,7 @@
 	}
 #endif
 
-#ifdef CONFIG_4KSTACKS
+#ifdef CONFIG_IRQSTACKS
 
 	curctx = (union irq_ctx *) current_thread_info();
 	irqctx = hardirq_ctx[smp_processor_id()];
@@ -144,7 +144,7 @@
 	return 1;
 }
 
-#ifdef CONFIG_4KSTACKS
+#ifdef CONFIG_IRQSTACKS
 
 /*
  * These should really be __section__(".bss.page_aligned") as well, but
Index: stack-paranoia/include/asm-i386/irq.h
===================================================================
--- stack-paranoia.orig/include/asm-i386/irq.h	2007-04-30 10:26:31.904783972 -0700
+++ stack-paranoia/include/asm-i386/irq.h	2007-04-30 10:34:07.058721717 -0700
@@ -24,7 +24,7 @@
 # define ARCH_HAS_NMI_WATCHDOG		/* See include/linux/nmi.h */
 #endif
 
-#ifdef CONFIG_4KSTACKS
+#ifdef CONFIG_IRQSTACKS
   extern void irq_ctx_init(int cpu);
   extern void irq_ctx_exit(int cpu);
 # define __ARCH_HAS_DO_SOFTIRQ
Index: stack-paranoia/include/asm-i386/module.h
===================================================================
--- stack-paranoia.orig/include/asm-i386/module.h	2007-04-30 10:32:56.182682722 -0700
+++ stack-paranoia/include/asm-i386/module.h	2007-04-30 10:34:07.058721717 -0700
@@ -80,7 +80,13 @@
 #define MODULE_VMALLOC_STACK ""
 #endif
 
+#ifdef CONFIG_IRQSTACKS
+#define MODULE_IRQSTACKS "IRQSTACKS "
+#else
+#define MODULE_IRQSTACKS ""
+#endif
+
 #define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_STACKSIZE \
-		MODULE_VMALLOC_STACK
+		MODULE_VMALLOC_STACK MODULE_IRQSTACKS
 
 #endif /* _ASM_I386_MODULE_H */
-
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