Re: [PATCH v6 7/7] tracing: Add a probe that attaches to trace events

From
Masami Hiramatsu <mhiramat@kernel.org>
Date
2021-08-19 03:57:03
Reply to
Steven Rostedt, 2021-08-19
On Wed, 18 Aug 2021 23:37:57 -0400
Steven Rostedt [off-list ref] wrote:

quoted
Here, you don't check the event name collision. Since the kprobe event
supports multiprobe event, it checks the collision by itself.
See register_trace_kprobe().
BTW, I found another issue on the name collision. Let me fix it.
I'm thinking of adding this above before taking the event_mutex:

	/* Check if the name already exists */
	if (find_event_probe(group, event))
		return -EEXIST;

Where I have:

static bool find_event_probe(const char *group, const char *event)
{
	struct dyn_event *ev;
	struct trace_eprobe *ep;

	for_each_dyn_event(ev) {
		if (ev->ops != &eprobe_dyn_event_ops)
			continue;
		
		ep = to_trace_eprobe(ev);
		if (strcmp(ep->tp.event->class.system, group) == 0 &&
		    strcmp(ep->tp.event->call.name, event) == 0)
			return true;
	}
	return false;
}
Yeah, but I think this should be done with event_mutex, shouldn't it?

Thank you,


-- 
Masami Hiramatsu [off-list ref]
Thread (20 messages) 20 messages, 2 authors, last reply 2021-08-19
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help