FROMLIST: x86: mm: support ARCH_MMAP_RND_BITS.

(cherry picked from commit

x86: arch_mmap_rnd() uses hard-coded values, 8 for 32-bit and 28 for
64-bit, 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 default
values as new minimums.

Signed-off-by: Daniel Cashman <>
Signed-off-by: Daniel Cashman <>

Bug: 27796957
Patchset: ASLR sysctl

Change-Id: I52a6ca5b9483ccaaf5106af41e405da44e157894
Signed-off-by: Kees Cook <>
2 files changed