From 5d8eb7f9e027895a3487f67c9a913f584cb775c5 Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Fri, 17 Nov 2023 16:04:20 -0800 Subject: [PATCH] ANDROID: 16K: madvise: __PAGE_ALIGN addr and len In page-compat mode, madvise() syscalls must be at __PAGE_ALIGN-ed addresses and of __PAGE_SIZE-multiple length. Bug: 383389337 Bug: 315325080 Bug: 302403436 Change-Id: If390a4f4f652a38451c3faba9ff77b7c160c5733 Signed-off-by: Kalesh Singh --- mm/madvise.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/madvise.c b/mm/madvise.c index 96d1e0a99612..cf5fb6ec4095 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -1685,9 +1686,9 @@ int do_madvise(struct mm_struct *mm, unsigned long start, size_t len_in, int beh if (!madvise_behavior_valid(behavior)) return -EINVAL; - if (!PAGE_ALIGNED(start)) + if (!__PAGE_ALIGNED(start)) return -EINVAL; - len = PAGE_ALIGN(len_in); + len = __PAGE_ALIGN(len_in); /* Check to see whether len was rounded up from small -ve to zero */ if (len_in && !len)