BACKPORT: FROMLIST: mm: ASLR: use get_random_long()

(cherry picked from commit

Replace calls to get_random_int() followed by a cast to (unsigned long)
with calls to get_random_long().  Also address shifting bug which, in case
of x86 removed entropy mask for mmap_rnd_bits values > 31 bits.

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

Bug: 27796957
Patchset: ASLR sysctl

Change-Id: I4dd21814bd7b7ede8faa8f058ccba7b61d45b5ab
Signed-off-by: Kees Cook <>
7 files changed