linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/kernel: Print actual address of regs when oopsing
@ 2018-01-11  2:21 Michael Ellerman
  2018-01-11  2:25 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Ellerman @ 2018-01-11  2:21 UTC (permalink / raw)
  To: linuxppc-dev

When we oops or otherwise call show_regs() we print the address of the
regs structure. Being able to see the address is fairly useful,
firstly to verify that the regs pointer is not completely bogus, and
secondly it allows you to dump the regs and surrounding memory with a
debugger if you have one.

In the normal case the regs will be located somewhere on the stack, so
printing their location discloses no further information than printing
the stack pointer does already.

So switch to %px and print the actual address, not the hashed value.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 5acb5a176dbe..72be0c32e902 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1403,7 +1403,7 @@ void show_regs(struct pt_regs * regs)
 
 	printk("NIP:  "REG" LR: "REG" CTR: "REG"\n",
 	       regs->nip, regs->link, regs->ctr);
-	printk("REGS: %p TRAP: %04lx   %s  (%s)\n",
+	printk("REGS: %px TRAP: %04lx   %s  (%s)\n",
 	       regs, regs->trap, print_tainted(), init_utsname()->release);
 	printk("MSR:  "REG" ", regs->msr);
 	print_msr_bits(regs->msr);
-- 
2.14.3

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

* Re: powerpc/kernel: Print actual address of regs when oopsing
  2018-01-11  2:21 [PATCH] powerpc/kernel: Print actual address of regs when oopsing Michael Ellerman
@ 2018-01-11  2:25 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2018-01-11  2:25 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev

On Thu, 2018-01-11 at 02:21:35 UTC, Michael Ellerman wrote:
> When we oops or otherwise call show_regs() we print the address of the
> regs structure. Being able to see the address is fairly useful,
> firstly to verify that the regs pointer is not completely bogus, and
> secondly it allows you to dump the regs and surrounding memory with a
> debugger if you have one.
> 
> In the normal case the regs will be located somewhere on the stack, so
> printing their location discloses no further information than printing
> the stack pointer does already.
> 
> So switch to %px and print the actual address, not the hashed value.
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Applied to powerpc fixes.

https://git.kernel.org/powerpc/c/182dc9c7f217146d69d9c0b75c150c

cheers

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

end of thread, other threads:[~2018-01-11  2:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-11  2:21 [PATCH] powerpc/kernel: Print actual address of regs when oopsing Michael Ellerman
2018-01-11  2:25 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).