alpha: use get_kernel_nofault() in dik_show_code()

dik_show_code() dumps the instructions around the PC when the kernel
dies.  Both callers, die_if_kernel() and the kernel unaligned-access
handler, only get there for a kernel-mode PC: die_if_kernel() returns
early for user mode, and user-mode unaligned traps go to
do_entUnaUser() instead.

It reads that kernel text with __get_user() through a cast to a user
pointer.  That works only because alpha's __get_user() does no address
check, and it predates get_kernel_nofault(), which is 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 <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2026-10-20 09:26:44 -10:00
parent 939e5a481a
commit 8eb93b8a67

View File

@ -87,7 +87,7 @@ dik_show_code(unsigned int *pc)
printk("Code:");
for (i = -6; i < 2; i++) {
unsigned int insn;
if (__get_user(insn, (unsigned int __user *)pc + i))
if (get_kernel_nofault(insn, pc + i))
break;
printk("%c%08x%c", i ? ' ' : '<', insn, i ? ' ' : '>');
}