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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1738C47258 for ; Thu, 25 Jan 2024 18:45:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5768B280001; Thu, 25 Jan 2024 13:45:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 525F76B009A; Thu, 25 Jan 2024 13:45:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A041280001; Thu, 25 Jan 2024 13:45:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 255116B0099 for ; Thu, 25 Jan 2024 13:45:11 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C2696A0544 for ; Thu, 25 Jan 2024 18:45:10 +0000 (UTC) X-FDA: 81718710780.20.889B853 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf09.hostedemail.com (Postfix) with ESMTP id 4598D140036 for ; Thu, 25 Jan 2024 18:45:07 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=W6tH+ufY; spf=pass (imf09.hostedemail.com: domain of conor@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=conor@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706208309; a=rsa-sha256; cv=none; b=u5qvS4QAISg+m8OOMaFqPPosOMdQx7PcbfDm3wHEnSFlRllVFqO+yNW/dzNU6uyceWmRda iNckx6xthVRUYUQxAgGmsGMTJWkZVBg/Zk/ja6euptnCABc4lPyf0eRrn5aJ5K+l/tO/lZ tHjYDVqIV73JOJ2vHt/42/JMm/LE+JU= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=W6tH+ufY; spf=pass (imf09.hostedemail.com: domain of conor@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=conor@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706208309; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OdFL/sN4A9Vl4LPLjBoXgFDtyVDvlPFAfQB/e7BGOTo=; b=YLzWwG+EKYElo4GRPBhW7ruUlnwNHuJvw1ZOgfNOHmop25LvBIm7jxXGhTsMVn3epqBxZy jciEG/vnb4f49P7XdnUsCFcoCp1mVtZ9bMMOt/2iQCD7yQiyO5CMSH3tdRcvarYdENDN80 xsIsHXq2IsWIeXlNyELjUUGsiaVSjsw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id C3EE3CE34C9; Thu, 25 Jan 2024 18:45:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85938C433F1; Thu, 25 Jan 2024 18:44:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706208303; bh=YOmQgkz1P+8Zi0uUakZsNY3tJ1wB079WwZ+pgQHgPOk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=W6tH+ufYN63e0ec9n24c1FtjKPLogyll3pPVDTlBw5IyIKQC21WfMzoutf7aFwp1Z xe1NAaXx662qjwLMcjlFuhZjalF6dGCmXAC1FHFz0ddkNaiHUOfDhJM6x6DmmMmkUw 7S2cKN4hWcysnuC7LU/m2G6zl5xoPsA2LUzDZ6X2QgRaLeccd/2B/tBSEGFoXdT8Vc NNsI2SDXMeBpu23AB23V7I3NydxCuDXf3g8idaSoTYDRd534DYw2vQHNfYHKMfd9gl AdBHKLvMPFSwVsq8AlJP48Qc0Sf21tREDkJm1q+KjsG+y7BIQJy2bKH7eFVzDH2xSV 2m8nlYs+rsSkQ== Date: Thu, 25 Jan 2024 18:44:48 +0000 From: Conor Dooley To: Deepak Gupta Cc: rick.p.edgecombe@intel.com, broonie@kernel.org, Szabolcs.Nagy@arm.com, kito.cheng@sifive.com, keescook@chromium.org, ajones@ventanamicro.com, paul.walmsley@sifive.com, palmer@dabbelt.com, conor.dooley@microchip.com, cleger@rivosinc.com, atishp@atishpatra.org, alex@ghiti.fr, bjorn@rivosinc.com, alexghiti@rivosinc.com, corbet@lwn.net, aou@eecs.berkeley.edu, oleg@redhat.com, akpm@linux-foundation.org, arnd@arndb.de, ebiederm@xmission.com, shuah@kernel.org, brauner@kernel.org, guoren@kernel.org, samitolvanen@google.com, evan@rivosinc.com, xiao.w.wang@intel.com, apatel@ventanamicro.com, mchitale@ventanamicro.com, waylingii@gmail.com, greentime.hu@sifive.com, heiko@sntech.de, jszhang@kernel.org, shikemeng@huaweicloud.com, david@redhat.com, charlie@rivosinc.com, panqinglin2020@iscas.ac.cn, willy@infradead.org, vincent.chen@sifive.com, andy.chiu@sifive.com, gerg@kernel.org, jeeheng.sia@starfivetech.com, mason.huo@starfivetech.com, ancientmodern4@gmail.com, mathis.salmen@matsal.de, cuiyunhui@bytedance.com, bhe@redhat.com, chenjiahao16@huawei.com, ruscur@russell.cc, bgray@linux.ibm.com, alx@kernel.org, baruch@tkos.co.il, zhangqing@loongson.cn, catalin.marinas@arm.com, revest@chromium.org, josh@joshtriplett.org, joey.gouly@arm.com, shr@devkernel.io, omosnace@redhat.com, ojeda@kernel.org, jhubbard@nvidia.com, linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [RFC PATCH v1 24/28] riscv: select config for shadow stack and landing pad instr support Message-ID: <20240125-implement-coagulant-3058e743a098@spud> References: <20240125062739.1339782-1-debug@rivosinc.com> <20240125062739.1339782-25-debug@rivosinc.com> <20240125-snitch-boogieman-5b4a0b142e61@spud> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="e/FrbnVtGEexHgLP" Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 4598D140036 X-Stat-Signature: 7sucy9gmjhqddugbx46grqt7k74guyir X-Rspam-User: X-HE-Tag: 1706208307-418910 X-HE-Meta: U2FsdGVkX1/7t0MTYzYN3AXhUfnNypxQjcMQMyyFxcC4/7oqc6lDm5mrUQ8L/VxLGRqcY8fx1Nz0Z86LzCJMDcJwm7bo8IGZPHZSXaMfLMOFXd4nIMjRSvdo3X/KXce60XxEBHPKKxlDX8c0QUq0abVRsJubcEDjcDbbodulV3RQorlbL5ZJDZ9XDk8ENlgFTGrKlp8B+5PvYBLoVaBESgk1SXa13m2fNUT7dkGeQ1vGUITEojq0XkoITe2ESWT7b/Ol/bF05j1iYcOTGOeMRK6giYO5NH1C/NsrvJAeCdLNGGXkeQyK348M/k0qqzfII37vQxlsNOUkNfTaW+CIWZyjtFV9kdCyPYZztjJ1RfPGkYnKl9JCuqbLS2MaaSEccD5bT7G7KHcls54/GVCVPhFnL25fD1r8FY+VUBqjmPaw+HHqbOC+R3kulLyipY/SvHRVp8QpYysUDbcrmFnnbstdlRhw0nD8uJ5ts3ZllZ3ANZbJO8FIzdRJl2lK4eXb6zZ1DsELDsjX4V6k40YZVZq40jX7hSj8HwJ36ZY8zlxbNltY5q6s2EBthA9o5m3bYabnlYe99VJNJprcEgedEksTASvWeQ1cVxG+wo+gnbI0HPEA3Jp5aGB6AWFKlO1afyJgEd52mdX81Yd2x+Jxh8rZU6cCBw1kvqiaQOAnZ4pKPkamfDXaRNFS8yjXait6npEH+eM72cwoZ3kpQMkZoJf4Lp6J6Dg5Ls9lh4W4sI84j3AjYJcyz+no2SgIIljxSbM/mmZ9mge9Xu6oCGlX0Nlb/yBH6KYaoQeFyJhYmJNEM1ftul4s+/9pD4+xQFbr+5B4Lj7nSkeHoyqylyL9IngzCtjdUSttnUa5wLXBx4mbvUjKQRbgZLaRxXtY9dtTvSmZ966OCuOtzANnaAIhlidK4O5cBlhH620f8HsLOYUGNfJZrTZfQCWc1z/cKdS1SJhniYxbeekac7B+0eP c/wXQzQ0 VNdee2KUYzyO5tMQovan9hoM7U97D6o0ibyd1lU6T67mEpLq0CpTgbkj/4pazykRHQlEDRWBfrMUZXkAFKvY3AfrydEWUDU4d8AbA5OhUV62h1W89+L36Ad1zfmyKQgJ5CHTtQPmYcVZRr4DjlBWFSt3PKJ/lHf5ofRM5QcQkQvNmgAxN+yVrLxzShOmfKFpt1Vghk4PAeAXawGAwn5KNp8kE5Vf4qE3oPGuWVJW0Qg4cf0S8csi+XOsZRBMuQ1NexHb3xo4cWSZHVKFk+0Qg5fEnnd3g29Ez7alG5wK5p+e7wYBmgkYb+D4LqZZtdEI1Q9qzUAfz7vjFqPUT9+7ftPWcTsI+yHrfs186 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: List-Subscribe: List-Unsubscribe: --e/FrbnVtGEexHgLP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 25, 2024 at 10:12:16AM -0800, Deepak Gupta wrote: > On Thu, Jan 25, 2024 at 06:04:26PM +0000, Conor Dooley wrote: > > On Wed, Jan 24, 2024 at 10:21:49PM -0800, debug@rivosinc.com wrote: > > > From: Deepak Gupta > > >=20 > > > This patch selects config shadow stack support and landing pad instr > > > support. Shadow stack support and landing instr support is hidden beh= ind > > > `CONFIG_RISCV_USER_CFI`. Selecting `CONFIG_RISCV_USER_CFI` wires up p= ath > > > to enumerate CPU support and if cpu support exists, kernel will suppo= rt > > > cpu assisted user mode cfi. > > >=20 > > > Signed-off-by: Deepak Gupta > > > --- > > > arch/riscv/Kconfig | 15 +++++++++++++++ > > > 1 file changed, 15 insertions(+) > > >=20 > > > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig > > > index 9d386e9edc45..437b2f9abf3e 100644 > > > --- a/arch/riscv/Kconfig > > > +++ b/arch/riscv/Kconfig > > > @@ -163,6 +163,7 @@ config RISCV > > > select SYSCTL_EXCEPTION_TRACE > > > select THREAD_INFO_IN_TASK > > > select TRACE_IRQFLAGS_SUPPORT > > > + select RISCV_USER_CFI > >=20 > > This select makes no sense to me, it will unconditionally enable > > RISCV_USER_CFI. I don't think that that is your intent, since you have a > > detailed option below that allows the user to turn it on or off. > >=20 > > If you remove it, the commit message will need to change too FYI. > >=20 >=20 > Selecting this config puts support in Kernel so that it can run tasks who= wants > to enable hardware assisted control flow integrity for themselves. But ap= ps still > always need to optin using `prctls`. Those prctls are stubs and return EI= NVAL when > this config is not selected. Not selecting this config means, kernel will= not support > enabling this feature for user mode. I don't think you understand me. "select RISCV_USER_CFI" will unconditionally build it into the kernel, making stubs etc useless. You're talking like (and the rest of your commit implements it!) that this feature can be enabled in menuconfig etc. Having this select will always enable the config option, rendering the choice below redundant. Try turning it off in menuconfig. Oh and if it were valid to have here, you put it in out of order. That's an alphanumerically sorted list :) Cheers, Conor. --e/FrbnVtGEexHgLP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZbKsIAAKCRB4tDGHoIJi 0s4rAPwLj36cq4OCVYXidwGHQqrZUowdECj4uRLcWI43EFSS4AEAt/7J8GXw81Mv lW2W0+1Wk7ntO8Qb5WDzqbK7NusmQwo= =Mape -----END PGP SIGNATURE----- --e/FrbnVtGEexHgLP--