From 8eb93b8a67181827611d2a242de5983a04f2bc8c Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 20 Oct 2026 09:26:44 -1000 Subject: [PATCH] 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 --- arch/alpha/kernel/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c index cfaef96c4ce8..9247aa28219a 100644 --- a/arch/alpha/kernel/traps.c +++ b/arch/alpha/kernel/traps.c @@ -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 ? ' ' : '>'); }