[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210426111114.GF4985@arm.com>
Date: Mon, 26 Apr 2021 12:11:15 +0100
From: Catalin Marinas <catalin.marinas@....com>
To: "Kirill A. Shutemov" <kirill@...temov.name>
Cc: Yu-cheng Yu <yu-cheng.yu@...el.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, linux-mm@...ck.org,
linux-arch@...r.kernel.org, linux-api@...r.kernel.org,
Arnd Bergmann <arnd@...db.de>,
Andy Lutomirski <luto@...nel.org>,
Balbir Singh <bsingharora@...il.com>,
Borislav Petkov <bp@...en8.de>,
Cyrill Gorcunov <gorcunov@...il.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Eugene Syromiatnikov <esyr@...hat.com>,
Florian Weimer <fweimer@...hat.com>,
"H.J. Lu" <hjl.tools@...il.com>, Jann Horn <jannh@...gle.com>,
Jonathan Corbet <corbet@....net>,
Kees Cook <keescook@...omium.org>,
Mike Kravetz <mike.kravetz@...cle.com>,
Nadav Amit <nadav.amit@...il.com>,
Oleg Nesterov <oleg@...hat.com>, Pavel Machek <pavel@....cz>,
Peter Zijlstra <peterz@...radead.org>,
Randy Dunlap <rdunlap@...radead.org>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>,
Vedvyas Shanbhogue <vedvyas.shanbhogue@...el.com>,
Dave Martin <Dave.Martin@....com>,
Weijiang Yang <weijiang.yang@...el.com>,
Pengfei Xu <pengfei.xu@...el.com>,
Haitao Huang <haitao.huang@...el.com>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Vincenzo Frascino <vincenzo.frascino@....com>,
Will Deacon <will@...nel.org>
Subject: Re: [PATCH v25 29/30] mm: Update arch_validate_flags() to include
vma anonymous
On Mon, Apr 26, 2021 at 09:40:56AM +0300, Kirill A. Shutemov wrote:
> On Thu, Apr 15, 2021 at 03:14:18PM -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 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.
--
Catalin
Powered by blists - more mailing lists