Re: [PATCH 06/14] md/bcache: Use %pS printk format for direct addresses

From: Sergey Senozhatsky
Date: Thu Sep 07 2017 - 04:08:17 EST


On (09/07/17 09:42), Helge Deller wrote:
> >> - seq_printf(f, "%p: %pF -> %pf p %p r %i ",
> >> + seq_printf(f, "%p: %pS -> %pf p %p r %i ",
> >> cl, (void *) cl->ip, cl->fn, cl->parent,
> >> r & CLOSURE_REMAINING_MASK);
> >>
> >> @@ -187,7 +187,7 @@ static int debug_seq_show(struct seq_file *f, void *data)
> >> r & CLOSURE_SLEEPING ? "Sl" : "");
> >>
> >> if (r & CLOSURE_WAITING)
> >> - seq_printf(f, " W %pF\n",
> >> + seq_printf(f, " W %pS\n",
> >> (void *) cl->waiting_on);
> >>
> >> seq_printf(f, "\n");
> >>
> >
> > It is unclear to me, that if %pF is used, on ia64/ppc64/parisc64 a
> > function descriptor conversion happens, what negative effect exactly
> > takes place ?
>
> On ia64/ppc64/parisc64 the kernel will crash here in the worst case, because
> vsprintf() will try to read a pointer from that address and resolve it.

probe_kernel_address() handles the page fault and returns -EFAULT if
you give it bad pointer. module_address_lookup() and get_symbol_pos()
seems to be smart enough not to crash on bad pointer as well. what am
I missing? could you please explain where we will crash?

-ss