RE: [PATCH 0/5] add printk specifier %px, unique identifier

From: David Laight
Date: Tue Nov 28 2017 - 12:44:50 EST


From: Linus Torvalds
> Sent: 28 November 2017 17:33
>
> On Mon, Nov 27, 2017 at 10:26 PM, Eric W. Biederman
> <ebiederm@xxxxxxxxxxxx> wrote:
> >>
> >> Oh well, I just did /proc/<pid>/stack by making it just print 0
> >> unconditionally rather than the hex number.
> >
> > Patch?
>
> Oh, apparently I never pushed out yesterday.
>
> The patch literally just affects the (useless) hex number. So:
>
> cat /proc/self/stack
>
> now prints out
>
> [<0>] proc_pid_stack+0xaa/0x100
> [<0>] proc_single_show+0x48/0x80
> [<0>] seq_read+0xd2/0x410
> ...
>
> instead of putting some randomized kernel address there.

Not sure I've done it on Linux - getting a hexdump of the stack is hard.
But I know I've used the absolute return addresses to help hand-decode
the stack.
Usually needed to work out which stack frame is which - especially when the
stack decode doesn't actually (obviously) contain the addresses of each frame.

I don't know how these new stack traceback methods work, but the best one
I've seen in the past disassembled forwards remembering the stack offset
and unprocessed branch targets until it found a return address.
It only had to track %sp and %bp.

David