ARM: 9221/1: traps: print un-hashed user pc on undefined instruction
authorBaruch Siach <baruch@tkos.co.il>
Fri, 29 Jul 2022 03:40:16 +0000 (04:40 +0100)
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 30 Aug 2022 10:02:43 +0000 (11:02 +0100)
When user undefined instruction debug is enabled pc value is hashed like
kernel pointers for security reason. But the security benefit of this
hash is very limited because the code goes on to call __show_regs() that
prints the plain pointer value. pc is a user pointer anyway, so the
kernel does not leak anything. The only result is confusion about the
difference between the pc value on the first printed line, and the value
that __show_regs() prints.

Always print the plain value of pc.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
arch/arm/kernel/traps.c

index 9283dc65be31b7d3e7ef0a3c54f8a25938fb15c3..82fde11d6b8dfe72bad3862ded18018671f12920 100644 (file)
@@ -487,7 +487,7 @@ asmlinkage void do_undefinstr(struct pt_regs *regs)
 die_sig:
 #ifdef CONFIG_DEBUG_USER
        if (user_debug & UDBG_UNDEFINED) {
-               pr_info("%s (%d): undefined instruction: pc=%p\n",
+               pr_info("%s (%d): undefined instruction: pc=%px\n",
                        current->comm, task_pid_nr(current), pc);
                __show_regs(regs);
                dump_instr(KERN_INFO, regs);