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: 13827128 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 554F3CF042A for ; Tue, 8 Oct 2024 22:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SS1FfM7RjOuCpLd4j2rIF+5goVcf+i2CjH7vVNQc6ZE=; b=GRbVQRsQ/DXgNY X6YviRvwrdbRDNOLtUEkPFByJg2MPDttcfFLJDH3MD1Ku68bz+Vu6hpigYMd0EU+OSj78VoBeZwaj RUYsRqn7gJ9HDssg6GWcEgXsbkRebbchp6soNJEH12DWC35UI8YWkXXy+wwCBcmtRSVqUgYpFo0pp eLacIZdD4lA1iAKb12AKMeLdKdJQAvemsYqW0Zm5mei317L1yZpmnp6Z84YhtuaewSpPyr9dNf7Vs GCu6O4UZcbO15tiCMj0U/rBgnLW587h0qEn1HAM/eJkx91YmKKfK73xfkZRlXZfj56mEizSpDRhmW ZA3dbW/xuujrdlVUyt7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syIqM-00000007IUo-2h61; Tue, 08 Oct 2024 22:38:14 +0000 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syIqD-00000007IMW-1n4r for linux-riscv@lists.infradead.org; Tue, 08 Oct 2024 22:38:12 +0000 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-7ea12e0dc7aso1717642a12.3 for ; Tue, 08 Oct 2024 15:38:04 -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=lists.infradead.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=VwIVjuhv45zp7ybRINRzskoyW/G36Nk3JwOFhWs0chfTU3Tn4H68hgiQHuErQHYfnG Fy5w8nGg0Z0GKKmdGYUvLpNvmjus71lR082Bl4TmTGsT+jst9IDiapx4tndtxYZz4gkk cK9g7cQmn23+BBb2r8wPOqywY1eUh32YiKOQRzzqMUTApvdlFXGdDZ0BB87BzQ5eO8/1 7dRg0Wi857G2xAleZdPGU+qN0cT7OUGx+s4h4P3ZAJjSkdAp4FKjzKJNB1i+2YeH6QSH zns0fbiwTmbPzwrKY6ASGp+7CUnp54Ns2uK3PnXkpbBD+BGQ2VO0n1HfMZA7NZ8Bu0L8 5eYQ== 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=J2FjgJWcSgvJg4cdk+ta+bFWd5nQHm+fsNnAGjGG2RUlUJOV22nnBV3Jzfx7eEjKCu pm8IHoOCqELOCRPo+936K9DSDVVBogxg6Sh663BMBGAnEDB3/f8uTSQpJruJeQfISJCn a9cLMqlk16jDOI4RgWQwsf5LVrI5sqkW5ZLoqqF9lOFm9AM9+vLgmB9T3o5cVf8xWSZJ cdxZtnuAeSSD0zKElkRQ3v2cqviHnDGZr/EIzz2NZWg23bOncwJ0KBz60q8SixytD0xh sirTyFihM+7Q5aKoMjH0NGGYt1t4OagVJLEJ9lhie33R61wBX/ZnRIlUVSYo0aoR9dN7 iaJQ== X-Forwarded-Encrypted: i=1; AJvYcCVOIpwnKG/AGcayGXjDrJsVzxrM2LhxQiUGciCaJIXkgAmZKkWqU+ccc1qdyg8Z5YYHBS4fUUOKx1vGFg==@lists.infradead.org X-Gm-Message-State: AOJu0YyUJf8YJFXH7iGXEPpx9gUJ0XSefzyd61o3Xhn9pXFrW5zJ7Vym P2SAC2F7Wx3F4Hn6qpqcapsVMZDWHJSGGLXayIx7ct+TJlV9hkGnx3yFfWZSGRQ= 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241008_153806_010428_3F819915 X-CRM114-Status: GOOD ( 10.89 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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;