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

From: Masami Hiramatsu
Date: Wed Aug 18 2021 - 23:57:04 EST


On Wed, 18 Aug 2021 23:37:57 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:


> > 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 <mhiramat@xxxxxxxxxx>