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 <kaleshsingh@google.com>
This commit is contained in:
Kalesh Singh
2023-11-17 14:50:46 -08:00
committed by Carlos Llamas
parent 2d3fed3a43
commit a52b76b874

View File

@@ -25,6 +25,7 @@
#include <linux/uaccess.h>
#include <linux/userfaultfd_k.h>
#include <linux/mempolicy.h>
#include <linux/page_size_compat.h>
#include <asm/cacheflush.h>
#include <asm/tlb.h>
@@ -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