mm: ASLR: use get_random_long()
authorSri Krishna chowdary <schowdary@nvidia.com>
Thu, 25 Aug 2016 09:28:05 +0000 (14:28 +0530)
committermobile promotions <svcmobile_promotions@nvidia.com>
Thu, 6 Oct 2016 21:29:57 +0000 (14:29 -0700)
commit211caa9f3b690b91a49b6f0e42865c9e43266914
tree0971dfa300d8174e970e81d2ecdb29f6f0504af3
parentd0be64d277e52ed6e99155009b47878e4396a917
mm: ASLR: use get_random_long()

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.

bug 200226998

Signed-off-by: Daniel Cashman <dcashman@android.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: David S. Miller <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nick Kralevich <nnk@google.com>
Cc: Jeff Vander Stoep <jeffv@google.com>
Cc: Mark Salyzyn <salyzyn@android.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from 5ef11c35ce86b94bfb878b684de4cdaf96f54b2f)
Change-Id: I6fecfc781a2de256d50f9f1e06cadaf97666b294
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/1207748
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
arch/arm/mm/mmap.c
arch/arm64/mm/mmap.c
fs/binfmt_elf.c