ANDROID: 16K: rust: ashmem: __page_align VMA size check

In page-compat mode, all VMAs are forced to be a multiple of
the emulated page-size.

Bug: 414665621
Bug: 383389337
Change-Id: Idda8600616572f59a36c7150f412ec083010a8eb
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
Kalesh Singh
2025-05-05 02:02:55 -07:00
committed by Carlos Llamas
parent d44ff7a3ed
commit e9420a4582

View File

@@ -24,6 +24,7 @@ use kernel::{
miscdevice::{loff_t, IovIter, Kiocb, MiscDevice, MiscDeviceOptions, MiscDeviceRegistration},
mm::virt::{flags as vma_flags, VmAreaNew},
page::{page_align, PAGE_MASK, PAGE_SIZE},
page_size_compat::__page_align,
prelude::*,
seq_file::{seq_print, SeqFile},
sync::{new_mutex, Mutex, UniqueArc},
@@ -161,7 +162,7 @@ impl MiscDevice for Ashmem {
}
// Requested mapping size larger than object size.
if vma.end() - vma.start() > page_align(asma.size) {
if vma.end() - vma.start() > __page_align(asma.size) {
return Err(EINVAL);
}