Re: [PATCH 3/6] x86/dumpstack: make printk_stack_address() more generally useful

From: Josh Poimboeuf
Date: Wed Aug 24 2016 - 15:39:52 EST


On Wed, Aug 24, 2016 at 02:37:21PM -0400, Linus Torvalds wrote:
> On Wed, Aug 24, 2016 at 2:22 PM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > I actively disable KASLR on my dev box and feed these hex numbers into
> > addr2line -ie vmlinux to find where in the function we are.
> >
> > Having the option to make %pB generate them works for me.
>
> Yeah, considering that this is the only place this is used, changing
> %pB sounds quite reasonable.

There's now another use of '%pB' in proc_pid_stack() in the tip tree: I
changed it to '%pB' from '%pS'. But I think the modified '%pB' would
work there as well.

> We could perhaps make %pB show the hex numbers and address (so pB
> would expand to "[<hex>] symbolname".if
>
> (a) not randomizing (so the hex numbers _may_ be useful)
>
> (b) kptr_restrict is 0 (so the hex numbers are "safe" in the dmesg)
>
> and fall back to just the symbolic name if either of those aren't true?

Do we really need to check for both? '%pK' only checks kptr_restrict.
I'd think we should be consistent with that. And maybe there are some
scenarios where the actual text addresses provide useful debug
information if KASLR is enabled and kptr_restrict is zero.

> And obviously, if KALLSYMS isn't enabled, you always show hex
> numbers.. That's already the case (but we might want to add the "[<>}'
> markers around the hex numbers just to make the user space automation
> we do have work).

Even if kptr_restrict is set?

--
Josh