From patchwork Tue Oct 8 22:36:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Gupta X-Patchwork-Id: 13827088 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 3BC33CF042C for ; Tue, 8 Oct 2024 22:38:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1EA436B009C; Tue, 8 Oct 2024 18:38:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 19A636B009D; Tue, 8 Oct 2024 18:38:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F300E6B009E; Tue, 8 Oct 2024 18:38:07 -0400 (EDT) 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 CFCF26B009C for ; Tue, 8 Oct 2024 18:38:07 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 40001A0CA9 for ; Tue, 8 Oct 2024 22:38:04 +0000 (UTC) X-FDA: 82651899414.13.9E79B6A Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by imf07.hostedemail.com (Postfix) with ESMTP id 69F2940004 for ; Tue, 8 Oct 2024 22:38:05 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="y/sMB0kZ"; spf=pass (imf07.hostedemail.com: domain of debug@rivosinc.com designates 209.85.215.174 as permitted sender) smtp.mailfrom=debug@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728426950; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pxvPbFdPQ1tC+j3wFHGGOQBUzN++1F4GTwbS3f8RUbU=; b=YrpSjmCes/fVrzStzwtlldgLnKqUOEe6vOtymKT2MZWInboZljlKwwKPsNC338OH2+1iid CkhJwRfxx6SZRkMsvRCxoDOS/HsuhbA6+eyGE5uh/TitYwUenRWpIJrCCR64EsPVX8toK/ LporMhSqQQWsHckRRrmDvVw79A6vuaI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728426950; a=rsa-sha256; cv=none; b=HYEahG1wB/HCfi5XByfwPxrPlZlDZgDxVhmq/GnXpZ0EWZHhRNG/LgbEq2GhrlUOiuPq+p AZ8ADW34xC7bTxsOn6yp+zZ3GehWEmlksqMTN7NA4b/SUl4mFN0vdidVqIGTbaoFwtiTSv 1/PYNq+Xxab4h5WmHw4ns1psldBzINs= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="y/sMB0kZ"; spf=pass (imf07.hostedemail.com: domain of debug@rivosinc.com designates 209.85.215.174 as permitted sender) smtp.mailfrom=debug@rivosinc.com; dmarc=none Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-7ea12e0dc7aso1717639a12.3 for ; Tue, 08 Oct 2024 15:38:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1728427084; x=1729031884; darn=kvack.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=pxvPbFdPQ1tC+j3wFHGGOQBUzN++1F4GTwbS3f8RUbU=; b=y/sMB0kZHvclnzk5t6MT80F72QxXXAX5CyZzeVjbNnvv3R/fHsXGLYW9FNl9ZzZG5C PwRIdjY2yg/yUVp3bA3+NOnpXEgIKVr4QfNRvQ/+EQXkmGNkFFYa8WeO4WuIAFMGUfhn 9fw3n+KrDtrn+QPBJ96hGJ6LQn6Oh8oBAnmiYojmqoeeFaMvJpUF5Fhs5AE7SPi1mj7q cCZ4WB3aV0bE3qgCn/NxIsm2i9x79XEGDtENrOtvTFDzm+NIGVaFpdA6N0+WlIOkMp8A PBnES49Zrwclf+G8PbQjhVHv05A2WyEfGVEJe5rzEx+kLbaxmuXhFRVPIkxWTFR8Ob06 nXDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728427084; x=1729031884; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pxvPbFdPQ1tC+j3wFHGGOQBUzN++1F4GTwbS3f8RUbU=; b=EG652KFOOr3/2TRtGOIUZxrai2Vef1CECGRM9JoTyPyvRG3DVQsrdFiyaSOMrarR3s XZR0cvrqNEbFo6I7vHQn/hZ3zugky0vJ4gRNlCSXYUt2HG0L8JR0cme0oh5tep3jzLpw FGq4FeauCOTAa5QNXJGLNh2tnkMMpgjkxQf4wTu38x7e84V9DWMGmPu+suwtmMksRQbB aEBYmikd3e4RlXSfm+EVGhgQ8/G5ceKZGHaLPRN7uyt9Ze+ND9jJeXS4i6+Ohw2RWp/O uVkz89r368I+N5QS+spd3Po2Um8I2DBtnbOP+I61scmybL56nMl+zNzaA4AUowrMIpXd tmDw== X-Forwarded-Encrypted: i=1; AJvYcCWAFV5axFsmCeJHFUkWJdPZOD6ECbhMWpA74SlM7CNRXsfxEix86UyJGnCmN8pF8jvyyPTomybq9A==@kvack.org X-Gm-Message-State: AOJu0Yy2MtWbingpF34e7P3Eg0kqMjtGPaFYWdIBCdropIlFPoQfMhT5 JvxQdzC6JFAycTDYPJcVGoNB2qpxxo/UJ9MaldopeXlTjapqCJPO1KVy291RF3g= X-Google-Smtp-Source: AGHT+IF3M/VQF4JxFEIfdPLZxd9ZoguSrfvN9rKCL1mqQD6cOVqVplTxyPp4R1gZRhnFMnmKa4HdWw== X-Received: by 2002:a05:6a21:9102:b0:1d6:d5c1:e504 with SMTP id adf61e73a8af0-1d8a3c1e587mr859595637.26.1728427084123; Tue, 08 Oct 2024 15:38:04 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0ccc4b2sm6591270b3a.45.2024.10.08.15.38.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 15:38:03 -0700 (PDT) From: Deepak Gupta Date: Tue, 08 Oct 2024 15:36:48 -0700 Subject: [PATCH v6 06/33] riscv/Kconfig: enable HAVE_EXIT_THREAD for riscv MIME-Version: 1.0 Message-Id: <20241008-v5_user_cfi_series-v6-6-60d9fe073f37@rivosinc.com> References: <20241008-v5_user_cfi_series-v6-0-60d9fe073f37@rivosinc.com> In-Reply-To: <20241008-v5_user_cfi_series-v6-0-60d9fe073f37@rivosinc.com> To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andrew Morton , "Liam R. Howlett" , Vlastimil Babka , Lorenzo Stoakes , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Arnd Bergmann , Christian Brauner , Peter Zijlstra , Oleg Nesterov , Eric Biederman , Kees Cook , Jonathan Corbet , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, alistair.francis@wdc.com, richard.henderson@linaro.org, jim.shu@sifive.com, andybnac@gmail.com, kito.cheng@sifive.com, charlie@rivosinc.com, atishp@rivosinc.com, evan@rivosinc.com, cleger@rivosinc.com, alexghiti@rivosinc.com, samitolvanen@google.com, broonie@kernel.org, rick.p.edgecombe@intel.com, Deepak Gupta X-Mailer: b4 0.14.0 X-Rspamd-Queue-Id: 69F2940004 X-Stat-Signature: 7wnjhdk14ce8aipt8pnuzm1uh3ctdpka X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1728427085-775400 X-HE-Meta: U2FsdGVkX1+VP4z1C1pMdf8ctsifODZFgjb3AHKXixF3j1XC36jx+1X13Qy4F4X/SE9s25Chgewekba0Xlf1jp8xd3TevsJ0uee2BvX6cyyOiX4cZTt/NAOGPHCxcvIXiroGk87t8IWGOQM7EVPhWx53rKn0DzxN6VqMurhrNuZczMa/lX+pGEsntSyiKZEsJzXaHI8k8Bm3y+aTMWnFbqmDT603rPFR4/i5+tqfvj00hChMOvr4n5KK1G6y/Xo4EmfAg57l3otbWxKuBpmMxy80ZGPMRp+wzPPcCdbLPp07qPDaKTSZ4rAoNzXKvGIs4NBKzUAWf2Wlj4FbZrjX3UndLNbd6VALV8gfebXvBgT0QND943aLzXEuK0npxAMN/51R8GqDQYjUOQ6RtVZSLkdSmnvW0SAlPSJS9UGKsbAketHeD8z3pnoyhgD5Lr9V32v9PpNhrIiXRSbnC+wsVqBfw7OcUHQwe3zXRwunkCgzv4GkOww6Ifm1v8gerqBa+plhmHAh8XD7IBFT/omal40eT01xonPxmbo6szSoez4DWr9dEA9le8c0epHr6swFQjiIEIJCztkwbPmyXxchzkpCU4Dqub6BOs8Kj5qYhA6vts0ebE4ZpEE5foKXl+8vZ0WrkHLTOrteUcaXKesZNA2tJb+FQ0k0tgLcM8ai9fFke77i8KIzHc4E0FnOJlqoEc7jHOSozfjg2tvm1kDhBi5hqiDk7iPCDWruyAt8wYZCLDQS3dMC6unpG+dphTNUIoVUJzm3bIIKaWX+RVy794g7Rx5yz4nofmznqUS179uFI/2EcdyHl1baF2+lg7QSTTccnZSaiJevo9os48GLg7lbKgbU5qlQFYOlBBxe9fobouTeXxb/rq0pl1f+f13YPdKRcfHw0RCZKeoCAC6Q/nWxzge+Zt23EEG0Ds4uVhSfq7WuyNz9Vr4qTSsiSeIjUNzss4GPHQ7tY8+/2KY Hllq8eaD 5eCJGVr4SeYMB+jG0FMSvknR4jayA+HeGkmhw8diBKVq193QkM5SuCJDHRNx2cBqRoCZDlHWjXRTBqsLzwlak5RfDPRslC/2H+YdYrhrltrJreMRI21t5n7oa1fHyek/vjCuBJnw2Ue3noXGMQriNh8ceY5U/c0xGoWH7yl3l8NSRvGo4gbRMXye1SPKCO/5KlntT9iVsnLQ4ozmVg875KGh1C1zOapZ6W4ld4wXQ0MqECploRv95IK81DIpRE0ADrfdzM8lfEKSurzQgjchs20NNYu3h/JwqK/0jOs43gnUBBaOEah2uqNPYTc0IsyJrV3Cr1r4v6m2rSDb3a+npbQU99cqDormyz/1mNlE0/3x82ZnGdGLo3ncqLtTdENypPUNjalHavI3Hx1TVPrS8erkKnQVnoYsI7XG8FQSqPXjfzeoLSRu/+knJrp9B4hVgMkf3CjYcwqCMhAyI602zpjdsKWNsm43OP4PbWPiakBtgBSZhQJqAPUaandNWRi31ht2TK0nb1bthjya/+RYqJ5Vk+gUTTB7pUnQYUu7eU9UwYnfh3uBfjCaicvyI3C9iI0yg9NMtr5GyJoM7db8Jyi/xe5gq5hm79A28pgVVdYyxdn5k0+OoEY/gmQ== 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: riscv will need an implementation for exit_thread to clean up shadow stack when thread exits. If current thread had shadow stack enabled, shadow stack is allocated by default for any new thread. Signed-off-by: Deepak Gupta Reviewed-by: Charlie Jenkins --- arch/riscv/Kconfig | 1 + arch/riscv/kernel/process.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 22dc5ea4196c..808ea66b9537 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -182,6 +182,7 @@ config RISCV select HAVE_SAMPLE_FTRACE_DIRECT_MULTI select HAVE_STACKPROTECTOR select HAVE_SYSCALL_TRACEPOINTS + select HAVE_EXIT_THREAD select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU select IRQ_DOMAIN select IRQ_FORCED_THREADING diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c index e3142d8a6e28..1f2574fb2edb 100644 --- a/arch/riscv/kernel/process.c +++ b/arch/riscv/kernel/process.c @@ -201,6 +201,11 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) return 0; } +void exit_thread(struct task_struct *tsk) +{ + +} + int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) { unsigned long clone_flags = args->flags;