mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tracing: Fix event probe removal from dynamic events
@ 2021-10-12  1:11 Steven Rostedt
  2021-10-12  6:49 ` kernel test robot
  2021-10-12  8:29 ` kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Steven Rostedt @ 2021-10-12  1:11 UTC (permalink / raw)
  To: LKML
  Cc: Ingo Molnar, Andrew Morton, Masami Hiramatsu, Tom Zanussi,
	Tzvetomir Stoyanov, Yordan Karadzhov

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

When an event probe is to be removed via the API to remove dynamic events,
an -EBUSY error is returned.

This is because the removal of the event probe does not expect to see the
event system and name that the event probe is attached to, even though
that's part of the API to create it. As the removal of probes is to use
the same API as they are created, fix it by first testing if the first
parameter of the event probe to be removed matches the system and event
that the probe is attached to, and then adjust the argc and argv of the
parameters to match the rest of the syntax.

Fixes: 7491e2c442781 ("tracing: Add a probe that attaches to trace events")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace_eprobe.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c
index 3044b762cbd7..20ee265f01fd 100644
--- a/kernel/trace/trace_eprobe.c
+++ b/kernel/trace/trace_eprobe.c
@@ -120,6 +120,25 @@ static bool eprobe_dyn_event_match(const char *system, const char *event,
 {
 	struct trace_eprobe *ep = to_trace_eprobe(ev);
 
+	/* First argument is the system/event the probe is attached to */
+
+	if (argc < 1)
+		return false;
+
+	slash = strchr(argv[0], '/');
+	if (!slash)
+		slash = strchr(argv[0], '.');
+	if (!slash)
+		return false;
+
+	if (strncmp(ep->event_system, argv[0], slash - argv[0]))
+		return false;
+	if (strcmp(ep->event_name, slash + 1))
+		return false;
+
+	argc--;
+	argv++;
+
 	return strcmp(trace_probe_name(&ep->tp), event) == 0 &&
 	    (!system || strcmp(trace_probe_group_name(&ep->tp), system) == 0) &&
 	    trace_probe_match_command_args(&ep->tp, argc, argv);
-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-12 12:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12  1:11 [PATCH] tracing: Fix event probe removal from dynamic events Steven Rostedt
2021-10-12  6:49 ` kernel test robot
2021-10-12 12:10   ` Steven Rostedt
2021-10-12  8:29 ` kernel test robot

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®