From: Stefan Wiehler <stefan.wiehler@nokia.com>
To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Stefan Wiehler <stefan.wiehler@nokia.com>
Subject: [PATCH] arm64: Print provenance information for addresses in registers
Date: Thu, 1 Feb 2024 16:38:11 +0100 [thread overview]
Message-ID: <20240201153811.1793120-1-stefan.wiehler@nokia.com> (raw)
Like commit 5aa6b70ed182 ("arm: print alloc free paths for address in
registers") already does for 32-bit ARM, print available provenance information
for addresses in registers in case of internal error as a debugging aid:
Unable to handle kernel write to read-only memory at virtual address ffffffc00117cd5c
...
x2 : 0000000000001b98 x1 : 0000000000000000 x0 : ffffffc00117cd5c
...
Register x0 information: 14-page vmalloc region starting at 0xffffffc00117a000 allocated at load_module+0x15c4/0x2bc0
Register x1 information: NULL pointer
Register x2 information: non-paged memory
...
Signed-off-by: Stefan Wiehler <stefan.wiehler@nokia.com>
---
arch/arm64/include/asm/system_misc.h | 1 +
arch/arm64/kernel/process.c | 11 +++++++++++
arch/arm64/kernel/traps.c | 1 +
3 files changed, 13 insertions(+)
diff --git a/arch/arm64/include/asm/system_misc.h b/arch/arm64/include/asm/system_misc.h
index c34344256762..5b9b02fee988 100644
--- a/arch/arm64/include/asm/system_misc.h
+++ b/arch/arm64/include/asm/system_misc.h
@@ -31,6 +31,7 @@ void hook_debug_fault_code(int nr, int (*fn)(unsigned long, unsigned long,
struct mm_struct;
extern void __show_regs(struct pt_regs *);
+extern void __show_regs_alloc_free(struct pt_regs *);
#endif /* __ASSEMBLY__ */
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 7387b68c745b..b6fc2ac6e007 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -197,6 +197,17 @@ static void print_pstate(struct pt_regs *regs)
}
}
+void __show_regs_alloc_free(struct pt_regs *regs)
+{
+ int i;
+
+ /* check for x0 - x29 only */
+ for (i = 0; i < 30; i++) {
+ pr_alert("Register x%d information:", i);
+ mem_dump_obj((void *)regs->regs[i]);
+ }
+}
+
void __show_regs(struct pt_regs *regs)
{
int i, top_reg;
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 215e6d7f2df8..b7bf22f1b33f 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -197,6 +197,7 @@ static int __die(const char *str, long err, struct pt_regs *regs)
print_modules();
show_regs(regs);
+ __show_regs_alloc_free(regs);
dump_kernel_instr(KERN_EMERG, regs);
--
2.42.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2024-02-01 15:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 15:38 Stefan Wiehler [this message]
2024-02-05 12:55 ` [PATCH] arm64: Print provenance information for addresses in registers Mark Rutland
2024-03-20 14:13 ` Stefan Wiehler
2024-08-09 13:43 ` Stefan Wiehler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240201153811.1793120-1-stefan.wiehler@nokia.com \
--to=stefan.wiehler@nokia.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox