From ba166bce2c94deba52061de860af0f4ae9a13ee2 Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Fri, 10 Nov 2023 00:11:04 -0800 Subject: [PATCH] ANDROID: 16K: __PAGE_ALIGN randomize_stack_top() address In page-compat mode, align the randomized stack by the emulated page-size. Bug: 383389337 Bug: 315325080 Bug: 302403436 Change-Id: If0d5ab3b996dfe934d0b5b701c16e8c2b1dcc910 Signed-off-by: Kalesh Singh --- mm/util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/util.c b/mm/util.c index 429619bc376e..9ba047da4459 100644 --- a/mm/util.c +++ b/mm/util.c @@ -361,12 +361,12 @@ unsigned long randomize_stack_top(unsigned long stack_top) if (current->flags & PF_RANDOMIZE) { random_variable = get_random_long(); random_variable &= STACK_RND_MASK; - random_variable <<= PAGE_SHIFT; + random_variable <<= __PAGE_SHIFT; } #ifdef CONFIG_STACK_GROWSUP - return PAGE_ALIGN(stack_top) + random_variable; + return __PAGE_ALIGN(stack_top) + random_variable; #else - return PAGE_ALIGN(stack_top) - random_variable; + return __PAGE_ALIGN(stack_top) - random_variable; #endif }