lkml.org 
[lkml]   [2018]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v3 4/7] kprobes: Replace %p with other pointer types

    * Masami Hiramatsu <mhiramat@kernel.org> wrote:

    > @@ -712,7 +712,7 @@ static void reuse_unused_kprobe(struct kprobe *ap)
    > op = container_of(ap, struct optimized_kprobe, kp);
    > if (unlikely(list_empty(&op->list)))
    > printk(KERN_WARNING "Warning: found a stray unused "
    > - "aggrprobe@%p\n", ap->addr);
    > + "aggrprobe@%pS\n", ap->addr);

    Is this a kernel bug? If yes then please convert this to a WARN_ON_ONCE() that
    doesn't print any kernel addresses.

    > /* Enable the probe again */
    > ap->flags &= ~KPROBE_FLAG_DISABLED;
    > /* Optimize it again (remove from op->list) */
    > @@ -985,7 +985,8 @@ static int arm_kprobe_ftrace(struct kprobe *p)
    > ret = ftrace_set_filter_ip(&kprobe_ftrace_ops,
    > (unsigned long)p->addr, 0, 0);
    > if (ret) {
    > - pr_debug("Failed to arm kprobe-ftrace at %p (%d)\n", p->addr, ret);
    > + pr_debug("Failed to arm kprobe-ftrace at %pS (%d)\n",
    > + p->addr, ret);
    > return ret;

    Can this happen during normal use? If yes then just remove the warning message.

    > }
    >
    > @@ -1025,7 +1026,8 @@ static int disarm_kprobe_ftrace(struct kprobe *p)
    >
    > ret = ftrace_set_filter_ip(&kprobe_ftrace_ops,
    > (unsigned long)p->addr, 1, 0);
    > - WARN(ret < 0, "Failed to disarm kprobe-ftrace at %p (%d)\n", p->addr, ret);
    > + WARN(ret < 0, "Failed to disarm kprobe-ftrace at %pS (%d)\n",
    > + p->addr, ret);

    As this is a signal of a kernel bug, just convert this to a regular WARN_ONCE()
    that doesn't print any kernel addresses.

    > +/* 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().

    Thanks,

    Ingo

    \
     
     \ /
      Last update: 2018-04-27 08:56    [W:2.188 / U:0.044 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site