From a52b76b87462bb4c0086f32eabfdc61e13fdfc50 Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Fri, 17 Nov 2023 14:50:46 -0800 Subject: [PATCH] ANDROID: 16K: mremap: __PAGE_ALIGN addr and len In page-compat mode, mremap() syscalls must be at __PAGE_ALIGN-ed addresses and of __PAGE_SIZE-multiple length. Bug: 383389337 Bug: 315325080 Bug: 302403436 Change-Id: I796a423c75823d5e3ae25dd4e0855514cf5d27b8 Signed-off-by: Kalesh Singh --- mm/mremap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/mremap.c b/mm/mremap.c index 4caf5f4d0529..1d3870467df6 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -1063,11 +1064,11 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, return ret; - if (offset_in_page(addr)) + if (__offset_in_page_log(addr)) return ret; - old_len = PAGE_ALIGN(old_len); - new_len = PAGE_ALIGN(new_len); + old_len = __PAGE_ALIGN(old_len); + new_len = __PAGE_ALIGN(new_len); /* * We allow a zero old-len as a special case