All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: traps: print un-hashed user pc on undefined instruction
@ 2022-07-27 16:18 Baruch Siach
  2022-07-28 15:23 ` Russell King (Oracle)
  0 siblings, 1 reply; 2+ messages in thread
From: Baruch Siach @ 2022-07-27 16:18 UTC (permalink / raw)
  To: Russell King, Ard Biesheuvel; +Cc: linux-arm-kernel, Baruch Siach

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>
---
 arch/arm/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 9283dc65be31..82fde11d6b8d 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -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);
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: traps: print un-hashed user pc on undefined instruction
  2022-07-27 16:18 [PATCH] ARM: traps: print un-hashed user pc on undefined instruction Baruch Siach
@ 2022-07-28 15:23 ` Russell King (Oracle)
  0 siblings, 0 replies; 2+ messages in thread
From: Russell King (Oracle) @ 2022-07-28 15:23 UTC (permalink / raw)
  To: Baruch Siach; +Cc: Ard Biesheuvel, linux-arm-kernel

On Wed, Jul 27, 2022 at 07:18:01PM +0300, Baruch Siach wrote:
> 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>

Looks sensible to me. Please drop it in the patch system, thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-28 15:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27 16:18 [PATCH] ARM: traps: print un-hashed user pc on undefined instruction Baruch Siach
2022-07-28 15:23 ` Russell King (Oracle)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.