ANDROID: 16K: mprotect: __PAGE_ALIGN addr and len
In page-compat mode, mprotect() syscalls must be at __PAGE_ALIGN-ed addresses and of __PAGE_SIZE-multiple length. Bug: 383389337 Bug: 315325080 Bug: 302403436 Change-Id: I5ece654ea921cad692af0d3aa7dba422f54d08b8 Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
committed by
Carlos Llamas
parent
397425965f
commit
2d3fed3a43
+3
-2
@@ -17,6 +17,7 @@
|
|||||||
#include <linux/highmem.h>
|
#include <linux/highmem.h>
|
||||||
#include <linux/security.h>
|
#include <linux/security.h>
|
||||||
#include <linux/mempolicy.h>
|
#include <linux/mempolicy.h>
|
||||||
|
#include <linux/page_size_compat.h>
|
||||||
#include <linux/personality.h>
|
#include <linux/personality.h>
|
||||||
#include <linux/syscalls.h>
|
#include <linux/syscalls.h>
|
||||||
#include <linux/swap.h>
|
#include <linux/swap.h>
|
||||||
@@ -726,11 +727,11 @@ static int do_mprotect_pkey(unsigned long start, size_t len,
|
|||||||
if (grows == (PROT_GROWSDOWN|PROT_GROWSUP)) /* can't be both */
|
if (grows == (PROT_GROWSDOWN|PROT_GROWSUP)) /* can't be both */
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (start & ~PAGE_MASK)
|
if (!__PAGE_ALIGNED(start))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (!len)
|
if (!len)
|
||||||
return 0;
|
return 0;
|
||||||
len = PAGE_ALIGN(len);
|
len = __PAGE_ALIGN(len);
|
||||||
end = start + len;
|
end = start + len;
|
||||||
if (end <= start)
|
if (end <= start)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|||||||
Reference in New Issue
Block a user