ANDROID: 16K: x86_64: __PAGE_ALIGN mmap randomization

In page-compat mode, the mmap addressed must be a multiple of the
emulated page-size.

Bug: 383389337
Bug: 315325080
Bug: 302403436
Change-Id: Iff99531cd26146e470fde08d1092a938bfb01cee
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
Kalesh Singh
2024-02-06 21:56:42 -08:00
committed by Carlos Llamas
parent 4daa4c1fec
commit f51703f4c1

View File

@@ -11,6 +11,7 @@
* Copyright 2007 Jiri Kosina, SUSE Labs.
*/
#include <linux/page_size_compat.h>
#include <linux/personality.h>
#include <linux/mm.h>
#include <linux/random.h>
@@ -71,7 +72,7 @@ static unsigned long arch_rnd(unsigned int rndbits)
{
if (!(current->flags & PF_RANDOMIZE))
return 0;
return (get_random_long() & ((1UL << rndbits) - 1)) << PAGE_SHIFT;
return (get_random_long() & ((1UL << rndbits) - 1)) << __PAGE_SHIFT;
}
unsigned long arch_mmap_rnd(void)