Show probed address in debugfs kprobe list file as same
as kallsyms does. This information is used for checking
kprobes are placed in the expected address. So it should
be able to compared with address in kallsyms.

Signed-off-by: Masami Hiramatsu <mhira...@kernel.org>
---
 kernel/kprobes.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index cb15991ba676..a5f13e379ae1 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -2281,6 +2281,7 @@ static void report_probe(struct seq_file *pi, struct 
kprobe *p,
                const char *sym, int offset, char *modname, struct kprobe *pp)
 {
        char *kprobe_type;
+       void *addr = p->addr;
 
        if (p->pre_handler == pre_handler_kretprobe)
                kprobe_type = "r";
@@ -2289,13 +2290,16 @@ static void report_probe(struct seq_file *pi, struct 
kprobe *p,
        else
                kprobe_type = "k";
 
+       if (!kallsyms_show_value())
+               addr = NULL;
+
        if (sym)
-               seq_printf(pi, "%p  %s  %s+0x%x  %s ",
-                       p->addr, kprobe_type, sym, offset,
+               seq_printf(pi, "%px  %s  %s+0x%x  %s ",
+                       addr, kprobe_type, sym, offset,
                        (modname ? modname : " "));
-       else
-               seq_printf(pi, "%p  %s  %p ",
-                       p->addr, kprobe_type, p->addr);
+       else    /* try to use %pS */
+               seq_printf(pi, "%px  %s  %pS ",
+                       addr, kprobe_type, p->addr);
 
        if (!pp)
                pp = p;

Reply via email to