ARM: the ADDR_NO_RANDOMIZE personality flag should be honored with mmap()
PATCH 1/2 ARM: the ADDR_NO_RANDOMIZE personality flag should be honored with mmap()
Signed-off-by Nicolas Pitre <[email protected]>
--- arch/arm/mm/mmap.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/mm/mmap.c +3 -1
@@ -7,6 +7,7 @@#include <linux/shm.h> #include <linux/sched.h> #include <linux/io.h> +#include <linux/personality.h> #include <linux/random.h> #include <asm/cputype.h> #include <asm/system.h>
@@ -82,7 +83,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, mm->cached_hole_size =0 ; }/* 8 bits of randomness in 20 address space bits */ -if (current->flags &PF_RANDOMIZE ) +if ((current->flags &PF_RANDOMIZE ) && + !(current->personality &ADDR_NO_RANDOMIZE )) addr += (get_random_int () % (1 <<8 )) <<PAGE_SHIFT ; full_search:
Signature · 1 line
1.7.4
PATCH 1/2 ARM: the ADDR_NO_RANDOMIZE personality flag should be honored with mmap()
Quoted 2 lines · Nicolas Pitre
Signed-off-by Nicolas Pitre <[email protected]>---
Is this a stable candidate?
Quoted 25 lines
arch/arm/mm/mmap.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)arch/arm/mm/mmap.c +3
-1@@ -7,6 +7,7 @@#include <linux/shm.h> #include <linux/sched.h> #include <linux/io.h> +#include <linux/personality.h> #include <linux/random.h> #include <asm/cputype.h> #include <asm/system.h> @@ -82,7 +83,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, mm->cached_hole_size =0 ; }/* 8 bits of randomness in 20 address space bits */ -if (current->flags &PF_RANDOMIZE ) +if ((current->flags &PF_RANDOMIZE ) && + !(current->personality &ADDR_NO_RANDOMIZE )) addr += (get_random_int () % (1 <<8 )) <<PAGE_SHIFT ; full_search:
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 1/2 ARM: the ADDR_NO_RANDOMIZE personality flag should be honored with mmap()
Quoted 5 lines · Stephen Boyd
Quoted 2 lines · Nicolas Pitre
Signed-off-by Nicolas Pitre <[email protected]>---
Is this a stable candidate?
Maybe, but OTOH this is not critical. You also need to have CONFIG_COMPAT_BRK=n before this makes any difference, and that option is enabled by default.
Nicolas