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 <kaleshsingh@google.com>
This commit is contained in:
Kalesh Singh
2023-11-17 16:04:20 -08:00
committed by Carlos Llamas
parent a52b76b874
commit 5d8eb7f9e0

View File

@@ -10,6 +10,7 @@
#include <linux/pagemap.h>
#include <linux/syscalls.h>
#include <linux/mempolicy.h>
#include <linux/page_size_compat.h>
#include <linux/page-isolation.h>
#include <linux/page_idle.h>
#include <linux/userfaultfd_k.h>
@@ -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)