Hi. Le dimanche 20 août 2023, 22:34:40 CEST Jiri Olsa a écrit : > On Sat, Aug 19, 2023 at 10:11:05AM +0900, Masami Hiramatsu wrote: > > SNIP > > > > > > > > + func_addr = kallsyms_lookup_name(func); > > > > > > > + for (i = 0; i < array.size; i++) { > > > > > > > + struct trace_kprobe *tk_same_name; > > > > > > > + unsigned long address; > > > > > > > + > > > > > > > + address = array.addrs[i]; > > > > > > > + /* Skip the function address as we already registered it. */ > > > > > > > + if (address == func_addr) > > > > > > > + continue; > > > > > > > + > > > > > > > + /* > > > > > > > + * alloc_trace_kprobe() first considers symbol name, so we > > > > > > > set > > > > > > > + * this to NULL to allocate this kprobe on the given address. > > > > > > > + */ > > > > > > > + tk_same_name = alloc_trace_kprobe(KPROBE_EVENT_SYSTEM, event, > > > > > > > + (void *)address, NULL, offs, > > > > > > > + 0 /* maxactive */, > > > > > > > + 0 /* nargs */, is_return); > > > > > > > + > > > > > > > + if (IS_ERR(tk_same_name)) { > > > > > > > + ret = -ENOMEM; > > > > > > > + goto error_free; > > > > > > > + } > > > > > > > + > > > > > > > + init_trace_event_call(tk_same_name); > > > > > > > + > > > > > > > + if (traceprobe_set_print_fmt(&tk_same_name->tp, ptype) < 0) { > > > > > > > + ret = -ENOMEM; > > also are we leaking tk_same_name in here? > > > > > > > > + goto error_free; > > > > > > > + } > > > > > > > + > > > > > > > + ret = append_trace_kprobe(tk_same_name, tk); > > > > > > > + if (ret) > > and here? Good catch! Do you know if the appended probes are automatically freed? If so, can you please indicate which function handles this? > jirka > > > > > > > > + goto error_free; > > > > > > > + } > > > > > > > + > > > > > > > +end: > > > > > > > + kfree(array.addrs); > > > > > > > > > > > > > > return trace_probe_event_call(&tk->tp); > > > > > > > > > > > > > > +error_free: > > > > > > > + kfree(array.addrs); > > > > > > > > > > > > > > error: > > > > > > > free_trace_kprobe(tk); > > > > > > > return ERR_PTR(ret); > > > > > > > > > > --- > > > > > [1]: https://github.com/torvalds/linux/blob/ > > > > > 57012c57536f8814dec92e74197ee96c3498d24e/tools/perf/util/probe-event > > > > > .c#L29 > > > > > 89- L2993 Best regards.