From: Catalin Marinas Date: Fri, 29 Nov 2019 12:45:08 +0000 (+0000) Subject: mm: Allow arm64 mmap(PROT_MTE) on RAM-based files X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=51b0bff2f703f7ecfeb228eaa3d8f6090c18c9c1;p=linux.git mm: Allow arm64 mmap(PROT_MTE) on RAM-based files Since arm64 memory (allocation) tags can only be stored in RAM, mapping files with PROT_MTE is not allowed by default. RAM-based files like those in a tmpfs mount or memfd_create() can support memory tagging, so update the vm_flags accordingly in shmem_mmap(). Signed-off-by: Catalin Marinas Acked-by: Andrew Morton --- diff --git a/mm/shmem.c b/mm/shmem.c index 271548ca20f31..ec94f4c7851e4 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2267,6 +2267,9 @@ static int shmem_mmap(struct file *file, struct vm_area_struct *vma) vma->vm_flags &= ~(VM_MAYWRITE); } + /* arm64 - allow memory tagging on RAM-based files */ + vma->vm_flags |= VM_MTE_ALLOWED; + file_accessed(file); vma->vm_ops = &shmem_vm_ops; if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) &&