Commit 8ec0defa authored by Arjan van de Ven's avatar Arjan van de Ven Committed by Linus Torvalds

[PATCH] Randomisation: add ADDR_NO_RANDOMIZE personality

Introduce a personality that disables randomisation, so that users can use
setarch and related commands to run specific applications without
randomisation.
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 3f06ae03
...@@ -753,7 +753,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) ...@@ -753,7 +753,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
if (elf_read_implies_exec(loc->elf_ex, executable_stack)) if (elf_read_implies_exec(loc->elf_ex, executable_stack))
current->personality |= READ_IMPLIES_EXEC; current->personality |= READ_IMPLIES_EXEC;
if (executable_stack == EXSTACK_DISABLE_X && randomize_va_space) if ( !(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
current->flags |= PF_RANDOMIZE; current->flags |= PF_RANDOMIZE;
arch_pick_mmap_layout(current->mm); arch_pick_mmap_layout(current->mm);
......
...@@ -18,6 +18,7 @@ extern int __set_personality(unsigned long); ...@@ -18,6 +18,7 @@ extern int __set_personality(unsigned long);
* These occupy the top three bytes. * These occupy the top three bytes.
*/ */
enum { enum {
ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization of VA space */
FDPIC_FUNCPTRS = 0x0080000, /* userspace function ptrs point to descriptors FDPIC_FUNCPTRS = 0x0080000, /* userspace function ptrs point to descriptors
* (signal handling) * (signal handling)
*/ */
...@@ -35,7 +36,7 @@ enum { ...@@ -35,7 +36,7 @@ enum {
* Security-relevant compatibility flags that must be * Security-relevant compatibility flags that must be
* cleared upon setuid or setgid exec: * cleared upon setuid or setgid exec:
*/ */
#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC) #define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC|ADDR_NO_RANDOMIZE)
/* /*
* Personality types. * Personality types.
......
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