# Re: \[PATCH v27 30/31\] mm: Update arch\_validate\_flags() to test vma anonymous

- From: Yu, Yu-cheng \<hidden\>
- Date: 2021-05-25 15:05:16 
- List: linux-doc
- Page: https://ratatoskr.run/linux-doc/2021/05/1391493
- Thread: https://ratatoskr.run/linux-doc/2021/05/1388103/t.md

```text
On 5/25/2021 4:00 AM, Catalin Marinas wrote:
> On Fri, May 21, 2021 at 03:12:10PM -0700, Yu-cheng Yu wrote:
>> When newer VM flags are being created, such as VM_MTE, it becomes necessary
>> for mmap/mprotect to verify if certain flags are being applied to an
>> anonymous VMA.
>>
>> To solve this, one approach is adding a VM flag to track that MAP_ANONYMOUS
>> is specified [1], and then using the flag in arch_validate_flags().
>>
>> Another approach is passing the VMA to arch_validate_flags(), and check
>> vma_is_anonymous().
>>
>> To prepare the introduction of PROT_SHADOW_STACK, which creates a shadow
>> stack mapping and can be applied only to an anonymous VMA, update
>> arch_validate_flags() to pass in the VMA.
>>
>> [1] commit 9f3419315f3c ("arm64: mte: Add PROT_MTE support to mmap() and mprotect()"),
>>
>> Signed-off-by: Yu-cheng Yu <redacted>
>> Reviewed-by: Kirill A. Shutemov <redacted>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Kees Cook <redacted>
>> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>
> For arm64:
>
> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
>

Thanks!
```
