diff options
author | dcashman <dcashman@google.com> | 2016-01-12 09:44:35 -0800 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2016-02-16 13:54:14 -0800 |
commit | 25106ff489ec21fc24528c8bdc9c12edd2c37c05 (patch) | |
tree | cde7cfcd8f1fbeb3dd7a534b4912fa052a0c5b02 /arch/arm/mm/mmap.c | |
parent | d49d88766ba924b3df96d9fc1c1a257b90970b74 (diff) |
FROMLIST: arm: mm: support ARCH_MMAP_RND_BITS.
(cherry picked from commit https://lkml.org/lkml/2015/12/21/341)
arm: arch_mmap_rnd() uses a hard-code value of 8 to generate the
random offset for the mmap base address. This value represents a
compromise between increased ASLR effectiveness and avoiding
address-space fragmentation. Replace it with a Kconfig option, which
is sensibly bounded, so that platform developers may choose where to
place this compromise. Keep 8 as the minimum acceptable value.
Bug: 24047224
Signed-off-by: Daniel Cashman <dcashman@android.com>
Signed-off-by: Daniel Cashman <dcashman@google.com>
Change-Id: I438ae2dae939ea7f311246832cb789afdd6cba4e
Diffstat (limited to 'arch/arm/mm/mmap.c')
-rw-r--r-- | arch/arm/mm/mmap.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c index 407dc786583a..4b4058db0781 100644 --- a/arch/arm/mm/mmap.c +++ b/arch/arm/mm/mmap.c @@ -173,8 +173,7 @@ unsigned long arch_mmap_rnd(void) { unsigned long rnd; - /* 8 bits of randomness in 20 address space bits */ - rnd = (unsigned long)get_random_int() % (1 << 8); + rnd = (unsigned long)get_random_int() & ((1 << mmap_rnd_bits) - 1); return rnd << PAGE_SHIFT; } |