Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3438500pxj; Tue, 11 May 2021 04:39:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyobRT0yrItbmWPqhVur8x4qlegnIrgsPkuxHYkNJzRLjDfm5HFj2Fo6vgA6+kmW2791evm X-Received: by 2002:aa7:c7d3:: with SMTP id o19mr21515687eds.142.1620733180999; Tue, 11 May 2021 04:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620733180; cv=none; d=google.com; s=arc-20160816; b=SDQ3p9ml86lpKYXUw/eAZEJbsIcWY3nfd/khTiRZcAFVkY1OtPLdDYbp7/GAxtKkBk fp/K6jXc4iFEao2DQTczDzfvFxpVOa4awT6w1quL1Smq9XLsx/VNxpzkZpqccZaPCvj3 Qd1ok2wU5qXodokig6dEzjCHEF4OC4kEiu2ESMHF8NVcoLhHt/SU+dM4G9DUdmcX5x6j yy1uZyO/TfYVZmS069+AkDesIBJjG7I+/NqL8vZYQwrZyBSCzsdaRAfVklw4MRHqORJx 7gjQpUxC+aDaAwDDC15y8Yd1V7/HBxMyx8tc81WcQADwSrn1goMibwZ49A5zsefViPME 45Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Le0Ew1Hg9KvgF6la0IVI4c8P/UYPK3oIC8S0v1P/CXY=; b=HbM4kcIS5/SZ+lZZLJ9nMBbUfHFekq1C4Msht/fN4KznQhutsL1RtVbGCLjRr82yKW 7HW4xICC6ITvCPnNZFm2Pf4DQzSAdjRr07s8aACLoT3fPaq10vM3AQdDzwR+M29plB/W 45aTiYBA5/fZhySfEFy377CktHcIElvsQjOq5/pEsSBy+G2Aq1MT4qMLTrM/qQd3GnFG JAfH9uEvvB1bHuWCPsr6bZ/dDPokNgtTM7UX45H4GXDvCiQ0DUlqc9nnlOy+i8z0ipEh CxSAF5PVdxhpAehudfVZx/8ockys1AzIq4HAEknU4jb5+LqEMESY+AbWpu4Tv2H3g2Vx avUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=UV4F7xsU; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga21si3111458ejc.607.2021.05.11.04.39.16; Tue, 11 May 2021 04:39:40 -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; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=UV4F7xsU; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231506AbhEKLgs (ORCPT + 99 others); Tue, 11 May 2021 07:36:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230501AbhEKLgp (ORCPT ); Tue, 11 May 2021 07:36:45 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC4BDC061574 for ; Tue, 11 May 2021 04:35:38 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id t11so28080844lfl.11 for ; Tue, 11 May 2021 04:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Le0Ew1Hg9KvgF6la0IVI4c8P/UYPK3oIC8S0v1P/CXY=; b=UV4F7xsUhFUHbA1Rt4aUC+TkWj2LsXA90mQqrzmQetnGSqhTWOhlHIdRmNkriRRdHG En11f5rwNkzEopt/p81S0ZLB7JqTWk3Sg+oDmy7bKDWwpRgIuABxB4hVFpzKq5lQkyQO lzWzvMvCcV+3cC+u3Af/IXNj83qwkghjYLpXRnB67s4FXmUFZz1q4RcJM5RuHFudut0n QKcimK7Iulxv3/gPkMwastZrAozSuyOcanocRWiE2RJhRS2bA8TVetZRUglbLOjCv3JR nGZFENVvZKIrLb88wJVbs5XExg8wbyn5/YK+ESrw0NQAmJco0W2ZGHjhx4P9IUEH3cBv nLEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Le0Ew1Hg9KvgF6la0IVI4c8P/UYPK3oIC8S0v1P/CXY=; b=lb6Qi2yGx/rUv+O8gJaf1PW02fmJLxhRPT/hSadoWGLFH+As2ipCaFjy7Yy+JkSX7U 3bm1q7XV4jvoMDvITUbie4wUbu3wMMz5eNSfIuYNZFqg4A550EXbob68I2Q5mMiYxdom 5/ItEyT4Gz36uACjAXOFYAm9KTBd5o8uvpswKyZoTFG2dcXN7rDA7f5kxBCM8xB8rLbW wwMoQfVRSOF4bLQHR8qqrbrVlPHrS0L2oClfhMYA6L7Ee6WZvbUKmzSFjRlAKppOKqCF mAaXPhkFRTFOQoOdklACIdlhePgHhzvzIrndbWIFSP8k0COMhL2SHTJHhPTlEIMXeW4e b+SQ== X-Gm-Message-State: AOAM5325h2YTcgnQRjwHb0Gmwic5+o80norz+zBakvOLJcQVOsFiV03G JUSSsFDoxzVBZDDc2qvWqQ7Iaw== X-Received: by 2002:a05:6512:374b:: with SMTP id a11mr20151995lfs.377.1620732937423; Tue, 11 May 2021 04:35:37 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id u27sm2578687lfm.239.2021.05.11.04.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 04:35:36 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 0E4C5102615; Tue, 11 May 2021 14:35:37 +0300 (+03) Date: Tue, 11 May 2021 14:35:37 +0300 From: "Kirill A. Shutemov" 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 , Catalin Marinas , "Kirill A . Shutemov" , Vincenzo Frascino , Will Deacon Subject: Re: [PATCH v26 29/30] mm: Update arch_validate_flags() to test vma anonymous Message-ID: <20210511113537.d2uqen4pyh6xx53o@box> References: <20210427204315.24153-1-yu-cheng.yu@intel.com> <20210427204315.24153-30-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210427204315.24153-30-yu-cheng.yu@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 27, 2021 at 01:43:14PM -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 -- Kirill A. Shutemov