Thread (43 messages) 43 messages, 3 authors, 2021-04-26

Re: [PATCH v25 29/30] mm: Update arch_validate_flags() to include vma anonymous

From: Yu, Yu-cheng <hidden>
Date: 2021-04-26 17:56:20
Also in: linux-arch, linux-doc, linux-mm, lkml

On 4/26/2021 4:11 AM, Catalin Marinas wrote:
On Mon, Apr 26, 2021 at 09:40:56AM +0300, Kirill A. Shutemov wrote:
quoted
On Thu, Apr 15, 2021 at 03:14:18PM -0700, Yu-cheng Yu wrote:
quoted
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 vma_is_anonymous() to arch_validate_flags().
To prepare the introduction of PROT_SHSTK, which creates a shadow stack
mapping and can only be applied to an anonymous VMA, update arch_validate_
flags() to include anonymous VMA information.
I would rather pass down whole vma. Who knows what else
arch_validate_flags() would need to know about the VMA tomorrow:

	arch_validate_flags(vma, newflags);

should do the trick.
A reason why we added a separate VM_MTE_ALLOWED flag was that we wanted
MTE on other RAM-based based mappings, not just anonymous pages. See
51b0bff2f703 ("mm: Allow arm64 mmap(PROT_MTE) on RAM-based files").

Anyway, the above change doesn't get in the way.
Thanks a lot for the clarification!

Yu-cheng
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help