Re: [PATCH v3 4/7] kprobes: Replace %p with other pointer types

From: Masami Hiramatsu
Date: Sat Apr 28 2018 - 00:43:47 EST


On Sat, 28 Apr 2018 00:42:02 +0900
Masami Hiramatsu <mhiramat@xxxxxxxxxx> wrote:

> > > +/* Caller must NOT call this in usual path. This is only for critical case */
> > > void dump_kprobe(struct kprobe *kp)
> > > {
> > > - printk(KERN_WARNING "Dumping kprobe:\n");
> > > - printk(KERN_WARNING "Name: %s\nAddress: %p\nOffset: %x\n",
> > > - kp->symbol_name, kp->addr, kp->offset);
> > > + pr_err("Dumping kprobe:\n");
> > > + pr_err("Name: %s\nOffset: %x\nAddress: %pS\n",
> > > + kp->symbol_name, kp->offset, kp->addr);
> >
> > No, this function should just go away and be replaced by a WARN() in
> > reenter_kprobe().
>
> Would you consider to use pr_err() here? If so, I'll move this
> dump as you suggested.

So, this is actually called right before BUG(), which means we found
a non-recoverable error while recovering from reentrant kprobes.
Since the BUG() dumps all registers and stack as same as WARN(),
I think we should keep it.
(I would like to dump all kprobes fields like flags, etc. so that
we can find it is broken or not.)

Thank you,

--
Masami Hiramatsu <mhiramat@xxxxxxxxxx>