[lkml]   [2022]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 5.15 822/846] perf probe: Fix ppc64 perf probe add events failed case
From: Zechuan Chen <>

commit 4624f199327a704dd1069aca1c3cadb8f2a28c6f upstream.

Because of commit bf794bf52a80c627 ("powerpc/kprobes: Fix kallsyms
lookup across powerpc ABIv1 and ABIv2"), in ppc64 ABIv1, our perf
command eliminates the need to use the prefix "." at the symbol name.

But when the command "perf probe -a schedule" is executed on ppc64
ABIv1, it obtains two symbol address information through /proc/kallsyms,
for example:

cat /proc/kallsyms | grep -w schedule
c000000000657020 T .schedule
c000000000d4fdb8 D schedule

The symbol "D schedule" is not a function symbol, and perf will print:
"p:probe/schedule _text+13958584"Failed to write event: Invalid argument

Therefore, when searching symbols from map and adding probe point for
them, a symbol type check is added. If the type of symbol is not a
function, skip it.

Fixes: bf794bf52a80c627 ("powerpc/kprobes: Fix kallsyms lookup across powerpc ABIv1 and ABIv2")
Signed-off-by: Zechuan Chen <>
Acked-by: Masami Hiramatsu <>
Cc: Alexander Shishkin <>
Cc: Ingo Molnar <>
Cc: Jianlin Lv <>
Cc: Jin Yao <>
Cc: Jiri Olsa <>
Cc: Mark Rutland <>
Cc: Michael Ellerman <>
Cc: Namhyung Kim <>
Cc: Naveen N. Rao <>
Cc: Peter Zijlstra <>
Cc: Ravi Bangoria <>
Cc: Yang Jihong <>
Signed-off-by: Arnaldo Carvalho de Melo <>
Signed-off-by: Greg Kroah-Hartman <>
tools/perf/util/probe-event.c | 3 +++
1 file changed, 3 insertions(+)

--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -3083,6 +3083,9 @@ static int find_probe_trace_events_from_
for (j = 0; j < num_matched_functions; j++) {
sym = syms[j];

+ if (sym->type != STT_FUNC)
+ continue;
/* There can be duplicated symbols in the map */
for (i = 0; i < j; i++)
if (sym->start == syms[i]->start) {

 \ /
  Last update: 2022-01-24 23:09    [W:1.945 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site