ANDROID: 16K Prevent non-__PAGE_ALIGNED() VMA splits by anon names

Naming part of an anonymous VMA can cause a VMA split. __PAGE_ALIGN the
start and length of the region being named to avoid non-__PAGE_ALIGNED
splits.

Bug: 383389337
Bug: 302403436
Bug: 315325080
Change-Id: If86a1e038b0e72b8d69ede364cd120fdc16b833c
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
Kalesh Singh
2024-03-19 22:15:46 -07:00
committed by Carlos Llamas
parent 68e0528b38
commit 1ae0864980

View File

@@ -1584,9 +1584,9 @@ int madvise_set_anon_name(struct mm_struct *mm, unsigned long start,
unsigned long end;
unsigned long len;
if (start & ~PAGE_MASK)
if (start & ~__PAGE_MASK)
return -EINVAL;
len = (len_in + ~PAGE_MASK) & PAGE_MASK;
len = (len_in + ~__PAGE_MASK) & __PAGE_MASK;
/* Check to see whether len was rounded up from small -ve to zero */
if (len_in && !len)