From: Arjan van de Ven <arjan@infradead.org>

This first patch of the series introduces a sysctl (default off) that
enables/disables the randomisation feature globally.  Since randomisation may
make it harder to debug really tricky situations (reproducability goes down),
the sysadmin needs a way to disable it globally.

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/include/linux/kernel.h |    3 +++
 25-akpm/include/linux/sysctl.h |    1 +
 25-akpm/kernel/sysctl.c        |   11 +++++++++++
 3 files changed, 15 insertions(+)

diff -puN include/linux/kernel.h~randomisation-global-sysctl include/linux/kernel.h
--- 25/include/linux/kernel.h~randomisation-global-sysctl	2005-02-02 15:22:12.963943944 -0800
+++ 25-akpm/include/linux/kernel.h	2005-02-02 15:22:12.970942880 -0800
@@ -278,6 +278,9 @@ struct sysinfo {
 extern void BUILD_BUG(void);
 #define BUILD_BUG_ON(condition) do { if (condition) BUILD_BUG(); } while(0)
 
+
+extern int randomize_va_space;
+
 /* Trap pasters of __FUNCTION__ at compile-time */
 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
 #define __FUNCTION__ (__func__)
diff -puN include/linux/sysctl.h~randomisation-global-sysctl include/linux/sysctl.h
--- 25/include/linux/sysctl.h~randomisation-global-sysctl	2005-02-02 15:22:12.964943792 -0800
+++ 25-akpm/include/linux/sysctl.h	2005-02-02 15:22:12.971942728 -0800
@@ -135,6 +135,7 @@ enum
 	KERN_HZ_TIMER=65,	/* int: hz timer on or off */
 	KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */
 	KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */
+	KERN_RANDOMIZE=68, /* int: randomize virtual address space */
 };
 
 
diff -puN kernel/sysctl.c~randomisation-global-sysctl kernel/sysctl.c
--- 25/kernel/sysctl.c~randomisation-global-sysctl	2005-02-02 15:22:12.966943488 -0800
+++ 25-akpm/kernel/sysctl.c	2005-02-02 15:22:12.972942576 -0800
@@ -121,6 +121,8 @@ extern int sysctl_hz_timer;
 extern int acct_parm[];
 #endif
 
+int randomize_va_space;
+
 static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t,
 		       ctl_table *, void **);
 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
@@ -632,6 +634,15 @@ static ctl_table kern_table[] = {
 		.proc_handler	= &proc_dointvec,
 	},
 #endif
+	{
+		.ctl_name	= KERN_RANDOMIZE,
+		.procname	= "randomize_va_space",
+		.data		= &randomize_va_space,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+
 	{ .ctl_name = 0 }
 };
 
_