* [PATCH] selftests/ftrace: skip gcov symbols when picking a function to probe
@ 2026-09-25 13:35 Eva Kurchatova
2026-09-26 12:31 ` Masami Hiramatsu
0 siblings, 1 reply; 2+ messages in thread
From: Eva Kurchatova @ 2026-09-25 13:35 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers, Shuah Khan
Cc: linux-kernel, Eva Kurchatova, linux-trace-kernel, linux-kselftest
kprobe_eventname.tc takes the last kallsyms entry whose name ends in
vfs_read and puts a probe on it. On a kernel built with
CONFIG_GCOV_PROFILE_ALL=y the counter symbol gcc emits for the function
sorts after it:
ffffffff819bd1e0 T vfs_read
ffffffff845013e0 t __gcov_.vfs_read
so the test picks __gcov_.vfs_read, which is not a function entry, and
the write fails:
kprobe_eventname.tc: line 10: echo: write error: Invalid argument
Leave those symbols out of the choice. The test then picks vfs_read and
passes; without a coverage build nothing changes, as no such symbol
exists there.
This is the same class of problem as commit 23a4b108accc
("tracing/selftests: Fix kprobe event name test for .isra. functions"),
where a compiler-generated symbol was picked instead of a real function.
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
.../testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc
index ba19b81cef39..0688a5c47d1e 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc
@@ -5,7 +5,7 @@
:;: "Add an event on function without name" ;:
-FUNC=`grep " [tT] .*vfs_read$" /proc/kallsyms | tail -n 1 | cut -f 3 -d " "`
+FUNC=`grep " [tT] .*vfs_read$" /proc/kallsyms | grep -v __gcov | tail -n 1 | cut -f 3 -d " "`
[ "x" != "x$FUNC" ] || exit_unresolved
echo "p $FUNC" > kprobe_events
PROBE_NAME=`echo $FUNC | tr ".:" "_"`
--
2.55.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests/ftrace: skip gcov symbols when picking a function to probe
2026-09-25 13:35 [PATCH] selftests/ftrace: skip gcov symbols when picking a function to probe Eva Kurchatova
@ 2026-09-26 12:31 ` Masami Hiramatsu
0 siblings, 0 replies; 2+ messages in thread
From: Masami Hiramatsu @ 2026-09-26 12:31 UTC (permalink / raw)
To: Eva Kurchatova
Cc: Steven Rostedt, Mathieu Desnoyers, Shuah Khan, linux-kernel,
linux-trace-kernel, linux-kselftest
On Fri, 25 Sep 2026 16:35:41 +0300
Eva Kurchatova <eva.kurchatova@virtuozzo.com> wrote:
> kprobe_eventname.tc takes the last kallsyms entry whose name ends in
> vfs_read and puts a probe on it. On a kernel built with
> CONFIG_GCOV_PROFILE_ALL=y the counter symbol gcc emits for the function
> sorts after it:
>
> ffffffff819bd1e0 T vfs_read
> ffffffff845013e0 t __gcov_.vfs_read
>
> so the test picks __gcov_.vfs_read, which is not a function entry, and
> the write fails:
>
> kprobe_eventname.tc: line 10: echo: write error: Invalid argument
>
> Leave those symbols out of the choice. The test then picks vfs_read and
> passes; without a coverage build nothing changes, as no such symbol
> exists there.
>
> This is the same class of problem as commit 23a4b108accc
> ("tracing/selftests: Fix kprobe event name test for .isra. functions"),
> where a compiler-generated symbol was picked instead of a real function.
>
Oops, good catch! This looks good to me.
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Shuah, can you pick this fix via your selftest tree? I think this is a
kind of selftest fix/improvement.
Thanks,
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
> ---
> .../testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc
> index ba19b81cef39..0688a5c47d1e 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc
> @@ -5,7 +5,7 @@
>
> :;: "Add an event on function without name" ;:
>
> -FUNC=`grep " [tT] .*vfs_read$" /proc/kallsyms | tail -n 1 | cut -f 3 -d " "`
> +FUNC=`grep " [tT] .*vfs_read$" /proc/kallsyms | grep -v __gcov | tail -n 1 | cut -f 3 -d " "`
> [ "x" != "x$FUNC" ] || exit_unresolved
> echo "p $FUNC" > kprobe_events
> PROBE_NAME=`echo $FUNC | tr ".:" "_"`
> --
> 2.55.0
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-26 12:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25 13:35 [PATCH] selftests/ftrace: skip gcov symbols when picking a function to probe Eva Kurchatova
2026-09-26 12:31 ` Masami Hiramatsu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®