Skip to content

Commit

Permalink
tracing: Show kretprobe unknown indicator only for kretprobe_trampoline
Browse files Browse the repository at this point in the history
ftrace shows "[unknown/kretprobe'd]" indicator all addresses in the
kretprobe_trampoline, but the modified address by kretprobe should
be only kretprobe_trampoline+0.

Link: https://lkml.kernel.org/r/163163056044.489837.794883849706638013.stgit@devnote2

Signed-off-by: Masami Hiramatsu <[email protected]>
Acked-by: Steven Rostedt (VMware) <[email protected]>
Tested-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Steven Rostedt (VMware) <[email protected]>
  • Loading branch information
mhiramat authored and rostedt committed Oct 1, 2021
1 parent 19138af commit 7da8949
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions kernel/trace/trace_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/ftrace.h>
#include <linux/kprobes.h>
#include <linux/sched/clock.h>
#include <linux/sched/mm.h>

Expand Down Expand Up @@ -346,22 +347,12 @@ int trace_output_call(struct trace_iterator *iter, char *name, char *fmt, ...)
}
EXPORT_SYMBOL_GPL(trace_output_call);

#ifdef CONFIG_KRETPROBES
static inline const char *kretprobed(const char *name)
static inline const char *kretprobed(const char *name, unsigned long addr)
{
static const char tramp_name[] = "__kretprobe_trampoline";
int size = sizeof(tramp_name);

if (strncmp(tramp_name, name, size) == 0)
if (is_kretprobe_trampoline(addr))
return "[unknown/kretprobe'd]";
return name;
}
#else
static inline const char *kretprobed(const char *name)
{
return name;
}
#endif /* CONFIG_KRETPROBES */

void
trace_seq_print_sym(struct trace_seq *s, unsigned long address, bool offset)
Expand All @@ -374,7 +365,7 @@ trace_seq_print_sym(struct trace_seq *s, unsigned long address, bool offset)
sprint_symbol(str, address);
else
kallsyms_lookup(address, NULL, NULL, NULL, str);
name = kretprobed(str);
name = kretprobed(str, address);

if (name && strlen(name)) {
trace_seq_puts(s, name);
Expand Down

0 comments on commit 7da8949

Please sign in to comment.