1 // SPDX-License-Identifier: GPL-2.0
5 * Part of this code was copied from kernel/trace/trace_kprobe.c written by
6 * Masami Hiramatsu <mhiramat@kernel.org>
8 * Copyright (C) 2021, VMware Inc, Steven Rostedt <rostedt@goodmis.org>
9 * Copyright (C) 2021, VMware Inc, Tzvetomir Stoyanov tz.stoyanov@gmail.com>
12 #include <linux/module.h>
13 #include <linux/mutex.h>
14 #include <linux/ftrace.h>
16 #include "trace_dynevent.h"
17 #include "trace_probe.h"
18 #include "trace_probe_tmpl.h"
19 #include "trace_probe_kernel.h"
21 #define EPROBE_EVENT_SYSTEM "eprobes"
24 /* tracepoint system */
25 const char *event_system;
27 /* tracepoint event */
28 const char *event_name;
30 /* filter string for the tracepoint */
33 struct trace_event_call *event;
35 struct dyn_event devent;
36 struct trace_probe tp;
40 struct trace_event_file *file;
41 struct trace_eprobe *ep;
44 static int __trace_eprobe_create(int argc, const char *argv[]);
46 static void trace_event_probe_cleanup(struct trace_eprobe *ep)
50 trace_probe_cleanup(&ep->tp);
51 kfree(ep->event_name);
52 kfree(ep->event_system);
54 trace_event_put_ref(ep->event);
58 static struct trace_eprobe *to_trace_eprobe(struct dyn_event *ev)
60 return container_of(ev, struct trace_eprobe, devent);
63 static int eprobe_dyn_event_create(const char *raw_command)
65 return trace_probe_create(raw_command, __trace_eprobe_create);
68 static int eprobe_dyn_event_show(struct seq_file *m, struct dyn_event *ev)
70 struct trace_eprobe *ep = to_trace_eprobe(ev);
73 seq_printf(m, "e:%s/%s", trace_probe_group_name(&ep->tp),
74 trace_probe_name(&ep->tp));
75 seq_printf(m, " %s.%s", ep->event_system, ep->event_name);
77 for (i = 0; i < ep->tp.nr_args; i++)
78 seq_printf(m, " %s=%s", ep->tp.args[i].name, ep->tp.args[i].comm);
84 static int unregister_trace_eprobe(struct trace_eprobe *ep)
86 /* If other probes are on the event, just unregister eprobe */
87 if (trace_probe_has_sibling(&ep->tp))
90 /* Enabled event can not be unregistered */
91 if (trace_probe_is_enabled(&ep->tp))
94 /* Will fail if probe is being used by ftrace or perf */
95 if (trace_probe_unregister_event_call(&ep->tp))
99 dyn_event_remove(&ep->devent);
100 trace_probe_unlink(&ep->tp);
105 static int eprobe_dyn_event_release(struct dyn_event *ev)
107 struct trace_eprobe *ep = to_trace_eprobe(ev);
108 int ret = unregister_trace_eprobe(ep);
111 trace_event_probe_cleanup(ep);
115 static bool eprobe_dyn_event_is_busy(struct dyn_event *ev)
117 struct trace_eprobe *ep = to_trace_eprobe(ev);
119 return trace_probe_is_enabled(&ep->tp);
122 static bool eprobe_dyn_event_match(const char *system, const char *event,
123 int argc, const char **argv, struct dyn_event *ev)
125 struct trace_eprobe *ep = to_trace_eprobe(ev);
129 * We match the following:
130 * event only - match all eprobes with event name
131 * system and event only - match all system/event probes
132 * system only - match all system probes
134 * The below has the above satisfied with more arguments:
136 * attached system/event - If the arg has the system and event
137 * the probe is attached to, match
138 * probes with the attachment.
140 * If any more args are given, then it requires a full match.
144 * If system exists, but this probe is not part of that system
147 if (system && strcmp(trace_probe_group_name(&ep->tp), system) != 0)
150 /* Must match the event name */
151 if (event[0] != '\0' && strcmp(trace_probe_name(&ep->tp), event) != 0)
154 /* No arguments match all */
158 /* First argument is the system/event the probe is attached to */
160 slash = strchr(argv[0], '/');
162 slash = strchr(argv[0], '.');
166 if (strncmp(ep->event_system, argv[0], slash - argv[0]))
168 if (strcmp(ep->event_name, slash + 1))
174 /* If there are no other args, then match */
178 return trace_probe_match_command_args(&ep->tp, argc, argv);
181 static struct dyn_event_operations eprobe_dyn_event_ops = {
182 .create = eprobe_dyn_event_create,
183 .show = eprobe_dyn_event_show,
184 .is_busy = eprobe_dyn_event_is_busy,
185 .free = eprobe_dyn_event_release,
186 .match = eprobe_dyn_event_match,
189 static struct trace_eprobe *alloc_event_probe(const char *group,
190 const char *this_event,
191 struct trace_event_call *event,
194 struct trace_eprobe *ep;
195 const char *event_name;
196 const char *sys_name;
200 return ERR_PTR(-ENODEV);
202 sys_name = event->class->system;
203 event_name = trace_event_name(event);
205 ep = kzalloc(struct_size(ep, tp.args, nargs), GFP_KERNEL);
207 trace_event_put_ref(event);
211 ep->event_name = kstrdup(event_name, GFP_KERNEL);
214 ep->event_system = kstrdup(sys_name, GFP_KERNEL);
215 if (!ep->event_system)
218 ret = trace_probe_init(&ep->tp, this_event, group, false);
222 dyn_event_init(&ep->devent, &eprobe_dyn_event_ops);
225 trace_event_probe_cleanup(ep);
229 static int trace_eprobe_tp_arg_update(struct trace_eprobe *ep, int i)
231 struct probe_arg *parg = &ep->tp.args[i];
232 struct ftrace_event_field *field;
233 struct list_head *head;
236 head = trace_get_fields(ep->event);
237 list_for_each_entry(field, head, link) {
238 if (!strcmp(parg->code->data, field->name)) {
239 kfree(parg->code->data);
240 parg->code->data = field;
246 * Argument not found on event. But allow for comm and COMM
247 * to be used to get the current->comm.
249 if (strcmp(parg->code->data, "COMM") == 0 ||
250 strcmp(parg->code->data, "comm") == 0) {
251 parg->code->op = FETCH_OP_COMM;
255 kfree(parg->code->data);
256 parg->code->data = NULL;
260 static int eprobe_event_define_fields(struct trace_event_call *event_call)
262 struct eprobe_trace_entry_head field;
263 struct trace_probe *tp;
265 tp = trace_probe_primary_from_call(event_call);
266 if (WARN_ON_ONCE(!tp))
269 return traceprobe_define_arg_fields(event_call, sizeof(field), tp);
272 static struct trace_event_fields eprobe_fields_array[] = {
273 { .type = TRACE_FUNCTION_TYPE,
274 .define_fields = eprobe_event_define_fields },
278 /* Event entry printers */
279 static enum print_line_t
280 print_eprobe_event(struct trace_iterator *iter, int flags,
281 struct trace_event *event)
283 struct eprobe_trace_entry_head *field;
284 struct trace_event_call *pevent;
285 struct trace_event *probed_event;
286 struct trace_seq *s = &iter->seq;
287 struct trace_eprobe *ep;
288 struct trace_probe *tp;
291 field = (struct eprobe_trace_entry_head *)iter->ent;
292 tp = trace_probe_primary_from_call(
293 container_of(event, struct trace_event_call, event));
294 if (WARN_ON_ONCE(!tp))
297 ep = container_of(tp, struct trace_eprobe, tp);
298 type = ep->event->event.type;
300 trace_seq_printf(s, "%s: (", trace_probe_name(tp));
302 probed_event = ftrace_find_event(type);
304 pevent = container_of(probed_event, struct trace_event_call, event);
305 trace_seq_printf(s, "%s.%s", pevent->class->system,
306 trace_event_name(pevent));
308 trace_seq_printf(s, "%u", type);
311 trace_seq_putc(s, ')');
313 if (print_probe_args(s, tp->args, tp->nr_args,
314 (u8 *)&field[1], field) < 0)
317 trace_seq_putc(s, '\n');
319 return trace_handle_return(s);
322 static unsigned long get_event_field(struct fetch_insn *code, void *rec)
324 struct ftrace_event_field *field = code->data;
328 addr = rec + field->offset;
330 if (is_string_field(field)) {
331 switch (field->filter_type) {
332 case FILTER_DYN_STRING:
333 val = (unsigned long)(rec + (*(unsigned int *)addr & 0xffff));
335 case FILTER_RDYN_STRING:
336 val = (unsigned long)(addr + (*(unsigned int *)addr & 0xffff));
338 case FILTER_STATIC_STRING:
339 val = (unsigned long)addr;
341 case FILTER_PTR_STRING:
342 val = (unsigned long)(*(char *)addr);
351 switch (field->size) {
353 if (field->is_signed)
356 val = *(unsigned char *)addr;
359 if (field->is_signed)
360 val = *(short *)addr;
362 val = *(unsigned short *)addr;
365 if (field->is_signed)
368 val = *(unsigned int *)addr;
371 if (field->is_signed)
374 val = *(unsigned long *)addr;
380 static int get_eprobe_size(struct trace_probe *tp, void *rec)
382 struct fetch_insn *code;
383 struct probe_arg *arg;
386 for (i = 0; i < tp->nr_args; i++) {
394 case FETCH_OP_TP_ARG:
395 val = get_event_field(code, rec);
398 val = code->immediate;
401 val = (unsigned long)current->comm;
404 val = (unsigned long)code->data;
406 case FETCH_NOP_SYMBOL: /* Ignore a place holder */
413 len = process_fetch_insn_bottom(code, val, NULL, NULL);
422 /* Kprobe specific fetch functions */
424 /* Note that we don't verify it, since the code does not come from user space */
426 process_fetch_insn(struct fetch_insn *code, void *rec, void *dest,
433 case FETCH_OP_TP_ARG:
434 val = get_event_field(code, rec);
437 val = code->immediate;
440 val = (unsigned long)current->comm;
443 val = (unsigned long)code->data;
445 case FETCH_NOP_SYMBOL: /* Ignore a place holder */
452 return process_fetch_insn_bottom(code, val, dest, base);
454 NOKPROBE_SYMBOL(process_fetch_insn)
456 /* Return the length of string -- including null terminal byte */
457 static nokprobe_inline int
458 fetch_store_strlen_user(unsigned long addr)
460 return kern_fetch_store_strlen_user(addr);
463 /* Return the length of string -- including null terminal byte */
464 static nokprobe_inline int
465 fetch_store_strlen(unsigned long addr)
467 return kern_fetch_store_strlen(addr);
471 * Fetch a null-terminated string from user. Caller MUST set *(u32 *)buf
472 * with max length and relative data location.
474 static nokprobe_inline int
475 fetch_store_string_user(unsigned long addr, void *dest, void *base)
477 return kern_fetch_store_string_user(addr, dest, base);
481 * Fetch a null-terminated string. Caller MUST set *(u32 *)buf with max
482 * length and relative data location.
484 static nokprobe_inline int
485 fetch_store_string(unsigned long addr, void *dest, void *base)
487 return kern_fetch_store_string(addr, dest, base);
490 static nokprobe_inline int
491 probe_mem_read_user(void *dest, void *src, size_t size)
493 const void __user *uaddr = (__force const void __user *)src;
495 return copy_from_user_nofault(dest, uaddr, size);
498 static nokprobe_inline int
499 probe_mem_read(void *dest, void *src, size_t size)
501 #ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
502 if ((unsigned long)src < TASK_SIZE)
503 return probe_mem_read_user(dest, src, size);
505 return copy_from_kernel_nofault(dest, src, size);
510 __eprobe_trace_func(struct eprobe_data *edata, void *rec)
512 struct eprobe_trace_entry_head *entry;
513 struct trace_event_call *call = trace_probe_event_call(&edata->ep->tp);
514 struct trace_event_buffer fbuffer;
517 if (WARN_ON_ONCE(call != edata->file->event_call))
520 if (trace_trigger_soft_disabled(edata->file))
523 dsize = get_eprobe_size(&edata->ep->tp, rec);
525 entry = trace_event_buffer_reserve(&fbuffer, edata->file,
526 sizeof(*entry) + edata->ep->tp.size + dsize);
531 entry = fbuffer.entry = ring_buffer_event_data(fbuffer.event);
532 store_trace_args(&entry[1], &edata->ep->tp, rec, sizeof(*entry), dsize);
534 trace_event_buffer_commit(&fbuffer);
538 * The event probe implementation uses event triggers to get access to
539 * the event it is attached to, but is not an actual trigger. The below
540 * functions are just stubs to fulfill what is needed to use the trigger
543 static int eprobe_trigger_init(struct event_trigger_data *data)
548 static void eprobe_trigger_free(struct event_trigger_data *data)
553 static int eprobe_trigger_print(struct seq_file *m,
554 struct event_trigger_data *data)
556 /* Do not print eprobe event triggers */
560 static void eprobe_trigger_func(struct event_trigger_data *data,
561 struct trace_buffer *buffer, void *rec,
562 struct ring_buffer_event *rbe)
564 struct eprobe_data *edata = data->private_data;
566 __eprobe_trace_func(edata, rec);
569 static struct event_trigger_ops eprobe_trigger_ops = {
570 .trigger = eprobe_trigger_func,
571 .print = eprobe_trigger_print,
572 .init = eprobe_trigger_init,
573 .free = eprobe_trigger_free,
576 static int eprobe_trigger_cmd_parse(struct event_command *cmd_ops,
577 struct trace_event_file *file,
578 char *glob, char *cmd,
579 char *param_and_filter)
584 static int eprobe_trigger_reg_func(char *glob,
585 struct event_trigger_data *data,
586 struct trace_event_file *file)
591 static void eprobe_trigger_unreg_func(char *glob,
592 struct event_trigger_data *data,
593 struct trace_event_file *file)
598 static struct event_trigger_ops *eprobe_trigger_get_ops(char *cmd,
601 return &eprobe_trigger_ops;
604 static struct event_command event_trigger_cmd = {
606 .trigger_type = ETT_EVENT_EPROBE,
607 .flags = EVENT_CMD_FL_NEEDS_REC,
608 .parse = eprobe_trigger_cmd_parse,
609 .reg = eprobe_trigger_reg_func,
610 .unreg = eprobe_trigger_unreg_func,
612 .get_trigger_ops = eprobe_trigger_get_ops,
616 static struct event_trigger_data *
617 new_eprobe_trigger(struct trace_eprobe *ep, struct trace_event_file *file)
619 struct event_trigger_data *trigger;
620 struct event_filter *filter = NULL;
621 struct eprobe_data *edata;
624 edata = kzalloc(sizeof(*edata), GFP_KERNEL);
625 trigger = kzalloc(sizeof(*trigger), GFP_KERNEL);
626 if (!trigger || !edata) {
631 trigger->flags = EVENT_TRIGGER_FL_PROBE;
633 trigger->ops = &eprobe_trigger_ops;
636 * EVENT PROBE triggers are not registered as commands with
637 * register_event_command(), as they are not controlled by the user
638 * from the trigger file
640 trigger->cmd_ops = &event_trigger_cmd;
642 INIT_LIST_HEAD(&trigger->list);
644 if (ep->filter_str) {
645 ret = create_event_filter(file->tr, file->event_call,
646 ep->filter_str, false, &filter);
650 RCU_INIT_POINTER(trigger->filter, filter);
654 trigger->private_data = edata;
658 free_event_filter(filter);
664 static int enable_eprobe(struct trace_eprobe *ep,
665 struct trace_event_file *eprobe_file)
667 struct event_trigger_data *trigger;
668 struct trace_event_file *file;
669 struct trace_array *tr = eprobe_file->tr;
671 file = find_event_file(tr, ep->event_system, ep->event_name);
674 trigger = new_eprobe_trigger(ep, eprobe_file);
676 return PTR_ERR(trigger);
678 list_add_tail_rcu(&trigger->list, &file->triggers);
680 trace_event_trigger_enable_disable(file, 1);
681 update_cond_flag(file);
686 static struct trace_event_functions eprobe_funcs = {
687 .trace = print_eprobe_event
690 static int disable_eprobe(struct trace_eprobe *ep,
691 struct trace_array *tr)
693 struct event_trigger_data *trigger = NULL, *iter;
694 struct trace_event_file *file;
695 struct event_filter *filter;
696 struct eprobe_data *edata;
698 file = find_event_file(tr, ep->event_system, ep->event_name);
702 list_for_each_entry(iter, &file->triggers, list) {
703 if (!(iter->flags & EVENT_TRIGGER_FL_PROBE))
705 edata = iter->private_data;
706 if (edata->ep == ep) {
714 list_del_rcu(&trigger->list);
716 trace_event_trigger_enable_disable(file, 0);
717 update_cond_flag(file);
719 /* Make sure nothing is using the edata or trigger */
720 tracepoint_synchronize_unregister();
722 filter = rcu_access_pointer(trigger->filter);
725 free_event_filter(filter);
732 static int enable_trace_eprobe(struct trace_event_call *call,
733 struct trace_event_file *file)
735 struct trace_probe *pos, *tp;
736 struct trace_eprobe *ep;
740 tp = trace_probe_primary_from_call(call);
741 if (WARN_ON_ONCE(!tp))
743 enabled = trace_probe_is_enabled(tp);
745 /* This also changes "enabled" state */
747 ret = trace_probe_add_file(tp, file);
751 trace_probe_set_flag(tp, TP_FLAG_PROFILE);
756 list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
757 ep = container_of(pos, struct trace_eprobe, tp);
758 ret = enable_eprobe(ep, file);
765 /* Failed to enable one of them. Roll back all */
767 disable_eprobe(ep, file->tr);
769 trace_probe_remove_file(tp, file);
771 trace_probe_clear_flag(tp, TP_FLAG_PROFILE);
777 static int disable_trace_eprobe(struct trace_event_call *call,
778 struct trace_event_file *file)
780 struct trace_probe *pos, *tp;
781 struct trace_eprobe *ep;
783 tp = trace_probe_primary_from_call(call);
784 if (WARN_ON_ONCE(!tp))
788 if (!trace_probe_get_file_link(tp, file))
790 if (!trace_probe_has_single_file(tp))
792 trace_probe_clear_flag(tp, TP_FLAG_TRACE);
794 trace_probe_clear_flag(tp, TP_FLAG_PROFILE);
796 if (!trace_probe_is_enabled(tp)) {
797 list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
798 ep = container_of(pos, struct trace_eprobe, tp);
799 disable_eprobe(ep, file->tr);
806 * Synchronization is done in below function. For perf event,
807 * file == NULL and perf_trace_event_unreg() calls
808 * tracepoint_synchronize_unregister() to ensure synchronize
809 * event. We don't need to care about it.
811 trace_probe_remove_file(tp, file);
816 static int eprobe_register(struct trace_event_call *event,
817 enum trace_reg type, void *data)
819 struct trace_event_file *file = data;
822 case TRACE_REG_REGISTER:
823 return enable_trace_eprobe(event, file);
824 case TRACE_REG_UNREGISTER:
825 return disable_trace_eprobe(event, file);
826 #ifdef CONFIG_PERF_EVENTS
827 case TRACE_REG_PERF_REGISTER:
828 case TRACE_REG_PERF_UNREGISTER:
829 case TRACE_REG_PERF_OPEN:
830 case TRACE_REG_PERF_CLOSE:
831 case TRACE_REG_PERF_ADD:
832 case TRACE_REG_PERF_DEL:
839 static inline void init_trace_eprobe_call(struct trace_eprobe *ep)
841 struct trace_event_call *call = trace_probe_event_call(&ep->tp);
843 call->flags = TRACE_EVENT_FL_EPROBE;
844 call->event.funcs = &eprobe_funcs;
845 call->class->fields_array = eprobe_fields_array;
846 call->class->reg = eprobe_register;
849 static struct trace_event_call *
850 find_and_get_event(const char *system, const char *event_name)
852 struct trace_event_call *tp_event;
855 list_for_each_entry(tp_event, &ftrace_events, list) {
856 /* Skip other probes and ftrace events */
857 if (tp_event->flags &
858 (TRACE_EVENT_FL_IGNORE_ENABLE |
859 TRACE_EVENT_FL_KPROBE |
860 TRACE_EVENT_FL_UPROBE |
861 TRACE_EVENT_FL_EPROBE))
863 if (!tp_event->class->system ||
864 strcmp(system, tp_event->class->system))
866 name = trace_event_name(tp_event);
867 if (!name || strcmp(event_name, name))
869 if (!trace_event_try_get_ref(tp_event)) {
879 static int trace_eprobe_tp_update_arg(struct trace_eprobe *ep, const char *argv[], int i)
881 unsigned int flags = TPARG_FL_KERNEL | TPARG_FL_TPOINT;
884 ret = traceprobe_parse_probe_arg(&ep->tp, i, argv[i], flags);
888 if (ep->tp.args[i].code->op == FETCH_OP_TP_ARG) {
889 ret = trace_eprobe_tp_arg_update(ep, i);
891 trace_probe_log_err(0, BAD_ATTACH_ARG);
894 /* Handle symbols "@" */
896 ret = traceprobe_update_arg(&ep->tp.args[i]);
901 static int trace_eprobe_parse_filter(struct trace_eprobe *ep, int argc, const char *argv[])
903 struct event_filter *dummy;
908 trace_probe_log_err(0, NO_EP_FILTER);
912 /* Recover the filter string */
913 for (i = 0; i < argc; i++)
914 len += strlen(argv[i]) + 1;
916 ep->filter_str = kzalloc(len, GFP_KERNEL);
921 for (i = 0; i < argc; i++) {
922 ret = snprintf(p, len, "%s ", argv[i]);
935 * Ensure the filter string can be parsed correctly. Note, this
936 * filter string is for the original event, not for the eprobe.
938 ret = create_event_filter(top_trace_array(), ep->event, ep->filter_str,
940 free_event_filter(dummy);
946 kfree(ep->filter_str);
947 ep->filter_str = NULL;
951 static int __trace_eprobe_create(int argc, const char *argv[])
955 * e[:[GRP/][ENAME]] SYSTEM.EVENT [FETCHARGS] [if FILTER]
956 * Fetch args (no space):
957 * <name>=$<field>[:TYPE]
959 const char *event = NULL, *group = EPROBE_EVENT_SYSTEM;
960 const char *sys_event = NULL, *sys_name = NULL;
961 struct trace_event_call *event_call;
962 struct trace_eprobe *ep = NULL;
963 char buf1[MAX_EVENT_NAME_LEN];
964 char buf2[MAX_EVENT_NAME_LEN];
965 char gbuf[MAX_EVENT_NAME_LEN];
966 int ret = 0, filter_idx = 0;
969 if (argc < 2 || argv[0][0] != 'e')
972 trace_probe_log_init("event_probe", argc, argv);
974 event = strchr(&argv[0][1], ':');
977 ret = traceprobe_parse_event_name(&event, &group, gbuf,
983 trace_probe_log_set_index(1);
985 ret = traceprobe_parse_event_name(&sys_event, &sys_name, buf2, 0);
986 if (ret || !sys_event || !sys_name) {
987 trace_probe_log_err(0, NO_EVENT_INFO);
992 strscpy(buf1, sys_event, MAX_EVENT_NAME_LEN);
996 for (i = 2; i < argc; i++) {
997 if (!strcmp(argv[i], "if")) {
999 filter_cnt = argc - filter_idx;
1005 mutex_lock(&event_mutex);
1006 event_call = find_and_get_event(sys_name, sys_event);
1007 ep = alloc_event_probe(group, event, event_call, argc - 2);
1008 mutex_unlock(&event_mutex);
1013 trace_probe_log_err(0, BAD_ATTACH_EVENT);
1014 /* This must return -ENOMEM or missing event, else there is a bug */
1015 WARN_ON_ONCE(ret != -ENOMEM && ret != -ENODEV);
1021 trace_probe_log_set_index(filter_idx);
1022 ret = trace_eprobe_parse_filter(ep, filter_cnt, argv + filter_idx);
1026 ep->filter_str = NULL;
1028 argc -= 2; argv += 2;
1029 /* parse arguments */
1030 for (i = 0; i < argc && i < MAX_TRACE_ARGS; i++) {
1031 trace_probe_log_set_index(i + 2);
1032 ret = trace_eprobe_tp_update_arg(ep, argv, i);
1036 ret = traceprobe_set_print_fmt(&ep->tp, PROBE_PRINT_EVENT);
1039 init_trace_eprobe_call(ep);
1040 mutex_lock(&event_mutex);
1041 ret = trace_probe_register_event_call(&ep->tp);
1043 if (ret == -EEXIST) {
1044 trace_probe_log_set_index(0);
1045 trace_probe_log_err(0, EVENT_EXIST);
1047 mutex_unlock(&event_mutex);
1050 ret = dyn_event_add(&ep->devent, &ep->tp.event->call);
1051 mutex_unlock(&event_mutex);
1056 trace_event_probe_cleanup(ep);
1061 * Register dynevent at core_initcall. This allows kernel to setup eprobe
1062 * events in postcore_initcall without tracefs.
1064 static __init int trace_events_eprobe_init_early(void)
1068 err = dyn_event_register(&eprobe_dyn_event_ops);
1070 pr_warn("Could not register eprobe_dyn_event_ops\n");
1074 core_initcall(trace_events_eprobe_init_early);