From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5536AC47087 for ; Tue, 25 May 2021 11:00:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D2486142C for ; Tue, 25 May 2021 11:00:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231136AbhEYLBv (ORCPT ); Tue, 25 May 2021 07:01:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:41464 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230217AbhEYLBt (ORCPT ); Tue, 25 May 2021 07:01:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7E6006141B; Tue, 25 May 2021 11:00:14 +0000 (UTC) Date: Tue, 25 May 2021 12:00:12 +0100 From: Catalin Marinas To: Yu-cheng Yu Cc: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang , Pengfei Xu , Haitao Huang , "Kirill A . Shutemov" , Vincenzo Frascino , Will Deacon Subject: Re: [PATCH v27 30/31] mm: Update arch_validate_flags() to test vma anonymous Message-ID: <20210525110011.GD15564@arm.com> References: <20210521221211.29077-1-yu-cheng.yu@intel.com> <20210521221211.29077-31-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210521221211.29077-31-yu-cheng.yu@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Reviewed-by: Kirill A. Shutemov > Cc: Catalin Marinas > Cc: Kees Cook > Cc: Vincenzo Frascino > Cc: Will Deacon For arm64: Acked-by: Catalin Marinas