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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 8995CC433ED for ; Mon, 26 Apr 2021 17:56:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E38FF60240 for ; Mon, 26 Apr 2021 17:56:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E38FF60240 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EDEF86B006C; Mon, 26 Apr 2021 13:56:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E8F3A6B006E; Mon, 26 Apr 2021 13:56:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D2FA36B0070; Mon, 26 Apr 2021 13:56:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0097.hostedemail.com [216.40.44.97]) by kanga.kvack.org (Postfix) with ESMTP id AFD126B006C for ; Mon, 26 Apr 2021 13:56:20 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 66706180ACF6C for ; Mon, 26 Apr 2021 17:56:20 +0000 (UTC) X-FDA: 78075272520.09.D8B9964 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf17.hostedemail.com (Postfix) with ESMTP id B675B40002DD for ; Mon, 26 Apr 2021 17:56:15 +0000 (UTC) IronPort-SDR: qGrEyx9hvwNFV/iWGhacp/LQanDzoFRNLZywWVV3HsAxL/NY8hma4ESxvRbE0P9kfzOdlwIjQt LqsIBbmIk1JA== X-IronPort-AV: E=McAfee;i="6200,9189,9966"; a="183860783" X-IronPort-AV: E=Sophos;i="5.82,252,1613462400"; d="scan'208";a="183860783" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2021 10:56:16 -0700 IronPort-SDR: 1sFm/xgmzUAr4alO+noRJjjdcUA+BwSswC61DGQQKhMYK7WbIJvRSAcnZmSi7MGyL25NKxfPCD fF20YtrXYBQQ== X-IronPort-AV: E=Sophos;i="5.82,252,1613462400"; d="scan'208";a="422743315" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.212.73.213]) ([10.212.73.213]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2021 10:56:15 -0700 Subject: Re: [PATCH v25 29/30] mm: Update arch_validate_flags() to include vma anonymous To: Catalin Marinas , "Kirill A. Shutemov" 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 References: <20210415221419.31835-1-yu-cheng.yu@intel.com> <20210415221419.31835-30-yu-cheng.yu@intel.com> <20210426064056.bqbeekpsogd32yvm@box.shutemov.name> <20210426111114.GF4985@arm.com> From: "Yu, Yu-cheng" Message-ID: Date: Mon, 26 Apr 2021 10:56:14 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210426111114.GF4985@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: B675B40002DD X-Stat-Signature: 9ga59wxbi8anrhfra6fmr55nh8z93yf7 X-Rspamd-Server: rspam02 Received-SPF: none (intel.com>: No applicable sender policy available) receiver=imf17; identity=mailfrom; envelope-from=""; helo=mga18.intel.com; client-ip=134.134.136.126 X-HE-DKIM-Result: none/none X-HE-Tag: 1619459775-78850 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 4/26/2021 4:11 AM, Catalin Marinas wrote: > 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. > Thanks a lot for the clarification! Yu-cheng