From nobody Tue Dec 16 13:33:38 2025 Received: from mail-dy1-f174.google.com (mail-dy1-f174.google.com [74.125.82.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91B2E34F27D for ; Fri, 5 Dec 2025 18:37:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764959851; cv=none; b=bzWmORhTmg/gQGlfDEo9vDRKwR8oBBd6QGV8UwRRrGFRWHZ9AzhZ18SO2zjlx1wuYwG73OwfvW/5B3JrvbIyiqGgI1tI2Z5BZBkycviOnJcbg1enwYJdNEcBdBnQy3tcDU64Z1WcQ7BywKyUL+QwcPpLxx/iFouY34B6uKEuQJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764959851; c=relaxed/simple; bh=5pCsCIMJf4iBOvf300q6+KPihTaIQ8ZBfY4WmoGUnLE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N2AlPRKgKyi62UrDpC1kNImGv7zGSRfSRszoqFFpK49HI0d9grWcaiBrPuwdnUdgGo1BdFS4DpvE2vlEw4LCcVIay27B5+QshEM16fOQeLPNOihJWDbYngZwIBGV14Z9iupqJpeZt39mUGyof6LLB3TT8X5qELpQ+Pazyzyx+2I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc.com header.i=@rivosinc.com header.b=Hg1w6IbF; arc=none smtp.client-ip=74.125.82.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc.com header.i=@rivosinc.com header.b="Hg1w6IbF" Received: by mail-dy1-f174.google.com with SMTP id 5a478bee46e88-2a45877bd5eso4568112eec.0 for ; Fri, 05 Dec 2025 10:37:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc.com; s=google; t=1764959845; x=1765564645; darn=vger.kernel.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=y7cVA4V+tsTGYh8faQvOG85ZxC8pPRVoW62aZwUk0L0=; b=Hg1w6IbFq7J3oJTjZQMV2a3n1TVZ5ezwfniSFN8ubnhi6A7ZVt/IB0dnZcHekEqntY CcmCDuWuAwUOM/ehPvqvfAEqGj/UXsNDLwj7evTRL/v0vVaTe4l7QbdCs7By2HIGRj/e XAd6H8dbPS89TkTUPh9QZuSf7dvtBjFvpQ5XTzCIulapezJ/aDEcbA+UAzomUslmcQbx CTNE2PYDuGBDc+AFVZUoxNvB5/5GPwhNsvrbZDRqvPG5ESUpKU2LZCAe+FnCvptMQUjx 4hNe5rhc1lK5JNyO4OcO7qEIv46GF/6UhIFSw2lj1Enhdc/WOtwJ5GVs0HtNm5EjQYmg C1Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764959845; x=1765564645; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=y7cVA4V+tsTGYh8faQvOG85ZxC8pPRVoW62aZwUk0L0=; b=pHjpJrHAAUDnYwjH8Wq4orgu0TADCi6ZHXAnQsj68PMvOG7vBykkFHXp1gS/u8icCd sfLKI9hS8dLoR2u/cFQn8AMRT/aGA/MnJjN8Pvavfo9OdiIOK7Ygbl/Aog3xHRyWYF4J GopGCOR2EqkjuypYBBkLoAPRYxzNlvQUP8D24QQZLJfof61ZKMY5sBQ8IcrjE/st/VJc Ei6yFDvYhpr447pFnA70Vavj77a7X/dBP8iuOMyoFdpE+vMg1iMPgrnD8NtVlr2QD3v5 vypAmtPseFCjmyAPns66n1p5viGrbN9+qNHFj99Z5Xm6LFr17nPYkz16HGSp/TQxYWUY Lupg== X-Gm-Message-State: AOJu0YyzhZrZcYGHvBQ2o8wvQoh2jfwRwszSyLViDxFVG6HO/ePWOLz7 /jvJhcHPlYWd1rAQmFpaQyxcVipZhOf2drlTh9OzAvmQfPVlUD1mHH8zDSQ3F89bU0Y= X-Gm-Gg: ASbGnculBgy84+TZzQTlelEjicGsSo4+1OROFtLTPfZljXgPqCFKb6K6ZWOWu1UqfLT Yf/esqJtXjFFdc/FZsmfXQMqcryMxQuqEUUOOz/DD+1IQrGiIjZ0iJ4ZVAjr8eb3Nf9yXNvPuL0 vQ6uBp6Y/yA/pEKe4vwDcwTkIz9hdPhWunM952BDEd4xxrw0i9ouzSoyYQ1mlTMf4QJn8sGTjEr ok6SqAqU6izebsN21I+Dw/293HXhBaAL5lqKYy1bSc/kMpmABnEGy2gbUobVCWMpK8gWeKMCY2k RorUNrqa+Glnb7UHJBnia2zOIilXpKRuJGJx5MgaJyeTHsLlZvXR4SZzPrD3kWRq6cAqhPBDR8p H7gIeHgOmQyYvUIMsbl2HOrUxoXAtz+/UJVu5qcrPKTUtmScaG7S0mRhSggIYG1aGRtjxLu3QK/ tkQHg4LdP/EzlO4zMjQFty X-Google-Smtp-Source: AGHT+IHpgKa7H8AahzL7MXJDXATVAt8op9HJLZz6q1O1yZv7iAcmKoVC4X9a7AcjVimql64o0x0uoQ== X-Received: by 2002:a05:7301:1e82:b0:2a4:5c33:ff7e with SMTP id 5a478bee46e88-2aba34e598cmr5659789eec.19.1764959844877; Fri, 05 Dec 2025 10:37:24 -0800 (PST) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2aba8395d99sm23933342eec.1.2025.12.05.10.37.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Dec 2025 10:37:24 -0800 (PST) From: Deepak Gupta Date: Fri, 05 Dec 2025 10:37:04 -0800 Subject: [PATCH v25 18/28] riscv/kernel: update __show_regs to print shadow stack register Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251205-v5_user_cfi_series-v25-18-8a3570c3e145@rivosinc.com> References: <20251205-v5_user_cfi_series-v25-0-8a3570c3e145@rivosinc.com> In-Reply-To: <20251205-v5_user_cfi_series-v25-0-8a3570c3e145@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 , Jann Horn , Conor Dooley , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl , Trevor Gross , Benno Lossin 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, rust-for-linux@vger.kernel.org, Andreas Korb , Valentin Haudiquet , Deepak Gupta X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1764959808; l=1182; i=debug@rivosinc.com; s=20251023; h=from:subject:message-id; bh=5pCsCIMJf4iBOvf300q6+KPihTaIQ8ZBfY4WmoGUnLE=; b=YUOAVPCuxUM5Gbaa6opv1masEPHIuQa83DUGc+CGXyeJ5A4kfQSjMwPJRS+2ZDYG/CTYlt+hh XoV55OqqjBBArKRtE/ICcgJfxzIDFQra1KnJGP2v9aOA7JvRD/LcfRN X-Developer-Key: i=debug@rivosinc.com; a=ed25519; pk=O37GQv1thBhZToXyQKdecPDhtWVbEDRQ0RIndijvpjk= Updating __show_regs to print captured shadow stack pointer as well. On tasks where shadow stack is disabled, it'll simply print 0. Reviewed-by: Alexandre Ghiti Tested-by: Andreas Korb Tested-by: Valentin Haudiquet Signed-off-by: Deepak Gupta --- 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 49f527e3acfd..aacb23978f93 100644 --- a/arch/riscv/kernel/process.c +++ b/arch/riscv/kernel/process.c @@ -93,8 +93,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)); =20 pr_cont("status: " REG_FMT " badaddr: " REG_FMT " cause: " REG_FMT "\n", regs->status, regs->badaddr, regs->cause); --=20 2.45.0