From patchwork Tue Oct 29 23:44:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Gupta X-Patchwork-Id: 13855739 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 EBC5DD74950 for ; Tue, 29 Oct 2024 23:45:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 57AB76B00BE; Tue, 29 Oct 2024 19:45:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 525176B00C0; Tue, 29 Oct 2024 19:45:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39F6A6B00C1; Tue, 29 Oct 2024 19:45:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 18DAA6B00BE for ; Tue, 29 Oct 2024 19:45:19 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C590F1607EA for ; Tue, 29 Oct 2024 23:45:18 +0000 (UTC) X-FDA: 82728273264.28.0C4CE40 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by imf07.hostedemail.com (Postfix) with ESMTP id 0E6FC40019 for ; Tue, 29 Oct 2024 23:44:41 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=aYcngHcd; spf=pass (imf07.hostedemail.com: domain of debug@rivosinc.com designates 209.85.215.179 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=1730245304; 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=2F6Yb7wvkADRBV85CoJaexMx2ZeCvBhuuEpWc4ZWwJ8=; b=ZdQSl74ccVpSeZ22anJCtkykwqIVigQElZR0oq8RG2lDhQa2y8Gm224JKNkoK15xb3kJUm efThyr53wPO+xCcQi9sAH53PsWhHAJQ45G+IJYf7gVMZA31u49efrNm37+0b3Ab18gyr2D bUR4bNF49Lh/xKunewqMJzi3pC/vjYI= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=aYcngHcd; spf=pass (imf07.hostedemail.com: domain of debug@rivosinc.com designates 209.85.215.179 as permitted sender) smtp.mailfrom=debug@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730245304; a=rsa-sha256; cv=none; b=C78EheznqlxnJ158Gr+GuyQPRMjowJv33AfHdBq/Q1tflm4orN0NsJG1I/c90tbkpIo35w cr06kUIEJMbmvXe3amrm3Q7rw/cMd792oXx18QqKuEqfYkhnYGJ9kJ+W1MnHUkUAf3zQDx EzdFpM1W/DsNObnJdZI+5hlYVGEb/tc= Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-7e6ed072cdaso4330532a12.0 for ; Tue, 29 Oct 2024 16:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1730245516; x=1730850316; 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=2F6Yb7wvkADRBV85CoJaexMx2ZeCvBhuuEpWc4ZWwJ8=; b=aYcngHcdhZa2h42IjBQD/nVxwrIVARMRz07TWibQn9bei81qgg8E62b8cft2Nqo9YU D/XROehXUkVHQjpRv3AOCKah7TDdbdxmsgxa0RfYALL7tsIvXo5pWQD8HiY9WGoVjO5b w0OMi6Hlh0dON8rvyoMt9/UYDOkZMr5ZyJWs3VvpQqC4yUnKYUNMByT5dRkr7XgRqlD2 5uzlhgk9evd1WQZ1dgbGO07F2Yos63zxgiYPmM6snxOJN5twtTucQAZfG79IjaKeGnWA frXRb977bxGToxQy4P2E9O4mPpBTDsxtHrx7V9iKDDjLNWFQs/1HnkHcrgMml5YjDRNV mJLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730245516; x=1730850316; 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=2F6Yb7wvkADRBV85CoJaexMx2ZeCvBhuuEpWc4ZWwJ8=; b=ux+/bj4eqlui/kv0f/4Yt9bPMMa7MzUGkupu3SetHrGk65Jnn6jT+a+O/Dgs59fdfG 6sgicmv0xgEbE4aG9ebWYpJHfDZegSoGyB5wmr4gU6tuD8m2pqHNn2iOOqoVOU2P8+Cc LfOuhmUdd8S6kW0qU26c7UP1FjkaeqFAA6sxI2MLXnwRcVfzm2O7tNkSbVdL6UBIG4T2 lequ4uKoOBCNPNgZVHbrigbj3RAX/ZBzjUZ3xz7Dqpa8tqUtb+VSTL1YcomfjEbRySpc ubuokeIheisydRzOtLiVdjUup1zE7ICrH3Aj9WtRNeQmigAGC+HzU7CThRm0gnQetmVU D53w== X-Forwarded-Encrypted: i=1; AJvYcCU44N892FZ/BpzpSnMTaAY/wQrtjdIvwZ0KQgXMuo7BLi62FeP3+6S2DTi0p8DZTGgxTYLuPVpZdA==@kvack.org X-Gm-Message-State: AOJu0YxVaDxheM+Bf/m9s99gt0Lfxu18xN4POVd1wT9yfNHaXeVA3+g2 VaiiaHxGjQu7/s6JXiWXIDnNXKmEd305q4o3UScpRd4k55bNMInFMhfvk2wVeSk= X-Google-Smtp-Source: AGHT+IFymY57Q4keJ+3CC+aQlV02UPkTqGn3YIXKiyS+cNgyPpergOLYnge8dObsMTdwpbmiiUHDiw== X-Received: by 2002:a05:6a21:3a85:b0:1d4:fc66:30e8 with SMTP id adf61e73a8af0-1d9a83a6524mr18658257637.10.1730245515950; Tue, 29 Oct 2024 16:45:15 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72057921863sm8157643b3a.33.2024.10.29.16.45.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 16:45:15 -0700 (PDT) From: Deepak Gupta Date: Tue, 29 Oct 2024 16:44:23 -0700 Subject: [PATCH v7 23/32] riscv/kernel: update __show_regs to print shadow stack register MIME-Version: 1.0 Message-Id: <20241029-v5_user_cfi_series-v7-23-2727ce9936cb@rivosinc.com> References: <20241029-v5_user_cfi_series-v7-0-2727ce9936cb@rivosinc.com> In-Reply-To: <20241029-v5_user_cfi_series-v7-0-2727ce9936cb@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: rspam06 X-Rspamd-Queue-Id: 0E6FC40019 X-Stat-Signature: 64ia39s77cybx7bmaipahum8gmum8hm3 X-Rspam-User: X-HE-Tag: 1730245481-953994 X-HE-Meta: U2FsdGVkX1+XBUn9wbRFsA/gyw3yDs4HYeYbJsWi5BlkzGK18/SPy+bluMinwaVanvFbwrtvjvmlKPUepNmzUdzxQZZRea/E2FHnaroQ2R0Byzh2iKksjrzpaqPoPfzTPltk0oWnGMlHe+bfZd2vpWlPm1yE6BPbW3xRAFYj/U3RDJaKEUqJwTDlAZYl1No4KCE8bS9BaAinrQhf+8fbpF85GBmV/KKfIfUo+BUpBJWh8fBDPxRF9Ecn5/FLNTmfWqfLo4isT1BxADLvusNA3rf1gQNNZZoqgkWMdmuyJ9kc7V1aOlFs/kibqr/GNqDFe5QirTinD2llNDgt6//cpsnFnBGHEExLRJZtbwbG8Vd7dxDeHdXfQDLmhikS/8krDikK9JyeArQFkW0Eu0cQxHUFKlwETa4ZwU2/5L6SThG4VSq9rhYPzXOW/9NG7VR+S6nKCH+5+X3Ljzj7IzgMB1rZFa/a0+NnGhfL9XgAhNLgoGyw/97zj5SsiMBuvv6FkppTzMht1REJ/q/uM0JNb0xxk2YTQrhGHBNql5bXYEU8LdQLWRsPmbyY5a4Ft3gvYebT3DRaKMGZV0IdMRkCLwG1vqbVt4eMRenQuO2duvXCjyWe5+noU7vuo4cD9BSBKsIO+/oV00yCGEKdnpEQsYnoIZZxjflbWm1XjsVUDeDdlkVfg1bsvLWXu4E0UTjECS2aPDQZMVZQFDPrhMmrizth4tPYyQ0YVHtkALc59Lkepdl90UIuRarWHXd7hw56Tktx/p5H9Of1NMwTnp6M2dl6aOiSz6FWWzvR6Ca8rLbtXSqhJB5wDR+BK79Povki2ZzCaJuM29gGnVsqLkdryqcP0Na8XTqTOGQpZB1W9J+rIiNQ69CNqRXtYoWeJtyNcTOgVgm54xGwnPH6+X5XlVDU2fAd5DbFqqAjG9sdYkpkFadEzjkHAvfqz5JFTpFWiBEI1zhozBmpz22NHG9 kC/yh5/2 ptIeXRQSwK9j4LFa1WQVkaq93RTEVt3Bk8JrzP6ob7JVenrk0r5y17DZkmkEB0tCy7Juz6N4tM/PqaGLo5JkrV+9GcVqWx0mgwd9tZw2EDd8CAKn3gVdzjd4t8TRCbEZsktbxCHXAEiuCNFMX6ibPG1zJUwLL50DP6q82dYzyXVO4qYiBH0FyMjkZ5akKEzYTXKRtVv55180FL5QrqVhrrCqVoyQBo03NXhCNvRheOVeB87SGsjahV+isXJHQ0DsXpTOkWhs8DsmyphfbQZb6h3eGTrHtOFBfehbTu5Z4YBFo9EmdKDL6OE7zKsleogfbManjk2FOWLcNx3oUtFfEferpX6e1QkkEvr7gVPU2XRbDWWFW4Q7ZXSZfUw9h5DEi1g70dUfsCl9HdaagLV1vXTo5e3ZsCf3yyM5S6jyFBCayMwN63hMyepOM00wcSQeKdL3y4bI2r8aqIpffBmV1JUsUZhLsfzJQypOZaWHV6QEoQYyzZkxxhtuzwcpReG5u1xS5 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: Updating __show_regs to print captured shadow stack pointer as well. On tasks where shadow stack is disabled, it'll simply print 0. Signed-off-by: Deepak Gupta Reviewed-by: Alexandre Ghiti --- arch/riscv/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c index 013bc3805afd..6eb4b8e0f07e 100644 --- a/arch/riscv/kernel/process.c +++ b/arch/riscv/kernel/process.c @@ -89,8 +89,8 @@ void __show_regs(struct pt_regs *regs) regs->s8, regs->s9, regs->s10); pr_cont(" s11: " REG_FMT " t3 : " REG_FMT " t4 : " REG_FMT "\n", regs->s11, regs->t3, regs->t4); - pr_cont(" t5 : " REG_FMT " t6 : " REG_FMT "\n", - regs->t5, regs->t6); + pr_cont(" t5 : " REG_FMT " t6 : " REG_FMT " ssp : " REG_FMT "\n", + regs->t5, regs->t6, get_active_shstk(current)); pr_cont("status: " REG_FMT " badaddr: " REG_FMT " cause: " REG_FMT "\n", regs->status, regs->badaddr, regs->cause);