ANDROID: 16K: Ensure mseal start and len are 16kB multiples

For 16kB page size emulation in x86_64, ensure that mseal()
operates on regions that are __PAGE_SIZE multiple sized and
aligned.

Bug: 383389337
Bug: 356480574
Change-Id: I0bc25a0090637b51558050764010a6e24275a2bb
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
Kalesh Singh
2024-07-31 01:15:27 -07:00
committed by Carlos Llamas
parent 5c1d7ef671
commit 57bbcef534

View File

@@ -12,6 +12,7 @@
#include <linux/mm.h>
#include <linux/mm_inline.h>
#include <linux/mmu_context.h>
#include <linux/page_size_compat.h>
#include <linux/syscalls.h>
#include <linux/sched.h>
#include "internal.h"
@@ -222,10 +223,10 @@ int do_mseal(unsigned long start, size_t len_in, unsigned long flags)
return ret;
start = untagged_addr(start);
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)
return -EINVAL;