ANDROID: 16K: Introduce __VM_NO_COMPAT vma flag

Since __PAGE_SIZE is emulated there are certain situations which needs
to allow an operation on a VMA which is not __PAGE_ALIGNED.

__VM_NO_COMPAT indicates the VMA is allowed to not respect the
emulated page size constraints.

This is a preparatory change for subsequent patches.

Bug: 383389337
Bug: 315325080
Bug: 302403436
Change-Id: I35b409c13427a7d51c514d06f347717e384d8ccd
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
Kalesh Singh
2024-02-06 22:12:05 -08:00
committed by Carlos Llamas
parent e7f83d4d4b
commit a9ccc1128e

View File

@@ -24,6 +24,7 @@
#include <linux/align.h>
#include <linux/jump_label.h>
#include <linux/mman.h>
#include <linux/printk.h>
#include <linux/sched.h>
@@ -86,4 +87,14 @@ static __always_inline unsigned __page_shift(void)
#define __PAGE_SIZE_ROUND_UP_ADJ(size) \
((size) + (((1 << (__PAGE_SHIFT - PAGE_SHIFT)) - 1) << PAGE_SHIFT))
/* VMA is exempt from emulated page align requirements */
#define __VM_NO_COMPAT (_AC(1,ULL) << 63)
#define __MAP_NO_COMPAT (_AC(1,ULL) << 63)
/* Combine the mmap "flags" argument into "vm_flags" add translation of the no-compat flag. */
static inline unsigned long __calc_vm_flag_bits(unsigned long flags)
{
return calc_vm_flag_bits(flags) | _calc_vm_trans(flags, __MAP_NO_COMPAT, __VM_NO_COMPAT );
}
#endif /* __LINUX_PAGE_SIZE_COMPAT_H */