Commit 818bcba5 authored by Arjan van de Ven's avatar Arjan van de Ven Committed by Linus Torvalds

[PATCH] Randomisation: global sysctl

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: default avatarArjan van de Ven <arjan@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ba4cfe03
......@@ -278,6 +278,12 @@ struct sysinfo {
extern void BUILD_BUG(void);
#define BUILD_BUG_ON(condition) do { if (condition) BUILD_BUG(); } while(0)
#ifdef CONFIG_SYSCTL
extern int randomize_va_space;
#else
#define randomize_va_space 0
#endif
/* Trap pasters of __FUNCTION__ at compile-time */
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
#define __FUNCTION__ (__func__)
......
......@@ -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 */
};
......
......@@ -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 }
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment