Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3621857rdb; Wed, 27 Dec 2023 13:45:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtYXPhMm3AeUIuHe6+CDHP2/Mw09JJUZ4xjGWfPHGe5IPGEWPEWX3ARMJSdsGOiwVF8CYo X-Received: by 2002:ad4:559b:0:b0:67f:af31:6d73 with SMTP id f27-20020ad4559b000000b0067faf316d73mr8130949qvx.80.1703713524231; Wed, 27 Dec 2023 13:45:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703713524; cv=none; d=google.com; s=arc-20160816; b=PRNZQjhh67BCz0NgQ+rrBICvkL+5h5OOOdPU6lEJYaQgHeMpgzxDTauoLQyM0LT2be XPEetDs47urjE9WCpmLCU90JzE/k/h2xV/lKVdnhHCGpXqijD1Rh+bYc3JVSAH/KhRIE EA7E7t6jxvsSP2Xt4u4oALTcN9pM0c4e3ixllqQJZOHbq7L58LkJ+RvfQvkylLDGWwV+ rStkrI9f6O/DE5MFGa3dxNYY/vSb/bg9648Wrmg0STtNZEY9fSNRrM0QnErtjOnaPHsB 1Uq0FgvHarEg5+i2mrGJl0vbYKmNkYXpqfyt5sEwFVP9bxFoKmY8+dt2hDnMIp2uylR4 C7Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=D7rLujXGnb+f1u9j4h+Qq8VxTUj0V5Ld0uLRaEMRkEI=; fh=5cSt+EU+KK+wKunFOPjmgcPkoxzkReMhFzvKUy9L0x0=; b=J7pzU92yOrzHhs4pMYESKkto8yd8ZShN8EbRnL3PCSvL4fcDgK2L1ZVbPaoZOg4qrO WjJkmVIyTHjz7vaUopGnYUvK1btDLBJJXlwgpQc7n4KjhuoqVy/J1CRtrWgwt+LZysmp 7Y3zSKhVw3AcV0yGi/w0XBtUoBCQV7Bp16K3wdyNo2bdDGjQi4A7PYKIfQRvz18uGZ9F 4izdtU1wBQeyntV1Gj7X52y7+uh41M9u2+7rtQ85msh+GyEI2mjtswl3EgiSZz4rAye5 DVVZsU5D42QEDYaxtiGbIbWoMmrbXNGLlgjInmZeqSoVO9NcNH+FI6T1mlMHzCQSiZcJ 5M+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=00mkvWBW; spf=pass (google.com: domain of linux-kernel+bounces-12279-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12279-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id r10-20020a0ccc0a000000b0067f9f2f4bc9si11492647qvk.173.2023.12.27.13.45.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 13:45:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12279-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=00mkvWBW; spf=pass (google.com: domain of linux-kernel+bounces-12279-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12279-linux.lists.archive=gmail.com@vger.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 F09881C225B2 for ; Wed, 27 Dec 2023 21:45:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD50847F6C; Wed, 27 Dec 2023 21:45:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="00mkvWBW" 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 176AB22089 for ; Wed, 27 Dec 2023 21:45:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64181C433C7; Wed, 27 Dec 2023 21:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1703713515; bh=EI47mPqwG9pb/xWc0waHIziKYxkBwVMBRxN+4PJlnow=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=00mkvWBWZXYPjc3yn3MWBUVxJ+Zd2aFDKLGvt48GvXfi2sCguaNXXi5czmjPDRIlA cW8rybJshDUYKhSlAQ3ObSbEmEz+LIJ9aEWBXnQqTl7DWD+yLHlI2nF/Gq3CZQWiYV bVOvllVHWKs8TRi1gvzqjyaUJbeSmKdijAfmsjjM= Date: Wed, 27 Dec 2023 13:45:14 -0800 From: Andrew Morton To: Deepak Gupta Cc: 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: <20231227134514.13629032c39decdf1dddcc75@linux-foundation.org> In-Reply-To: <20231222235248.576482-1-debug@rivosinc.com> References: <20231222235248.576482-1-debug@rivosinc.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit 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"?