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 4248FC47258 for ; Thu, 25 Jan 2024 19:26:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B2F8280005; Thu, 25 Jan 2024 14:26:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 962C1280004; Thu, 25 Jan 2024 14:26:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 803BB280005; Thu, 25 Jan 2024 14:26:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 6E834280004 for ; Thu, 25 Jan 2024 14:26:56 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id A43E9160E1F for ; Thu, 25 Jan 2024 19:26:55 +0000 (UTC) X-FDA: 81718815990.22.9FFA0F8 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf15.hostedemail.com (Postfix) with ESMTP id B6766A0005 for ; Thu, 25 Jan 2024 19:26:53 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=Ygzc1Bra; dmarc=none; spf=pass (imf15.hostedemail.com: domain of debug@rivosinc.com designates 209.85.214.169 as permitted sender) smtp.mailfrom=debug@rivosinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706210813; 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=UQXEmk/KhfqrXjoSGAenKDc1hYdrFqHQSs6fJFT2dl0=; b=yutuHi18jRfgy0eiJ1qDJ4HYlwrSXrF4lqs4485XnNlTZFjug/DhO7CS4XU2amBXM7HBqg 5u80Z4hHydEbmb2Zab5DHOMHsvJ4gqI6o4OFGa/QH1tv/BY6J9jlC33iYEjlk75X9QWtHP hT+3+qbMD/4TC7xuQpbZtOyr9Vydmp0= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=Ygzc1Bra; dmarc=none; spf=pass (imf15.hostedemail.com: domain of debug@rivosinc.com designates 209.85.214.169 as permitted sender) smtp.mailfrom=debug@rivosinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706210813; a=rsa-sha256; cv=none; b=rp4SnZb2PenfZ52rXLK209WvZ7kedvad/QcwbQNJt316yRP6bGSLcaah4QBzWASiDfdbOV /Pu+Q5Yt0lMM5lpVKehKAQlKQ9GwZjch7Rl0Kc2H/SBj9lg6TWkmjp3ZAD5boV3s/sB9dE efgCWvBt6k+P/NvN8uMHLNRe2qoBM/E= Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1d7881b1843so16401325ad.3 for ; Thu, 25 Jan 2024 11:26:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1706210812; x=1706815612; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=UQXEmk/KhfqrXjoSGAenKDc1hYdrFqHQSs6fJFT2dl0=; b=Ygzc1BraFU+Rxt2XCXpm/Uo9z2YjNVe3iNzlN1vaFYklZACc5vC/ycts1+8UJpFa8Z 7g6yUnpuUSUnGa82H8IWxySR1/pBNKnvpaQkgnh8p0JpHrpMkU2fAsX1cUjES2bISDc4 6yWC2j4inqfNLCcVwsEuDgoyMFZaLxWDnXWeCr1TP7DGg8Gu7LCWQp2wvzM3rdMJQPr0 WGxRvtN3XLYc2kK7GvR/B9H5YFJQn5EbgJRbYyMAnvb4zHhE+o9hp4+sVBkR2LxgRBiB x/QchWv2SNwDhfwczZ0h+H0aOTeYMuaEXRyRYntY6BOLf5e4WqjV2uHR5BqA9VKcMZ5e 8XLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706210812; x=1706815612; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UQXEmk/KhfqrXjoSGAenKDc1hYdrFqHQSs6fJFT2dl0=; b=BBowvFO7xJWj+7US+ckC47c8Z+fhFoU1lkEX1in/InIpsDiYOSEjiVxszUNJaDwwja y+47LZLxjik8p8pOSD7Nc4zpPkp+gArHUL7LnqxDFC5BLQSuCDJlZuUzby6CQt1deaZe cTXo6i8jLNMwdgBkesyO5/yD1VMazDhd+QN1xQewTlDSk9/8PGD2ZrniTJCzkhJhEcKD 7JnYYDyM2gEaNrOq08Z4LNM2DuYgn9gIsJWr6E0N92Sqc3EPTdy2c8YW9V0P9PKFWu3/ ErJ4J6moCWtO34MqRJaEtwO8Bgnz/OoDZPDSxO3oBJe5N/hMw83n2rFSnxtscDIspEZS 8SpQ== X-Gm-Message-State: AOJu0YyWKw/BMlVV5BLG/T3VFUUPxczVzeQS+ELA+ROb5iRJVXwabie1 jkVFRGtGtEk79cag7vkD/qRcDvRt3WU2nIGvU9vGVbg1DiUodw9Kc9/126kVJ44= X-Google-Smtp-Source: AGHT+IEjKhTyFXdeaj6bJIwWSc4zBffLzTHNmIGLnbACUsqZozte6YVSrp4zqdesGPXDBC/y4GWPyA== X-Received: by 2002:a17:903:2350:b0:1d4:97:b8e with SMTP id c16-20020a170903235000b001d400970b8emr186405plh.79.1706210812431; Thu, 25 Jan 2024 11:26:52 -0800 (PST) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id l11-20020a17090270cb00b001d757e49a70sm6544821plt.112.2024.01.25.11.26.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 11:26:52 -0800 (PST) Date: Thu, 25 Jan 2024 11:26:47 -0800 From: Deepak Gupta To: Conor Dooley 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: References: <20240125062739.1339782-1-debug@rivosinc.com> <20240125062739.1339782-25-debug@rivosinc.com> <20240125-snitch-boogieman-5b4a0b142e61@spud> <20240125-implement-coagulant-3058e743a098@spud> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20240125-implement-coagulant-3058e743a098@spud> X-Rspamd-Queue-Id: B6766A0005 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: pxzsg6rcj64fsxwh8gqutdha5mougjwm X-HE-Tag: 1706210813-233091 X-HE-Meta: U2FsdGVkX19GQFERQrE3nbRYGzFBomm1zx0tkHWgkeIkIE/JzXxii5yKRVsoJ1esf4sBpqLrrvdN4FVxMaXAqlioR8f58QS2Xl9wkDaEblhf/EY9PnA9b3gQHATPcd+8fpYxNSGNgL1oFA6IlKHi2Tqh02VyQSxH+pFsKzc2lzakvzVsckbD31Eq7BxhHAxfKI7rW95iTiN8ZVftl+NU1doNqfWMsG4swgh38yjVOOoAPLlAjeP3R2wLUm4aBc5vrhwpC7VukE/KosNp/MdJdnKxZ+LtXPu7xkFxDJu3P6p2RgrJvYA1IXm4Lf/wz9dhkEUS7SlUhrjtlfeMndBj6mVFHf1h8k28Ca1RtubblTZAWHdMojLHtm5baU4pKXQOKao+i7ONhxccyciK0wd0FlxRr2s4oWsEyTidw2nxyWa+wNj/rrAB0Ob9fGthm2BlBcrnPT3RuRqkfJ9UWekx/cUiR6cWchpIijK0FkeqlhDFL8UAuA9ENqw2khKtHLbIDAkNfYLwkNvDQDLrRB0pcK/GjmTQaMiVjz/T7KvLH0e+87LAaouVKYzXbFrJb/MKGuUT5l9rks8NceQwAwbGdz+WSwUa3NnufwpP027+1+m4WxFl96NlDZnX3d4RT892u5AqysopKsdJ1ssWaQTlS0Bvwng4pwkOcb5ZRaRDP5j4l1gpRUrGjICXEmya6B2mPDeQthYKULj1P0U9jko57cpXtEEWk81+I6JfHHFe35Dwqs8M43X/Aa0t9tqnAcpViE/yJ7jx8E6PqBLDt8mziv3YTK1v/8dNHq1pTYa6vK6VG+KESwkaPmBwEWeQ0jEiPx9Iewt+IEhQD606/UBCO464jYyJxmlsKnPOmbn5yio7FAtn1sXmX4tBKjN1gPttDbb0zkSnIq8FMZAW7ESUTfZeKQlJyN61jTvqiTdU1rJaX5EokJRKbx6Zet7VXl4rqAGyeSylCW8LaoGm+ah ZTfjRAD1 2oyIV75IC1NzY5ZIhioLt+dAJKvFkwAjOXJcfRgKmZYovk8aBh8tVCHQ57TwrqIGKqRHlyZljmWNXEAKc9dTfQLs+wsBZEo2WwqDIJBFFzbpydG7xTz+XhCqDjQM5KtYs984Pi5nD2hswNQLMglyu9SSeDV+rM6Va3lU+FuORdP/4e6vlRZCsjZjnuGSnjy1gA0m/+9riLIFQRGZVH7y0tTDcGGcnU36bXR4YIZdOLwAMM6mrdteqznC838xPX/XceMFuW2KKSS1L6qT4M//ixDo2d28HokVZcM39LhvLGziAMO7j0MO7pGSXzipE5UCYYgCUfxFsnqLPwnpdv1LRGMopm1tV5LQMIDFnnNPj0KUnSeyk5zBfjOUELDT2n9BqYcbmiias00I25c9AB1T+g5lGNke7F6VonKAWz76gfM7R6f5M4/vE+GVOwyQSDyqx3GrLF/AtjMa1aU9uRM27poDf3Q== 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: On Thu, Jan 25, 2024 at 06:44:48PM +0000, Conor Dooley wrote: >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 >> > > >> > > This patch selects config shadow stack support and landing pad instr >> > > support. Shadow stack support and landing instr support is hidden behind >> > > `CONFIG_RISCV_USER_CFI`. Selecting `CONFIG_RISCV_USER_CFI` wires up path >> > > to enumerate CPU support and if cpu support exists, kernel will support >> > > cpu assisted user mode cfi. >> > > >> > > Signed-off-by: Deepak Gupta >> > > --- >> > > arch/riscv/Kconfig | 15 +++++++++++++++ >> > > 1 file changed, 15 insertions(+) >> > > >> > > 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 >> > >> > 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. >> > >> > If you remove it, the commit message will need to change too FYI. >> > >> >> 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 apps still >> always need to optin using `prctls`. Those prctls are stubs and return EINVAL 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. Aah got it now. Thanks. I'll fix this messaging and select in next version. > >Oh and if it were valid to have here, you put it in out of order. That's >an alphanumerically sorted list :) Thanks for pointing that out. Will fix it. > >Cheers, >Conor. >