From: Nicolas Pitre Date: Tue, 15 Jun 2010 01:16:19 +0000 (-0400) Subject: [ARM] add address randomization to mmap() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=cc92c28b2db5b406657ecc05235d4ca4e222ae34;p=linux-beck.git [ARM] add address randomization to mmap() Signed-off-by: Nicolas Pitre --- diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c index f5abc51c5a07..4f5b39687df5 100644 --- a/arch/arm/mm/mmap.c +++ b/arch/arm/mm/mmap.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -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)