Skip to content

Commit

Permalink
[ARM] add address randomization to mmap()
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
  • Loading branch information
Nicolas Pitre committed Jun 15, 2010
1 parent 990cb8a commit cc92c28
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/arm/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cc92c28

Please sign in to comment.