From patchwork Thu Sep 12 23:16:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Gupta X-Patchwork-Id: 13802829 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 A99CEEEE270 for ; Thu, 12 Sep 2024 23:17:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A4DD6B009B; Thu, 12 Sep 2024 19:17:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 32F186B009C; Thu, 12 Sep 2024 19:17:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 180486B009D; Thu, 12 Sep 2024 19:17:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id EA8A76B009B for ; Thu, 12 Sep 2024 19:17:35 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9A636120CCE for ; Thu, 12 Sep 2024 23:17:35 +0000 (UTC) X-FDA: 82557650070.21.F4F196E Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by imf08.hostedemail.com (Postfix) with ESMTP id BFBE4160019 for ; Thu, 12 Sep 2024 23:17:33 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=s1Hv0Grk; spf=pass (imf08.hostedemail.com: domain of debug@rivosinc.com designates 209.85.216.42 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=1726182948; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OL3ZuDMqCGbJryHQ73fpa2Z59erwJkwOpRXQ2rxwv1I=; b=7FJxHjGW0ZXqLV/PgH3YfIjTMbfnEw4erV8caN0yNqTR4nQB5GcUCSwgnKonGvVT5I5e+u 3bzIjsEqEHWUyF38PVF1BgOQIzyWMLZ4Ia7r7NtfN86mUxfPcrkE8pjmLx71/71SrkyO5v HFJZjkSpbgzx2qJvMHzFVt6pf7D/lWA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726182948; a=rsa-sha256; cv=none; b=7WQH9vqoDC1/Rc6md3+Qk1nF+x5bk6XUvnYKC2ndtgPMazKv7SXZ0850bvwyb+7vuuX2Zj q//sBCfvJPIvJhtLBjlmOlcl3lpbmRe6gDnvW7qor/vs9Z2vZT+6w/MIfMye80kjEv6iqj LF4yZRkiW7Dg2j6nHVNLzg0leB6lN6Q= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=s1Hv0Grk; spf=pass (imf08.hostedemail.com: domain of debug@rivosinc.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=debug@rivosinc.com; dmarc=none Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-2d8a7c50607so1075055a91.1 for ; Thu, 12 Sep 2024 16:17:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1726183052; x=1726787852; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OL3ZuDMqCGbJryHQ73fpa2Z59erwJkwOpRXQ2rxwv1I=; b=s1Hv0GrkslvMRDptQ+EkW0W7T18CkQDYyCrdNsTSsxEedD5E8rI7nolqlclc0aSIYY dD8itNqHxNcO6si/Qxmuu5adotfZ28XllGiCy6MrHFUMJGqBI2lMT11Y/gnjDCogjzSC NemutaEuzIzIfIwsPgIfzVcKZ1hrXKFVek74zTU8U8TYLjnCaNvUxtNTbhDCFpamTcSE yj+Ocqw6qNThIV1xcoy+8jSI1y8NAfuE4Y6jhnkGvRqUWgFbm77dKLoh+UHUFHfkDcpf HWIcztRYlZ3xh7kJcZPPUOrjxkFm2PnNQMX8s2mf3qONLBbYSc6bdh4/s4kRGhauNkZk M2fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726183052; x=1726787852; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OL3ZuDMqCGbJryHQ73fpa2Z59erwJkwOpRXQ2rxwv1I=; b=KcGYztToGBxS8PxKEpozCsM9rdojUhK48o/cBRU+OOEH1Yk7jifXRLwN02KelOI/QP /VKENVxZKBXMUHvZfdZ5U8zQkKkiggzmp7q4xolv0DxGydHI2Cj3eS9yrb53iFkg6Ko1 r+BjLAiM3bJw9wm5hDbo3ygf7h0fs9IrEbqoVdwRySfFog4XbyE251IqQqeiHvN5uDJD WGtj9O3qQ6kNv2nULlLN9dMrEURElDjsFLZHdHiKwK6GmgiLMjS1mQCmevT8gR0/mw4n UDw8u7ziyGjuZJb+/SZTsDj6cGRQRuQ/m7hnwG9OnR0UJrLpcOf0XHzlJpBSOlvUGz7E ppMA== X-Forwarded-Encrypted: i=1; AJvYcCVOwYPdotIn6MgOtpW0G2TAV2rpBAbo7ZCIC8QSyWHD/qigsre6xBo/r3Wz7okJKUkHNcZDJ9OSgQ==@kvack.org X-Gm-Message-State: AOJu0Yz1eaUyU9flN865s9ozRuB1B1PDcuLA4tN9921uk4NDfWb6XT7q DA0r+OmCzuhvNBjLsqBi/nuLaCLjNRY5lg5LQtWTJdNLGyIU2ZFibAQBNmg5SUg= X-Google-Smtp-Source: AGHT+IE9fam6IfuuZkZ+ZvbmFrswnqok3RLTHJaic61nQCF+zeo3Ji5hunRDoKXFzuz+ce22C8cSog== X-Received: by 2002:a17:90b:1889:b0:2d3:c4d3:de19 with SMTP id 98e67ed59e1d1-2db9fec65ddmr5214534a91.0.1726183052278; Thu, 12 Sep 2024 16:17:32 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2db6c1ac69asm3157591a91.0.2024.09.12.16.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Sep 2024 16:17:31 -0700 (PDT) From: Deepak Gupta To: paul.walmsley@sifive.com, palmer@sifive.com, conor@kernel.org, linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: corbet@lwn.net, palmer@dabbelt.com, aou@eecs.berkeley.edu, robh@kernel.org, krzk+dt@kernel.org, oleg@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, peterz@infradead.org, akpm@linux-foundation.org, arnd@arndb.de, ebiederm@xmission.com, kees@kernel.org, Liam.Howlett@oracle.com, vbabka@suse.cz, lorenzo.stoakes@oracle.com, shuah@kernel.org, brauner@kernel.org, samuel.holland@sifive.com, debug@rivosinc.com, andy.chiu@sifive.com, jerry.shih@sifive.com, greentime.hu@sifive.com, charlie@rivosinc.com, evan@rivosinc.com, cleger@rivosinc.com, xiao.w.wang@intel.com, ajones@ventanamicro.com, anup@brainfault.org, mchitale@ventanamicro.com, atishp@rivosinc.com, sameo@rivosinc.com, bjorn@rivosinc.com, alexghiti@rivosinc.com, david@redhat.com, libang.li@antgroup.com, jszhang@kernel.org, leobras@redhat.com, guoren@kernel.org, samitolvanen@google.com, songshuaishuai@tinylab.org, costa.shul@redhat.com, bhe@redhat.com, zong.li@sifive.com, puranjay@kernel.org, namcaov@gmail.com, antonb@tenstorrent.com, sorear@fastmail.com, quic_bjorande@quicinc.com, ancientmodern4@gmail.com, ben.dooks@codethink.co.uk, quic_zhonhan@quicinc.com, cuiyunhui@bytedance.com, yang.lee@linux.alibaba.com, ke.zhao@shingroup.cn, sunilvl@ventanamicro.com, tanzhasanwork@gmail.com, schwab@suse.de, dawei.li@shingroup.cn, rppt@kernel.org, willy@infradead.org, usama.anjum@collabora.com, osalvador@suse.de, ryan.roberts@arm.com, andrii@kernel.org, alx@kernel.org, catalin.marinas@arm.com, broonie@kernel.org, revest@chromium.org, bgray@linux.ibm.com, deller@gmx.de, zev@bewilderbeest.net Subject: [PATCH v4 06/30] riscv/Kconfig: enable HAVE_EXIT_THREAD for riscv Date: Thu, 12 Sep 2024 16:16:25 -0700 Message-ID: <20240912231650.3740732-7-debug@rivosinc.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240912231650.3740732-1-debug@rivosinc.com> References: <20240912231650.3740732-1-debug@rivosinc.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: BFBE4160019 X-Stat-Signature: rkoaq3m6q598omzcbbwdoyw88b3uquig X-HE-Tag: 1726183053-691825 X-HE-Meta: U2FsdGVkX1+GhENkisdPuLo25d6qGVPnasEyQN6NQkSpwS0SiPKCSH7QBk+kCjQcIyYLBWeuA7Z8oRKm+B0TPpeA4ZQE+cL/tO/Oujl8QrYEcT+j4Z2mRB39RDm1d5RlRrI59BqeaGkAZnghFDA/JAFiX6BNhC4HK28t8LVLDyF8sPt/56ZupAryf+yQMhQbsYBoGtHVi5B7vYDMpiFklCT6ra6DstVYEg7wBv3ww/6hLc29XedFGCP0QFjzDV/4S0Wa1Ftu+PvN1JqZ1jaMkvTaxw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UPJZxPeRUs3FQ2OAgg3XZNV1ifYsa8vgTATTHuvZfN29LAM2Tcy0gBFGCK/ns//WiZgsH5NTKpYM32QTgv3CD6EEvNtAzFvck8YHg+UQW4TUM1aLHEAUX1ZprWOWCJfMc9mGUA== 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 0f3cd7c3a436..d1d629a3eb91 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -177,6 +177,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 e4bc61c4e58a..9b66dc07c3d2 100644 --- a/arch/riscv/kernel/process.c +++ b/arch/riscv/kernel/process.c @@ -192,6 +192,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;