From 181bc19bef74650fb5dc05a58aed00607b8e358d Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Mon, 20 Nov 2023 16:39:52 -0800 Subject: [PATCH] ANDROID: 16K: x86_64: Allow stack randomization of twice page-size In page-compat mode, let stack randomization be 2x__PAGE_SIZE instead of the hard coded 8KB. Bug: 383389337 Bug: 315325080 Bug: 302403436 Change-Id: I9ab3c03a9a0fcd7210a1f0dc7834975ae2807473 Signed-off-by: Kalesh Singh --- arch/x86/kernel/process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index c7ce3655b707..84e68ab27c9b 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -1006,7 +1007,7 @@ early_param("idle", idle_setup); unsigned long arch_align_stack(unsigned long sp) { if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) - sp -= get_random_u32_below(8192); + sp -= get_random_u32_below(__PAGE_SIZE << 1); return sp & ~0xf; }