Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4451803pxj; Tue, 25 May 2021 08:18:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpjF888poi1f5iTbotbiw5KI7GhMTdtOGlI9zoLkCFoZTfDnwZkIzfib7gm0i65wzsZR8/ X-Received: by 2002:a05:6402:4251:: with SMTP id g17mr32284829edb.238.1621955889595; Tue, 25 May 2021 08:18:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621955889; cv=none; d=google.com; s=arc-20160816; b=uhrYri0YGdKgyK6m65cfFELaqAtvimhyz9T5vYJdoABMvBly2JYVX+ZGGPxgsejiXZ YFCxt8X1h9HkA9u9GupaNx7PYfgaszIdvZiUiRRDZ6EnVIdJPMX84xCf61VpuayUX+dY sbw3M0Pdl9pFDHCGbve3Fw8KbfFtCdL7Lmgq1cHYpdIQR7ktNxgcMdIIn6jzF2EVK1WD BIp5rZkGN/O8T6TZUUKXAZc1quGN+r7STeEfHzI6anM+tSpAGNmmgHepMBKV6hR/csw5 QC3IYHIUqKiWWJ7jqfhDv0yeXgkgr4kENx/YWhmGcGwlo+LHp0cnI/rUabxyPUtmM64F lVPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=rP6nzWbr4rhE2ozEQtsj/9xDBUb35IgdVm+paPPwaLE=; b=PegHL8FO4erooGdOT/pgGGQISGPuO3EI+nz0U3EAOM1GqSGuAnNQ7qHLxxJz0qHlHY UomGSPVVpjjaAylkkkV8vggSpwAR1ZJD+xuNMzDDeH5ZVgOJlguW8rz2RPb1XIZulnmO 3bTVe5p65WB0Te59IKlt5s1bSheJ0xbfWEZpuBC66YLarDywcGE+Lwc7FpRvWBEEeMen glDyD/nEPho4MmBUvTSZ0TWZSqCUTDRuhcttgkspvEoAt55cvLRUWuCMLJuoJBCLEvhZ JOmai5ObmCKSmgCp/iPf+n3HYD3p2PWriUiN8McKMlYxHK4XhDoWCVyuYndHAmqqXIPy mFsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y5si4418825edc.226.2021.05.25.08.17.46; Tue, 25 May 2021 08:18:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230433AbhEYLBu (ORCPT + 99 others); Tue, 25 May 2021 07:01:50 -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