From nobody Fri Dec 19 19:04:27 2025 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 1403D34EF0C for ; Thu, 4 Dec 2025 20:04:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764878680; cv=none; b=EX1JtLdxYyqFXKDMAAyE5igLa3zZ/reNcUCHjaqbRgfGVuG5I5YTLIHqdpvWfqwOPofqEusJgXpD5SQOXg5yGH870ZhCALsA9RjtFd4ROYTR879A8o+7g+edeH971WIjWBoJUPsEcV3cL+Mo+1T0tr89Mm8vZMGc4Tnx3DgPcy0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764878680; c=relaxed/simple; bh=5pCsCIMJf4iBOvf300q6+KPihTaIQ8ZBfY4WmoGUnLE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y9vwV7Vt5j3lXrBzTzD1Ua7TyUPIDCuee8ZUYd/cdMRiYMwr3Bj3MIkD/OGFxv6Di/cRwSA7nr837AdIcZoYgQJhsifR50MdJ76NjhxkTYEXYtr56tNcaS9Ddw/D3H6izArREyyRxeO86bI+7vBM/E/zuk/N/H4juiwmagJ3dRc= 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=LL9lhDPE; arc=none smtp.client-ip=209.85.214.176 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="LL9lhDPE" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-29568d93e87so14088185ad.2 for ; Thu, 04 Dec 2025 12:04:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc.com; s=google; t=1764878675; x=1765483475; 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=LL9lhDPE7KKQfMlEY58K7DFk2zBKGmI4yZ3vx/tQDy0Ccf/7WRooebvulhaOejlTII A/+UJKzebAuGn7yUGaOtQ8h0s0WaW7SutSopAqOlr7KDOs3J1iLtxoCfjyIjndjGurag DAtH967EWHHWcdewaZuUB/VWYBlU6Aerf2UbYIcgXS9EYNR7ckCTZnQTJGKOVRbEn+AT mfuL7pweJHQK1xvS0e76PDb6IJvr1fanzYgY1nZo4GnLrGvTsdzM/jN3gW+KWY7CbcBH PcrC25B+ygg+hWvmAK/Pos9bDGd6HTt6QasEuhzeUKmHn6s6qI72tzI7IIayk+V2PGmy JJLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764878675; x=1765483475; 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=K5QUVCKPTwnUxfUDcDUCRBG5fGcKFuFymKgO3vk6+22oH4tkQLyFeTQ/+yw3r/UqUp K91m4hyy/6ezy3sjOzqmWJXuLUkUZfEXjR+wl5YjpgA/LZ/8+4fzyN4zA2gaG5FmC+8q DTzb6xmqDt1jbyZYWU0JpRf4PhwNUMSMePhJiplQndnYvp+gDpYhRxYZowchYe2sprq4 jIJcbY0xwWzWVoQQmup11FcuJuzeXtMwGmjVAQ64onLEw8IohOYOoZyspCeZvw5VUe9t j9z1gTDfIf3B+sarwb0JasufTSHBxQTF4z+86yAJ96S8k3cSF+63Z58+LaS7iiY6XXE1 iUEw== X-Gm-Message-State: AOJu0Yx71490u7RFGut3NaBdQgqCYX2+HGAOupJqM4s0pqfHRG74j7JV rm575wIL69gxib8NT2qRCjs4ZkTCokgHTAniLaYDXTUSoSEslGt58hEVUDr+rdwjeJw= X-Gm-Gg: ASbGncuQCO0alNQuPyPWPamnk7+VTncdb0j0zZ5AUQ3viAB6dZtWIZrMWsXUSjpVtU+ VnGbtrWabUtjSBN+hFRo8GT8SEOwBmlE7jdTLmxAQLX6XI85fL5Dwy65ZpiUwKW54F6OFBum+kc D/Sw6SYSBRJ3oYrBx/+8Jzgil6LcbwihSZxXMymrENiHNb41obdqx19Q7Q7XrJn9c0s52cOwO2l LgpR9aqRkwphGRoxVwgDcsrD0Qv8U+2Igv6RPNKJxlmYIZnB0hXHoDRPIOc71GqIT5er6nsaQeD 3ubcMMuzjGN1mqD0aGuzBhgdSSewU65UUZYuXpd8yHk1Dwg6Qw1Mc2tYPEYJ9ltDkyXmC3/BGcY X8QraGOsnkg1w3wRSsfpT3Y5dhzERKvX5m9+us+YLsNvCHazg9sSrD0dCAvF+VvyMVQD7O5eR+E bAs/glkPZPX7UsmxWEOYknsnkHWNy1QWs= X-Google-Smtp-Source: AGHT+IH3DRNGCvULusk0MSN0c34XACnhHDWSefcdBCkji/UkCW9Cgr1V8Io5HqSxhaCaIYKCC+gGlw== X-Received: by 2002:a05:7022:5e0e:b0:11b:9386:a38d with SMTP id a92af1059eb24-11df64a5fe7mr2337882c88.48.1764878674645; Thu, 04 Dec 2025 12:04:34 -0800 (PST) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11df76e2eefsm10417454c88.6.2025.12.04.12.04.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Dec 2025 12:04:34 -0800 (PST) From: Deepak Gupta Date: Thu, 04 Dec 2025 12:04:07 -0800 Subject: [PATCH v24 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: <20251204-v5_user_cfi_series-v24-18-ada7a3ba14dc@rivosinc.com> References: <20251204-v5_user_cfi_series-v24-0-ada7a3ba14dc@rivosinc.com> In-Reply-To: <20251204-v5_user_cfi_series-v24-0-ada7a3ba14dc@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=1764878636; l=1182; i=debug@rivosinc.com; s=20251023; h=from:subject:message-id; bh=5pCsCIMJf4iBOvf300q6+KPihTaIQ8ZBfY4WmoGUnLE=; b=gAgt0qiA01P7drDBMqFQXuoLVXR1r0qiMVxyXn0hwdIA1M7y9CqEeq19oXDcQmb0Z/54Aoug8 68he+4K0zLTDttF3EANbQpNqxF1OUC/aAhnwKbqrODAAIjZ7IEJnRR9 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