Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6553539rdb; Tue, 2 Jan 2024 05:57:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEYF9hHFyOfsdxil7IS3Hlrq9uUj8xb6fIbsreFIIPdNz0ryu/l+Ini/MTkFbU49BRgLs0u X-Received: by 2002:a05:622a:48b:b0:427:8dcb:28d with SMTP id p11-20020a05622a048b00b004278dcb028dmr27501325qtx.26.1704203825667; Tue, 02 Jan 2024 05:57:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704203825; cv=none; d=google.com; s=arc-20160816; b=aw6EpZMAQgR4CcuIx6HC9lZRgTE9YHaFWRM5ZOlxtnEwAd/MeoyEiFdhXOXaR1a+hM WvgcBZAv9OAmGLnVhd5n0s5wMJEP1N2RrWR7kgk+1luSW31MGnrnHTi9+OF99ynOiTXc K6RlLk08YvIGkSJwp/2UrRhY/tNP/gohgDjzgoh9/sSkqf3ZC1OEyCyCHZtqGdMFXR+q SK7PvYO9tluTY5goOMqUvT00S2e5AVGqXJKZGp8hc7dFIhswCgFtsguOAhW84CplBOWw sYN/s08hl0SODLghIO+jHCpGb/pJc/JgbXVGoVb8IeqEH2VIui1kZDp1+JF9r0tNi3OF ERXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ygpQ3NWE9mPM1NEz/XOwSqcF2d9rPqL20Nh1YxdAYKI=; fh=7h4SQKBsv6NTCYBnCiErAVvgXxoC6/Qx0U9yETutZoI=; b=teHP2EJJPmChUUsm3skhnhPIsdu6lTpLqv3UDz0s0ykHpI/dabIxbuWUh8rZQ/3Ral jLK/JT07wAcJgDsDB41efTML8nWIx4SiVdw8o29H+ec/7Gb7PFZ0r/tIiFHLpJBO17HO LFYi9S0NNgpB5uNiRxac8lQMtqjBd/NSfpH2XM8eym/+OKUJF3b362YHJ4lbgtKM4h9g H0I4Rd2GBHFG5kRZPBh0sHzZkoY3CcOzUHp7nnBx5AjGc5Tnr0jnP+wTipDPH1sDRYwg QcEUEJlVJEOOvVCkifCfAI/TJykOMpVmvVGV+s+c7DVLD/nODWrS44wW46RIUVpSTLKG awzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rjz8h67B; spf=pass (google.com: domain of linux-kernel+bounces-14448-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14448-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t9-20020a05622a01c900b00428129fcf46si6712297qtw.732.2024.01.02.05.57.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 05:57:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14448-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rjz8h67B; spf=pass (google.com: domain of linux-kernel+bounces-14448-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14448-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6ED281C221C3 for ; Tue, 2 Jan 2024 13:57:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CBE8212E5A; Tue, 2 Jan 2024 13:57:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Rjz8h67B" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F3CD12E47 for ; Tue, 2 Jan 2024 13:56:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39CD5C433C8; Tue, 2 Jan 2024 13:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704203819; bh=rQxuLAMr4pQbTcIQCi2LRMYbM09Z6yq1KaBQw0i2III=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Rjz8h67BRpHSuLNqUsuBfgJRholz2cNuwKU+lAWcvhvF4VfoXl61Il+8CBQjfh+ic G7x9Pi6w0los4hsNQbgadVCSSB4hWYRk/SW7vjML7E5obPu5H/NoF+1P8n6RfSzX+7 YPXmNrZu9hECrGWt3H+yAMT0sf0mRO4f4QR7hAG3ydMd2a8NTxMMoaL3ZUNhspx8Wy SMUZToHCseG4Bv50K15+5tr4i3W5srkBGiX0w3tJttEAtjL+vrPs0KPHSvHJCNXvPN uNyOvYLlaywnYFy5gQPcJHm4nwDTLP1UGdKDFOukx2rA5xgzlkeMu+GUHI6Y9QU1Rq /N48OJannnguQ== Date: Tue, 2 Jan 2024 15:56:35 +0200 From: Mike Rapoport To: Andrew Morton Cc: Deepak Gupta , rick.p.edgecombe@intel.com, broonie@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] mm: abstract shadow stack vma behind arch_is_shadow_stack_vma Message-ID: References: <20231222235248.576482-1-debug@rivosinc.com> <20231227134514.13629032c39decdf1dddcc75@linux-foundation.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231227134514.13629032c39decdf1dddcc75@linux-foundation.org> On Wed, Dec 27, 2023 at 01:45:14PM -0800, Andrew Morton wrote: > On Fri, 22 Dec 2023 15:51:04 -0800 Deepak Gupta wrote: > > > x86 has used VM_SHADOW_STACK (alias to VM_HIGH_ARCH_5) to encode shadow > > stack VMA. VM_SHADOW_STACK is thus not possible on 32bit. Some arches may > > need a way to encode shadow stack on 32bit and 64bit both and they may > > encode this information differently in VMAs. > > Is such a patch in the pipeline? Otherwise we're making a change that > serves no purpose. > > > This patch changes checks of VM_SHADOW_STACK flag in generic code to call > > to a function `arch_is_shadow_stack_vma` which will return true if arch > > supports shadow stack and vma is shadow stack else stub returns false. > > > > ... > > > > --- a/include/linux/mm.h > > +++ b/include/linux/mm.h > > @@ -352,8 +352,21 @@ extern unsigned int kobjsize(const void *objp); > > * for more details on the guard size. > > */ > > # define VM_SHADOW_STACK VM_HIGH_ARCH_5 > > + > > +static inline bool arch_is_shadow_stack_vma(vm_flags_t vm_flags) > > +{ > > + return (vm_flags & VM_SHADOW_STACK) ? true : false; > > +} > > The naming seems a little wrong. I'd expect it to take a vma* arg. > Maybe just drop the "_vma"? I'd suggest to use vma_is_shadow_stack() to make it inline with other vma_is_*() tests. -- Sincerely yours, Mike.