[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220428203152.41693bbe@gandalf.local.home>
Date: Thu, 28 Apr 2022 20:31:52 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Jiri Olsa <jolsa@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
lkml <linux-kernel@...r.kernel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>
Subject: Re: [RFC bpf-next 4/4] selftests/bpf: Add attach bench test
On Thu, 28 Apr 2022 20:09:45 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
> OK, I think I see the issue you have. Because the functions shown in
> available_filter_functions which uses the simple "%ps" to show the function
> name:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/trace/ftrace.c#n3692
>
> And the code that does the actual matching uses kallsyms_lookup()
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/trace/ftrace.c#n4017
>
> Which appears not to match the function for the address, you can't pass in
> __bpf_tramp_exit because it wont match the symbol returned by
> kallsyms_lookup.
Never mind, in testing this I had marked the weak function as notrace,
which was the reason I couldn't add it to the set_ftrace_notrace.
After removing the notrace, kallsyms_lookup() doesn't make a difference. It
appears that kallsyms will include overridden weak functions into the size
of the function before it. I tried:
ret = kallsyms_lookup(rec->ip, &size, &offset, &modname, str);
if (!ret || offset > size) {
seq_printf(m, "no function at %lx", rec->ip);
} else {
seq_printf(m, "%s", str);
if (modname)
seq_printf(m, " [%s]", modname);
}
And it made no difference.
>
> This does indeed look like a bug in %ps.
>
Yes, this does appear to be a issue with kallsyms in general.
-- Steve
Powered by blists - more mailing lists