On Thu, Feb 20, 2025 at 03:58:01PM +0000, Catalin Marinas wrote: > PROT_MTE (memory tagging extensions) is not supported on all user mmap() > types for various reasons (memory attributes, backing storage, CoW > handling). The arm64 arch_validate_flags() function checks whether the > VM_MTE_ALLOWED flag has been set for a vma during mmap(), usually by > arch_calc_vm_flag_bits(). > > Linux prior to 6.13 does not support PROT_MTE hugetlb mappings. This was > added by commit 25c17c4b55de ("hugetlb: arm64: add mte support"). > However, earlier kernels inadvertently set VM_MTE_ALLOWED on > (MAP_ANONYMOUS | MAP_HUGETLB) mappings by only checking for > MAP_ANONYMOUS. > > Explicitly check MAP_HUGETLB in arch_calc_vm_flag_bits() and avoid > setting VM_MTE_ALLOWED for such mappings. > > Fixes: 9f3419315f3c ("arm64: mte: Add PROT_MTE support to mmap() and mprotect()") > Cc: <stable@xxxxxxxxxxxxxxx> # 5.10.x-6.12.x > Reported-by: Naresh Kamboju <naresh.kamboju@xxxxxxxxxx> > Signed-off-by: Catalin Marinas <catalin.marinas@xxxxxxx> > --- > > Hi Greg, > > This patch applies cleanly on top of the stable-rc/linux-6.12.y to > 5.10.y LTS, so I'm only sending it once. It's not for 6.13 onwards since > those kernels support hugetlbfs with MTE. Thanks for this, I'll queue it up after the next round of releases. greg k-h