Skip to contentSkip to conversation

selftests/ftrace: Add test case for a symbol in a module without module name

PATCH In review Masami Hiramatsu (Google) 2 participants 4 messages Oct 28, 2023 – Jul 15

Subsystems (3)
lore
Share & tools
lore

Masami Hiramatsu (Google)

author maintainer
#0 lore raw

PATCH 1/1 selftests/ftrace: Add test case for a symbol in a module without module name

From: Masami Hiramatsu (Google) <[email protected]>

Add a test case for probing on a symbol in a module without module name. When probing on a symbol in a module, ftrace accepts both the syntax that <MODNAME>:<SYMBOL> and <SYMBOL>. Current test case only checks the former syntax. This adds a test for the latter one.

---
 .../ftrace/test.d/kprobe/kprobe_module.tc          |    6 ++++++
 1 file changed, 6 insertions(+)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc +6 -0
index 7e74ee11edf9..4b32e1b9a8d3 100644
@@ -13,6 +13,12 @@ fi
 MOD=trace_printk
 FUNC=trace_printk_irq_work
 
+:;: "Add an event on a module function without module name" ;:
+
+echo "p:event0 $FUNC" > kprobe_events
+test -d events/kprobes/event0 || exit_failure
+echo "-:kprobes/event0" >> kprobe_events
+
 :;: "Add an event on a module function without specifying event name" ;:
 
 echo "p $MOD:$FUNC" > kprobe_events
maintainer
#1 lore raw

Is this still a think, or can we remove it from patchwork?

https://patchwork.kernel.org/project/linux-trace-kernel/patch/169846405196.88147.17766692778800222203.stgit@devnote2/

-- Steve

Quoted 29 lines · On Sat, 28 Oct 2023 12:34:12 +0900 "Masami Hiramatsu (Google)"…

From: Masami Hiramatsu (Google) <[email protected]>

Add a test case for probing on a symbol in a module without module name. When probing on a symbol in a module, ftrace accepts both the syntax that <MODNAME>:<SYMBOL> and <SYMBOL>. Current test case only checks the former syntax. This adds a test for the latter one.

---
 .../ftrace/test.d/kprobe/kprobe_module.tc          |    6 ++++++
 1 file changed, 6 insertions(+)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc +6 -0
index 7e74ee11edf9..4b32e1b9a8d3 100644
@@ -13,6 +13,12 @@ fi
 MOD=trace_printk
 FUNC=trace_printk_irq_work
 
+:;: "Add an event on a module function without module name" ;:
+
+echo "p:event0 $FUNC" > kprobe_events
+test -d events/kprobes/event0 || exit_failure
+echo "-:kprobes/event0" >> kprobe_events
+
 :;: "Add an event on a module function without specifying event name" ;:
 
 echo "p $MOD:$FUNC" > kprobe_events
author maintainer
#2 lore raw
Quoted 4 lines · On Tue, 14 Jul 2026 10:42:10 -0400 Steven Rostedt <[email protected]> wrote:

Is this still a think, or can we remove it from patchwork?

https://patchwork.kernel.org/project/linux-trace-kernel/patch/169846405196.88147.17766692778800222203.stgit@devnote2/

Oops, thanks for reminding. Let me check.

Quoted 37 lines

-- Steve

Quoted 29 lines · On Sat, 28 Oct 2023 12:34:12 +0900 "Masami Hiramatsu (Google)"…

From: Masami Hiramatsu (Google) <[email protected]>

Add a test case for probing on a symbol in a module without module name. When probing on a symbol in a module, ftrace accepts both the syntax that <MODNAME>:<SYMBOL> and <SYMBOL>. Current test case only checks the former syntax. This adds a test for the latter one.

---
 .../ftrace/test.d/kprobe/kprobe_module.tc          |    6 ++++++
 1 file changed, 6 insertions(+)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc +6 -0
index 7e74ee11edf9..4b32e1b9a8d3 100644
@@ -13,6 +13,12 @@ fi
 MOD=trace_printk
 FUNC=trace_printk_irq_work
 
+:;: "Add an event on a module function without module name" ;:
+
+echo "p:event0 $FUNC" > kprobe_events
+test -d events/kprobes/event0 || exit_failure
+echo "-:kprobes/event0" >> kprobe_events
+
 :;: "Add an event on a module function without specifying event name" ;:
 
 echo "p $MOD:$FUNC" > kprobe_events
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
author maintainer
#3 lore raw
In reply to Steven Rostedt

OK, this seems good to me, and tested. Let me pick it to probes/for-next.

Thanks!

Quoted 41 lines · On Tue, 14 Jul 2026 10:42:10 -0400 Steven Rostedt <[email protected]> wrote:

Is this still a think, or can we remove it from patchwork?

https://patchwork.kernel.org/project/linux-trace-kernel/patch/169846405196.88147.17766692778800222203.stgit@devnote2/

-- Steve

Quoted 29 lines · On Sat, 28 Oct 2023 12:34:12 +0900 "Masami Hiramatsu (Google)"…

From: Masami Hiramatsu (Google) <[email protected]>

Add a test case for probing on a symbol in a module without module name. When probing on a symbol in a module, ftrace accepts both the syntax that <MODNAME>:<SYMBOL> and <SYMBOL>. Current test case only checks the former syntax. This adds a test for the latter one.

---
 .../ftrace/test.d/kprobe/kprobe_module.tc          |    6 ++++++
 1 file changed, 6 insertions(+)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc +6 -0
index 7e74ee11edf9..4b32e1b9a8d3 100644
@@ -13,6 +13,12 @@ fi
 MOD=trace_printk
 FUNC=trace_printk_irq_work
 
+:;: "Add an event on a module function without module name" ;:
+
+echo "p:event0 $FUNC" > kprobe_events
+test -d events/kprobes/event0 || exit_failure
+echo "-:kprobes/event0" >> kprobe_events
+
 :;: "Add an event on a module function without specifying event name" ;:
 
 echo "p $MOD:$FUNC" > kprobe_events
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>