Skip to content

Commit 23a4b10

Browse files
rostedtshuahkh
authored andcommitted
tracing/selftests: Fix kprobe event name test for .isra. functions
The kprobe_eventname.tc test checks if a function with .isra. can have a kprobe attached to it. It loops through the kallsyms file for all the functions that have the .isra. name, and checks if it exists in the available_filter_functions file, and if it does, it uses it to attach a kprobe to it. The issue is that kprobes can not attach to functions that are listed more than once in available_filter_functions. With the latest kernel, the function that is found is: rapl_event_update.isra.0 # grep rapl_event_update.isra.0 /sys/kernel/tracing/available_filter_functions rapl_event_update.isra.0 rapl_event_update.isra.0 It is listed twice. This causes the attached kprobe to it to fail which in turn fails the test. Instead of just picking the function function that is found in available_filter_functions, pick the first one that is listed only once in available_filter_functions. Cc: [email protected] Fixes: 604e354 ("selftests/ftrace: Select an existing function in kprobe_eventname test") Signed-off-by: Steven Rostedt (Google) <[email protected]> Acked-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 7ea7946 commit 23a4b10

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ find_dot_func() {
3030
fi
3131

3232
grep " [tT] .*\.isra\..*" /proc/kallsyms | cut -f 3 -d " " | while read f; do
33-
if grep -s $f available_filter_functions; then
33+
cnt=`grep -s $f available_filter_functions | wc -l`;
34+
if [ $cnt -eq 1 ]; then
3435
echo $f
3536
break
3637
fi

0 commit comments

Comments
 (0)