From patchwork Tue Oct 1 16:06:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Gupta X-Patchwork-Id: 13818409 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 D1DA0CEACE6 for ; Tue, 1 Oct 2024 16:07:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7547F2800A1; Tue, 1 Oct 2024 12:07:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 70118280068; Tue, 1 Oct 2024 12:07:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5537F2800A1; Tue, 1 Oct 2024 12:07:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2E4A5280068 for ; Tue, 1 Oct 2024 12:07:19 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A1C9F41604 for ; Tue, 1 Oct 2024 16:07:18 +0000 (UTC) X-FDA: 82625512956.23.511C7C8 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf20.hostedemail.com (Postfix) with ESMTP id 9DA4C1C001F for ; Tue, 1 Oct 2024 16:07:16 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=AbPGB0gv; dmarc=none; spf=pass (imf20.hostedemail.com: domain of debug@rivosinc.com designates 209.85.214.174 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=1727798696; 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=gIH4nHMO8J+Gt23iN5daBzBJpMX9UbmXJ84txuLTHrE8evTv1OuRCHzEKqlkNq2i72dyR+ 3affgGxd0Jbhc/rf9JiMIPrIe6vf1MSw5T8cIUXVcbBDlN1ZUhkkNbt07dN5fL+zyo91h6 y0Vw9g5TNyeI94yTuVjinYiw29lWq8Y= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727798696; a=rsa-sha256; cv=none; b=dNOMvnT9ErhJYoANYEruVfif0bL5nPatMJKkjdhXUiWWQ/ImqG07B/j9FXv97Vywb/lPBV 62V8l3A/PUC1nqZnnvjMXkbP1kBYrvxwZ6QNeLjmN1Df2P88CT4mWPKVrt0XuMdEoJMKX9 hB5g9V+Kj6v62kJP4BcjRA9jj94W9OI= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=AbPGB0gv; dmarc=none; spf=pass (imf20.hostedemail.com: domain of debug@rivosinc.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=debug@rivosinc.com Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-20b49ee353cso40483565ad.2 for ; Tue, 01 Oct 2024 09:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1727798835; x=1728403635; 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=AbPGB0gv8R5dUjpS8Dq3/0Ux3v9ZAk/Q4HmGcylVsCoIyDXJpI9NdTyUqjeUPovrYP XQq6iq/F/6efOJXZmiOEsA+RDkWeSVx3RfEtSlZRVJ/tkIxocu/eUrROGFXb3zIpdrph Wfq2uiRbQExJUlcoaJLmw4RQC51FEiVBQ6Cjh1PFdMM6JCyDnnC5vdk4UmemAAkm1FJH s05u1fBadFcQQFY4jnqJ56ln3rxDuxjIwI0I2tEfomL9kShOcRcDaoTQJvSiWnb6uz03 8f1aeSh4IK9HkZ2xweSMOuUtSOqV5VxKa2+4sCMQrFwSkv5Tqr+m6E6D3Hi3ZL7hlKcW xZ2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727798835; x=1728403635; 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=i22iu+fvAqzEC5jkb/zu994QrJqQvxaTH3b1ZfAJES6WBo8JbQ9RgHupiJPEsGLnm9 kehbj2Nh89Xm2Kov1aGgprB7EfckvocWTbqgj9fpoKHUXrB0PLM7sm9jIVtdGbrEinwR hFmG9eRn5nMMgVc+IE+7R+cT8AeOfVYoYKBVQojhLbxW1qiryruK1Q73AgPRQjY/wwBK aQogCe6NkmbfiKBVAV2Wd5DCkD3QeosBxwQv58TA5LfZJ5ZV0rHPP68dNyM15GNCAxp/ oHWHkQwjLueNpojSHzNUHp3N+s9weHWCBZODwrgC8k9Li1HJ78Gf87gll0TUrQwQXjAr 1XCA== X-Forwarded-Encrypted: i=1; AJvYcCW3FP2JqVRb+fkfGVxF6CanuawaAtQWLAVjP/kiKfsAblx/BxADCDRB2rmx25ObL/zhhZbRjnC58w==@kvack.org X-Gm-Message-State: AOJu0Yza39xnwNquTV/8G64hVXd9Jd4RsISHgrmty6r2PqSJEtBfylYD /IlVBqzxZ99Yib7I5Pl7bJ5+vmBbcfqjZqehibc1Osq/bqjkDJoONkYOCHHmedM= X-Google-Smtp-Source: AGHT+IH2Sm4Er88BRFmxFtoVQlQZa6M14xX+NOC0OSBp2pCUlTzjnB+u1q8ipbNjt5+sqIq3C7HKbw== X-Received: by 2002:a17:90b:3b52:b0:2e0:8784:d420 with SMTP id 98e67ed59e1d1-2e1848013e7mr226286a91.21.1727798835139; Tue, 01 Oct 2024 09:07:15 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e06e1d7d47sm13843973a91.28.2024.10.01.09.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 09:07:14 -0700 (PDT) From: Deepak Gupta Date: Tue, 01 Oct 2024 09:06:11 -0700 Subject: [PATCH 06/33] riscv/Kconfig: enable HAVE_EXIT_THREAD for riscv MIME-Version: 1.0 Message-Id: <20241001-v5_user_cfi_series-v1-6-3ba65b6e550f@rivosinc.com> References: <20241001-v5_user_cfi_series-v1-0-3ba65b6e550f@rivosinc.com> In-Reply-To: <20241001-v5_user_cfi_series-v1-0-3ba65b6e550f@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-Server: rspam07 X-Rspamd-Queue-Id: 9DA4C1C001F X-Stat-Signature: h6t77ofqra5ixiu43uq961yeo11rundj X-Rspam-User: X-HE-Tag: 1727798836-984619 X-HE-Meta: U2FsdGVkX1+ByYIvrvsFkSZoO/I2JkiOweufFpEjNyab/SGLG0Y9cUmPI3pQkYdsVIRgRo4IGuAJHJyD9Bc8N4IbhGKCy9iz/xRc7Fk90HRRl8t17VozMheHAwpV3S7TxMFrBfR6TT+siRKW+90TDR2ZbGt2g6LdlPap5phR6SdZUqAmC90GzAeVWiOwvhOIk11uIDFfOzP+CdRwUAsoLlOezP2LrQbQYST1yIyzYkLY7d09z0rLxxBRAWj8p7d60gigtfVOUPYdjeq0hYbcsD6Ob5bSOrE5U7OhRPICdxrrewUuz1HLSJVhrJR5zdfsC+6Ey33VxSRFrJZ8v7UFBMLY+4ggwyIJVDm3M5/EXPvu5/KC3KE27GD4lNM8wZ14o5LGPjFNA+FWToJwvahYoz5tPNaZ58yBTXmPQ3KD7Y1frT6dx5XgCnz72J20bLGg0+OOlDHIaYi1WsvRPqO1LOJdFB++9TcsTNNE2eWXP+5AYJw56m+neS7yxJUc6gfs1nMVXRjTAYC8ec2xa/gfS5LjIJb04bC1Asx+jECTGlEInfzl8ctbyQM9wbRLY6y8UOMaGr7sOGsGsCgpxBc8QVqhwIBXcJOinJWhNAvwMUeFuXrmVd8LhYBtUUsrKWjfaZ7qlyvvyVd07KEjIY9Ss0ZQHBmMsCLyXTP6Kt1AYIOw6SFaEfi9YKngUZdzosog16zKTVfuSszmSRn9atf0+AK9x7OysMjgMqITFW+MyfqYCTHif3Jl+sMtV7rW/5/60H5HgspZ3QqU7ULlXHXpIWbNDgL4vjx7NQxqBSUj5hfmW3g8vcw9KKcPFI9EezntMraYnZUaUlnNl9gFnWj5jsEGhUl/aR4B9HgVJHnFZgbK72IVtg2kBTGZs8sKSiBiYiLO/KLi6yydSe0rTOXKnvaWvr6Hhu5o207pa1B443CeRHIUsXPJ9fUH2+moMTmfZxphSjb4bq+nw0Ot0oA pO9KzKKz DE4gXGJuhiMP1F3FkseYhG1bqYaV8L1OnZGSAF8Ete3fVCuke7ZvDlLidUXUyoXdJ7NSB6hQhpb5bTpPQSgCMFcwVDhvfgnOt0TCDMksdqFc/F3jt+7HzqzEZZD+D+wm5qZ/22eVeewfKWoypWx9GFUl5ejl4sLNg9ejwTa0TjTXZDzrOD8x3YbFKc7le/QINvzBClrIqfLGNybIu7XBoYlo4RJD4AWFdQxG/3//oVC9ZY22j+x0vZStQD/aUaVfHMq84gV1ZCvZKyLmaxoRQGpPGNxPthI0TQYB0UORSAH+98UkSUv6qWo6S8ZvOHMkLIc24YCU9qvLOoeUTkZX2ZH7OA6I374eKGJIiAo+fFb6nW/nCzFNkTwmICufP51ily1dQJhka5XAhvy9nmrwhXsgAam4ktLb6zi7HrvK8QcWNupp6uJ39zLwenXRmLRSgFYf9fC8HxzzDovbd+zR2qkOk9XnwIpu/zkgDEHsEitpkPkFh0DYrnphbWdipQTy+TgJVVzmB3cKEdSh94b2rxd3KXfOAsxP6jpUuA9NS1cM9ZcKnqvrEyq0TujzLTHqFg1oaNUZhA9J5CwF0yAJYPn4pakzmHKTSbcBg3Za8wPCEWAzPC5xHddjuVA== 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;