From patchwork Thu Sep 12 23:16:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Gupta X-Patchwork-Id: 13802847 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 5FDFBEEE270 for ; Thu, 12 Sep 2024 23:18:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE0D26B00BA; Thu, 12 Sep 2024 19:18:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D90A06B00BC; Thu, 12 Sep 2024 19:18:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B94736B00BD; Thu, 12 Sep 2024 19:18:54 -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 9A5286B00BA for ; Thu, 12 Sep 2024 19:18:54 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 5AC8EA0E2A for ; Thu, 12 Sep 2024 23:18:54 +0000 (UTC) X-FDA: 82557653388.13.F10FC87 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by imf06.hostedemail.com (Postfix) with ESMTP id 7AB31180014 for ; Thu, 12 Sep 2024 23:18:52 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=Gg9tqVvP; spf=pass (imf06.hostedemail.com: domain of debug@rivosinc.com designates 209.85.216.54 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=1726183103; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=vRpTmBOo4f9wGNdjTiRRTPN5pl3eVu/w/Wzy47xL6pg=; b=PP2nEON3lwai6Z0oYAVeoUNSWOf61fwx/NETalBj8ErdOGS6K8Fezmu4t+OolUl7v0oNZ1 xEa1MQcpk6oFGcDgMv1myiKg6tuj4x7A7RmufNcSwNMV0Rk9ZhihY6fDnfh+Yzf06M3kvV LzjBeuGHXOrPa0gGu0tktogmUeG+pnI= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=Gg9tqVvP; spf=pass (imf06.hostedemail.com: domain of debug@rivosinc.com designates 209.85.216.54 as permitted sender) smtp.mailfrom=debug@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726183103; a=rsa-sha256; cv=none; b=AqOmWZYfWeKKLc8On0oJlkvR9t5rfsVWO7et0dIomM2UmTZKrY1qSHuV/xnwcAWDXyh51M 3YFO1fMsiCEYqVWx3nEgtkWbALzZQb1xwaemSb3RBBo+ZVWshSZOwj9USa51I56XUFwWVb 1SsZCd8URrbmZpTYjMBvAjWTI9l02Ck= Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-2d873dc644dso1259975a91.3 for ; Thu, 12 Sep 2024 16:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1726183131; x=1726787931; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vRpTmBOo4f9wGNdjTiRRTPN5pl3eVu/w/Wzy47xL6pg=; b=Gg9tqVvPsHnJDtR8mmJBTDuMYB207SlK9UaptVAWsxHXc0mh90BYccVpFfhagRdaN+ V8zzD17V2wDuEAzP7jFdCIpG7L5O7Y8vZPxgUU8ZYuD1LvJHPvOqDNNiBIn/bg/hiqCa IJTQGjYRW42+8TEN/Kxut9iXX0IFTsvHOM8a9t2nyQlW/Qe2SVYv4orVi9u+hkz1NwBn CXZU9qBr2XXR5R09YqOcfL3oJSi/C1mOTyD5NENAsNk5qtzsBE2Uqfs+Fcr6yeMF5s65 E0H7OhY9X1CfAfHvAZEuSmnBz9siQQIsRmGQsTVVwRT0aU1IpxmNvHBEVGgQfqQtg7cP eWBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726183131; x=1726787931; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vRpTmBOo4f9wGNdjTiRRTPN5pl3eVu/w/Wzy47xL6pg=; b=Me3P5ReaCx9iowAJYfOLMPoNlvuzBuuBp1an1I1fnqQJo6Q18X3FjN6pnKmEEOdvZY Yah/7w9saM6/9O8sJCHdzQmNzTc28MMVPabO5AEprVo9vdytuFYwl69jLf4RVg2iUg5c aYUHwcK+J9SBnZwcxTUgvUM8RT2iB1wNOidESuRYGRIJXEhRJCmF3zmENPsBcYLmGPk7 S4gKjP2WeeizbiMCTyucjY2C8K6EINS8WzEyxqU1zz76X3Vvrj+OdeLBD/VvCG8tLlZG S8Gwl+jd12eVBK3Go3KRFjMppgwSOW00NVvzs6afxCv1/sSQ7vhQkh42+mxGFqjcDc+i uIxw== X-Forwarded-Encrypted: i=1; AJvYcCUtTzFVVkOskgJsObKvRKtD9MnddoCkctrxvyq9UhB75RmNFKJnxJ4arvmlW0dkH3+E8Ch5AwCcSA==@kvack.org X-Gm-Message-State: AOJu0YziFm03Wa4qU+iyEQybm/Q2broKzO2/wXsQr1+k47TtB5MDADqp CoPR9FVUDXIa2qRe/4UapGMDd4B66mU5G/pwq/q0XH88sohBfz7QQzih0NhlX/w= X-Google-Smtp-Source: AGHT+IGSBIHvNtnBIsR7GeLeQfebNSrrsHlC0GHK9qkrAjtXKK+cIqA47d5wbXfoZYS+dksrkXz4mA== X-Received: by 2002:a17:90a:1641:b0:2d3:bc5e:8452 with SMTP id 98e67ed59e1d1-2dba00681b2mr5466829a91.32.1726183131166; Thu, 12 Sep 2024 16:18:51 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2db6c1ac69asm3157591a91.0.2024.09.12.16.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Sep 2024 16:18:50 -0700 (PDT) From: Deepak Gupta To: paul.walmsley@sifive.com, palmer@sifive.com, conor@kernel.org, linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: corbet@lwn.net, palmer@dabbelt.com, aou@eecs.berkeley.edu, robh@kernel.org, krzk+dt@kernel.org, oleg@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, peterz@infradead.org, akpm@linux-foundation.org, arnd@arndb.de, ebiederm@xmission.com, kees@kernel.org, Liam.Howlett@oracle.com, vbabka@suse.cz, lorenzo.stoakes@oracle.com, shuah@kernel.org, brauner@kernel.org, samuel.holland@sifive.com, debug@rivosinc.com, andy.chiu@sifive.com, jerry.shih@sifive.com, greentime.hu@sifive.com, charlie@rivosinc.com, evan@rivosinc.com, cleger@rivosinc.com, xiao.w.wang@intel.com, ajones@ventanamicro.com, anup@brainfault.org, mchitale@ventanamicro.com, atishp@rivosinc.com, sameo@rivosinc.com, bjorn@rivosinc.com, alexghiti@rivosinc.com, david@redhat.com, libang.li@antgroup.com, jszhang@kernel.org, leobras@redhat.com, guoren@kernel.org, samitolvanen@google.com, songshuaishuai@tinylab.org, costa.shul@redhat.com, bhe@redhat.com, zong.li@sifive.com, puranjay@kernel.org, namcaov@gmail.com, antonb@tenstorrent.com, sorear@fastmail.com, quic_bjorande@quicinc.com, ancientmodern4@gmail.com, ben.dooks@codethink.co.uk, quic_zhonhan@quicinc.com, cuiyunhui@bytedance.com, yang.lee@linux.alibaba.com, ke.zhao@shingroup.cn, sunilvl@ventanamicro.com, tanzhasanwork@gmail.com, schwab@suse.de, dawei.li@shingroup.cn, rppt@kernel.org, willy@infradead.org, usama.anjum@collabora.com, osalvador@suse.de, ryan.roberts@arm.com, andrii@kernel.org, alx@kernel.org, catalin.marinas@arm.com, broonie@kernel.org, revest@chromium.org, bgray@linux.ibm.com, deller@gmx.de, zev@bewilderbeest.net Subject: [PATCH v4 24/30] riscv/kernel: update __show_regs to print shadow stack register Date: Thu, 12 Sep 2024 16:16:43 -0700 Message-ID: <20240912231650.3740732-25-debug@rivosinc.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240912231650.3740732-1-debug@rivosinc.com> References: <20240912231650.3740732-1-debug@rivosinc.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: crfzuk175adhs3pbj51sgbrx4wdutoim X-Rspamd-Queue-Id: 7AB31180014 X-Rspamd-Server: rspam11 X-HE-Tag: 1726183132-846391 X-HE-Meta: U2FsdGVkX1+qllGt9iOHJQXf3QEszrKbFXqU7ToFMtNJMGsfgMOcq1Aha8MSZueAvvH5GwVa3b3B/Zx9FGD63ohHJDaXpXr3awXLaLth0fzipLx7DOZyw5BzqdigZNJw+f0b7aBtJZewBBlX9WXfK8do6dDxwYIgx7W3pjNWQikqfGvrZoAJVv07Yy4nl+SwQ4BkIJAhG1RetPY3Q5lsuAouHPNL5hqqkGbK6LiJ+sVfZU+l8MFtRPs9UTnUZwzxg8id+26qyCrhpmWkyl/oRiQ1b13WpuccVdA2to1hnXy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mJOBdQp30EUGQyd+KljQ8zIyQAoHHvcusF2J9ulIxnFX2fgtiuoFTRCxUTX0Ce78nX4NNHyJZv8zw4hgxm0uqMEjEbZa0FJ2QHG2XHxMMwRfHUVbqfA== 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 f3c5b8f2c869..1a5d70977e5a 100644 --- a/arch/riscv/kernel/process.c +++ b/arch/riscv/kernel/process.c @@ -87,8 +87,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);