projects
/
GitHub
/
moto-9609
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
990cb8a
)
[ARM] add address randomization to mmap()
author
Nicolas Pitre
<nico@fluxnic.net>
Tue, 15 Jun 2010 01:16:19 +0000
(21:16 -0400)
committer
Nicolas Pitre
<nico@fluxnic.net>
Tue, 15 Jun 2010 01:22:11 +0000
(21:22 -0400)
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
arch/arm/mm/mmap.c
patch
|
blob
|
blame
|
history
diff --git
a/arch/arm/mm/mmap.c
b/arch/arm/mm/mmap.c
index f5abc51c5a07ff24e047ef333c7dd47b942fc3a4..4f5b39687df541a417d4c3a9ac888fc53a31b999 100644
(file)
--- a/
arch/arm/mm/mmap.c
+++ b/
arch/arm/mm/mmap.c
@@
-7,6
+7,7
@@
#include <linux/shm.h>
#include <linux/sched.h>
#include <linux/io.h>
+#include <linux/random.h>
#include <asm/cputype.h>
#include <asm/system.h>
@@
-80,6
+81,9
@@
arch_get_unmapped_area(struct file *filp, unsigned long addr,
start_addr = addr = TASK_UNMAPPED_BASE;
mm->cached_hole_size = 0;
}
+ /* 8 bits of randomness in 20 address space bits */
+ if (current->flags & PF_RANDOMIZE)
+ addr += (get_random_int() % (1 << 8)) << PAGE_SHIFT;
full_search:
if (do_align)