projects/linux·commit 5a36c24b

openrisc: use get_kernel_nofault() in show_registers()

5a36c24b · Linus Torvalds <[email protected]> · 2026-10-20 09:29:11 -10:00

show_registers() dumps the stack and the code around the PC, but only
for a kernel-mode fault, and only after checking that each address is
at or above PAGE_OFFSET.  Both are kernel addresses that may not be
mapped.

It reads them with __get_user(), which predates get_kernel_nofault(),
the interface for exactly this: a kernel address that may not be mapped,
read with page faults disabled.

This is part of getting rid of __get_user() and __put_user() entirely.

Signed-off-by: Linus Torvalds <[email protected]>
Commit
5a36c24b0ec8fe15ddffa3148ae93a4691ea7c8f
Parents
8eb93b8a

Changes

1 files changed · +2 −2

FileStatusAddDelContent
arch/openrisc/kernel/traps.cmodified+2−2View file

arch/openrisc/kernel/traps.c

View file
diff --git a/arch/openrisc/kernel/traps.c b/arch/openrisc/kernel/traps.c
index c195be9..2ad5e14 100644
--- a/arch/openrisc/kernel/traps.c
+++ b/arch/openrisc/kernel/traps.c
@@ -124,7 +124,7 @@ void show_registers(struct pt_regs *regs)
for (i = -8; i < 24; i += 1) {
unsigned long word;
- if (__get_user(word, &((unsigned long *)esp)[i])) {
+ if (get_kernel_nofault(word, &((unsigned long *)esp)[i])) {
bad_stack:
pr_info(" Bad Stack value.");
break;
@@ -140,7 +140,7 @@ bad_stack:
for (i = -6; i < 6; i += 1) {
unsigned long word;
- if (__get_user(word, &((unsigned long *)regs->pc)[i])) {
+ if (get_kernel_nofault(word, &((unsigned long *)regs->pc)[i])) {
bad:
pr_info(" Bad PC value.");
break;