Lines Matching refs:tu
90 static int register_uprobe_event(struct trace_uprobe *tu);
91 static int unregister_uprobe_event(struct trace_uprobe *tu);
94 struct trace_uprobe *tu; member
214 base_addr = udd->bp_addr - udd->tu->offset; in translate_user_vaddr()
272 static inline bool is_ret_probe(struct trace_uprobe *tu) in is_ret_probe() argument
274 return tu->consumer.ret_handler != NULL; in is_ret_probe()
279 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_is_busy() local
281 return trace_probe_is_enabled(&tu->tp); in trace_uprobe_is_busy()
284 static bool trace_uprobe_match_command_head(struct trace_uprobe *tu, in trace_uprobe_match_command_head() argument
293 len = strlen(tu->filename); in trace_uprobe_match_command_head()
294 if (strncmp(tu->filename, argv[0], len) || argv[0][len] != ':') in trace_uprobe_match_command_head()
297 if (tu->ref_ctr_offset == 0) in trace_uprobe_match_command_head()
299 (int)(sizeof(void *) * 2), tu->offset); in trace_uprobe_match_command_head()
302 (int)(sizeof(void *) * 2), tu->offset, in trace_uprobe_match_command_head()
303 tu->ref_ctr_offset); in trace_uprobe_match_command_head()
309 return trace_probe_match_command_args(&tu->tp, argc, argv); in trace_uprobe_match_command_head()
315 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_match() local
317 return strcmp(trace_probe_name(&tu->tp), event) == 0 && in trace_uprobe_match()
318 (!system || strcmp(trace_probe_group_name(&tu->tp), system) == 0) && in trace_uprobe_match()
319 trace_uprobe_match_command_head(tu, argc, argv); in trace_uprobe_match()
340 struct trace_uprobe *tu; in alloc_trace_uprobe() local
343 tu = kzalloc(SIZEOF_TRACE_UPROBE(nargs), GFP_KERNEL); in alloc_trace_uprobe()
344 if (!tu) in alloc_trace_uprobe()
347 ret = trace_probe_init(&tu->tp, event, group, true); in alloc_trace_uprobe()
351 dyn_event_init(&tu->devent, &trace_uprobe_ops); in alloc_trace_uprobe()
352 tu->consumer.handler = uprobe_dispatcher; in alloc_trace_uprobe()
354 tu->consumer.ret_handler = uretprobe_dispatcher; in alloc_trace_uprobe()
355 init_trace_uprobe_filter(tu->tp.event->filter); in alloc_trace_uprobe()
356 return tu; in alloc_trace_uprobe()
359 kfree(tu); in alloc_trace_uprobe()
364 static void free_trace_uprobe(struct trace_uprobe *tu) in free_trace_uprobe() argument
366 if (!tu) in free_trace_uprobe()
369 path_put(&tu->path); in free_trace_uprobe()
370 trace_probe_cleanup(&tu->tp); in free_trace_uprobe()
371 kfree(tu->filename); in free_trace_uprobe()
372 kfree(tu); in free_trace_uprobe()
378 struct trace_uprobe *tu; in find_probe_event() local
380 for_each_trace_uprobe(tu, pos) in find_probe_event()
381 if (strcmp(trace_probe_name(&tu->tp), event) == 0 && in find_probe_event()
382 strcmp(trace_probe_group_name(&tu->tp), group) == 0) in find_probe_event()
383 return tu; in find_probe_event()
389 static int unregister_trace_uprobe(struct trace_uprobe *tu) in unregister_trace_uprobe() argument
393 if (trace_probe_has_sibling(&tu->tp)) in unregister_trace_uprobe()
396 ret = unregister_uprobe_event(tu); in unregister_trace_uprobe()
401 dyn_event_remove(&tu->devent); in unregister_trace_uprobe()
402 trace_probe_unlink(&tu->tp); in unregister_trace_uprobe()
403 free_trace_uprobe(tu); in unregister_trace_uprobe()
438 static int append_trace_uprobe(struct trace_uprobe *tu, struct trace_uprobe *to) in append_trace_uprobe() argument
442 ret = trace_probe_compare_arg_type(&tu->tp, &to->tp); in append_trace_uprobe()
449 if (trace_uprobe_has_same_uprobe(to, tu)) { in append_trace_uprobe()
456 ret = trace_probe_append(&tu->tp, &to->tp); in append_trace_uprobe()
458 dyn_event_add(&tu->devent); in append_trace_uprobe()
490 static int register_trace_uprobe(struct trace_uprobe *tu) in register_trace_uprobe() argument
497 ret = validate_ref_ctr_offset(tu); in register_trace_uprobe()
502 old_tu = find_probe_event(trace_probe_name(&tu->tp), in register_trace_uprobe()
503 trace_probe_group_name(&tu->tp)); in register_trace_uprobe()
505 if (is_ret_probe(tu) != is_ret_probe(old_tu)) { in register_trace_uprobe()
510 ret = append_trace_uprobe(tu, old_tu); in register_trace_uprobe()
515 ret = register_uprobe_event(tu); in register_trace_uprobe()
521 dyn_event_add(&tu->devent); in register_trace_uprobe()
535 struct trace_uprobe *tu; in trace_uprobe_create() local
669 tu = alloc_trace_uprobe(group, event, argc, is_return); in trace_uprobe_create()
670 if (IS_ERR(tu)) { in trace_uprobe_create()
671 ret = PTR_ERR(tu); in trace_uprobe_create()
676 tu->offset = offset; in trace_uprobe_create()
677 tu->ref_ctr_offset = ref_ctr_offset; in trace_uprobe_create()
678 tu->path = path; in trace_uprobe_create()
679 tu->filename = filename; in trace_uprobe_create()
690 ret = traceprobe_parse_probe_arg(&tu->tp, i, tmp, in trace_uprobe_create()
697 ret = traceprobe_set_print_fmt(&tu->tp, is_ret_probe(tu)); in trace_uprobe_create()
701 ret = register_trace_uprobe(tu); in trace_uprobe_create()
706 free_trace_uprobe(tu); in trace_uprobe_create()
732 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_release() local
734 return unregister_trace_uprobe(tu); in trace_uprobe_release()
740 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_show() local
741 char c = is_ret_probe(tu) ? 'r' : 'p'; in trace_uprobe_show()
744 seq_printf(m, "%c:%s/%s %s:0x%0*lx", c, trace_probe_group_name(&tu->tp), in trace_uprobe_show()
745 trace_probe_name(&tu->tp), tu->filename, in trace_uprobe_show()
746 (int)(sizeof(void *) * 2), tu->offset); in trace_uprobe_show()
748 if (tu->ref_ctr_offset) in trace_uprobe_show()
749 seq_printf(m, "(0x%lx)", tu->ref_ctr_offset); in trace_uprobe_show()
751 for (i = 0; i < tu->tp.nr_args; i++) in trace_uprobe_show()
752 seq_printf(m, " %s=%s", tu->tp.args[i].name, tu->tp.args[i].comm); in trace_uprobe_show()
812 struct trace_uprobe *tu; in probes_profile_seq_show() local
817 tu = to_trace_uprobe(ev); in probes_profile_seq_show()
818 seq_printf(m, " %s %-44s %15lu\n", tu->filename, in probes_profile_seq_show()
819 trace_probe_name(&tu->tp), tu->nhit); in probes_profile_seq_show()
941 static void __uprobe_trace_func(struct trace_uprobe *tu, in __uprobe_trace_func() argument
951 struct trace_event_call *call = trace_probe_event_call(&tu->tp); in __uprobe_trace_func()
955 if (WARN_ON_ONCE(tu->tp.size + dsize > PAGE_SIZE)) in __uprobe_trace_func()
961 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in __uprobe_trace_func()
962 size = esize + tu->tp.size + dsize; in __uprobe_trace_func()
969 if (is_ret_probe(tu)) { in __uprobe_trace_func()
978 memcpy(data, ucb->buf, tu->tp.size + dsize); in __uprobe_trace_func()
984 static int uprobe_trace_func(struct trace_uprobe *tu, struct pt_regs *regs, in uprobe_trace_func() argument
989 if (is_ret_probe(tu)) in uprobe_trace_func()
993 trace_probe_for_each_link_rcu(link, &tu->tp) in uprobe_trace_func()
994 __uprobe_trace_func(tu, 0, regs, ucb, dsize, link->file); in uprobe_trace_func()
1000 static void uretprobe_trace_func(struct trace_uprobe *tu, unsigned long func, in uretprobe_trace_func() argument
1007 trace_probe_for_each_link_rcu(link, &tu->tp) in uretprobe_trace_func()
1008 __uprobe_trace_func(tu, func, regs, ucb, dsize, link->file); in uretprobe_trace_func()
1018 struct trace_uprobe *tu; in print_uprobe_event() local
1022 tu = trace_uprobe_primary_from_call( in print_uprobe_event()
1024 if (unlikely(!tu)) in print_uprobe_event()
1027 if (is_ret_probe(tu)) { in print_uprobe_event()
1029 trace_probe_name(&tu->tp), in print_uprobe_event()
1034 trace_probe_name(&tu->tp), in print_uprobe_event()
1039 if (print_probe_args(s, tu->tp.args, tu->tp.nr_args, data, entry) < 0) in print_uprobe_event()
1052 static int trace_uprobe_enable(struct trace_uprobe *tu, filter_func_t filter) in trace_uprobe_enable() argument
1056 tu->consumer.filter = filter; in trace_uprobe_enable()
1057 tu->inode = d_real_inode(tu->path.dentry); in trace_uprobe_enable()
1059 if (tu->ref_ctr_offset) in trace_uprobe_enable()
1060 ret = uprobe_register_refctr(tu->inode, tu->offset, in trace_uprobe_enable()
1061 tu->ref_ctr_offset, &tu->consumer); in trace_uprobe_enable()
1063 ret = uprobe_register(tu->inode, tu->offset, &tu->consumer); in trace_uprobe_enable()
1066 tu->inode = NULL; in trace_uprobe_enable()
1074 struct trace_uprobe *tu; in __probe_event_disable() local
1076 tu = container_of(tp, struct trace_uprobe, tp); in __probe_event_disable()
1077 WARN_ON(!uprobe_filter_is_empty(tu->tp.event->filter)); in __probe_event_disable()
1080 tu = container_of(pos, struct trace_uprobe, tp); in __probe_event_disable()
1081 if (!tu->inode) in __probe_event_disable()
1084 uprobe_unregister(tu->inode, tu->offset, &tu->consumer); in __probe_event_disable()
1085 tu->inode = NULL; in __probe_event_disable()
1093 struct trace_uprobe *tu; in probe_event_enable() local
1117 tu = container_of(tp, struct trace_uprobe, tp); in probe_event_enable()
1118 WARN_ON(!uprobe_filter_is_empty(tu->tp.event->filter)); in probe_event_enable()
1128 tu = container_of(pos, struct trace_uprobe, tp); in probe_event_enable()
1129 ret = trace_uprobe_enable(tu, filter); in probe_event_enable()
1179 struct trace_uprobe *tu; in uprobe_event_define_fields() local
1181 tu = trace_uprobe_primary_from_call(event_call); in uprobe_event_define_fields()
1182 if (unlikely(!tu)) in uprobe_event_define_fields()
1185 if (is_ret_probe(tu)) { in uprobe_event_define_fields()
1194 return traceprobe_define_arg_fields(event_call, size, &tu->tp); in uprobe_event_define_fields()
1274 struct trace_uprobe *tu; in uprobe_perf_close() local
1281 tu = container_of(tp, struct trace_uprobe, tp); in uprobe_perf_close()
1282 if (trace_uprobe_filter_remove(tu->tp.event->filter, event)) in uprobe_perf_close()
1286 tu = container_of(pos, struct trace_uprobe, tp); in uprobe_perf_close()
1287 ret = uprobe_apply(tu->inode, tu->offset, &tu->consumer, false); in uprobe_perf_close()
1299 struct trace_uprobe *tu; in uprobe_perf_open() local
1306 tu = container_of(tp, struct trace_uprobe, tp); in uprobe_perf_open()
1307 if (trace_uprobe_filter_add(tu->tp.event->filter, event)) in uprobe_perf_open()
1311 err = uprobe_apply(tu->inode, tu->offset, &tu->consumer, true); in uprobe_perf_open()
1325 struct trace_uprobe *tu; in uprobe_perf_filter() local
1328 tu = container_of(uc, struct trace_uprobe, consumer); in uprobe_perf_filter()
1329 filter = tu->tp.event->filter; in uprobe_perf_filter()
1338 static void __uprobe_perf_func(struct trace_uprobe *tu, in __uprobe_perf_func() argument
1342 struct trace_event_call *call = trace_probe_event_call(&tu->tp); in __uprobe_perf_func()
1359 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in __uprobe_perf_func()
1361 size = esize + tu->tp.size + dsize; in __uprobe_perf_func()
1375 if (is_ret_probe(tu)) { in __uprobe_perf_func()
1384 memcpy(data, ucb->buf, tu->tp.size + dsize); in __uprobe_perf_func()
1386 if (size - esize > tu->tp.size + dsize) { in __uprobe_perf_func()
1387 int len = tu->tp.size + dsize; in __uprobe_perf_func()
1399 static int uprobe_perf_func(struct trace_uprobe *tu, struct pt_regs *regs, in uprobe_perf_func() argument
1402 if (!uprobe_perf_filter(&tu->consumer, 0, current->mm)) in uprobe_perf_func()
1405 if (!is_ret_probe(tu)) in uprobe_perf_func()
1406 __uprobe_perf_func(tu, 0, regs, ucb, dsize); in uprobe_perf_func()
1410 static void uretprobe_perf_func(struct trace_uprobe *tu, unsigned long func, in uretprobe_perf_func() argument
1414 __uprobe_perf_func(tu, func, regs, ucb, dsize); in uretprobe_perf_func()
1423 struct trace_uprobe *tu; in bpf_get_uprobe_info() local
1426 tu = find_probe_event(pevent, group); in bpf_get_uprobe_info()
1428 tu = trace_uprobe_primary_from_call(event->tp_event); in bpf_get_uprobe_info()
1429 if (!tu) in bpf_get_uprobe_info()
1432 *fd_type = is_ret_probe(tu) ? BPF_FD_TYPE_URETPROBE in bpf_get_uprobe_info()
1434 *filename = tu->filename; in bpf_get_uprobe_info()
1435 *probe_offset = tu->offset; in bpf_get_uprobe_info()
1476 struct trace_uprobe *tu; in uprobe_dispatcher() local
1483 tu = container_of(con, struct trace_uprobe, consumer); in uprobe_dispatcher()
1484 tu->nhit++; in uprobe_dispatcher()
1486 udd.tu = tu; in uprobe_dispatcher()
1494 dsize = __get_data_size(&tu->tp, regs); in uprobe_dispatcher()
1495 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in uprobe_dispatcher()
1498 store_trace_args(ucb->buf, &tu->tp, regs, esize, dsize); in uprobe_dispatcher()
1500 if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) in uprobe_dispatcher()
1501 ret |= uprobe_trace_func(tu, regs, ucb, dsize); in uprobe_dispatcher()
1504 if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) in uprobe_dispatcher()
1505 ret |= uprobe_perf_func(tu, regs, ucb, dsize); in uprobe_dispatcher()
1514 struct trace_uprobe *tu; in uretprobe_dispatcher() local
1519 tu = container_of(con, struct trace_uprobe, consumer); in uretprobe_dispatcher()
1521 udd.tu = tu; in uretprobe_dispatcher()
1529 dsize = __get_data_size(&tu->tp, regs); in uretprobe_dispatcher()
1530 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in uretprobe_dispatcher()
1533 store_trace_args(ucb->buf, &tu->tp, regs, esize, dsize); in uretprobe_dispatcher()
1535 if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) in uretprobe_dispatcher()
1536 uretprobe_trace_func(tu, func, regs, ucb, dsize); in uretprobe_dispatcher()
1539 if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) in uretprobe_dispatcher()
1540 uretprobe_perf_func(tu, func, regs, ucb, dsize); in uretprobe_dispatcher()
1556 static inline void init_trace_event_call(struct trace_uprobe *tu) in init_trace_event_call() argument
1558 struct trace_event_call *call = trace_probe_event_call(&tu->tp); in init_trace_event_call()
1566 static int register_uprobe_event(struct trace_uprobe *tu) in register_uprobe_event() argument
1568 init_trace_event_call(tu); in register_uprobe_event()
1570 return trace_probe_register_event_call(&tu->tp); in register_uprobe_event()
1573 static int unregister_uprobe_event(struct trace_uprobe *tu) in unregister_uprobe_event() argument
1575 return trace_probe_unregister_event_call(&tu->tp); in unregister_uprobe_event()
1583 struct trace_uprobe *tu; in create_local_trace_uprobe() local
1601 tu = alloc_trace_uprobe(UPROBE_EVENT_SYSTEM, "DUMMY_EVENT", 0, in create_local_trace_uprobe()
1604 if (IS_ERR(tu)) { in create_local_trace_uprobe()
1606 (int)PTR_ERR(tu)); in create_local_trace_uprobe()
1608 return ERR_CAST(tu); in create_local_trace_uprobe()
1611 tu->offset = offs; in create_local_trace_uprobe()
1612 tu->path = path; in create_local_trace_uprobe()
1613 tu->ref_ctr_offset = ref_ctr_offset; in create_local_trace_uprobe()
1614 tu->filename = kstrdup(name, GFP_KERNEL); in create_local_trace_uprobe()
1615 init_trace_event_call(tu); in create_local_trace_uprobe()
1617 if (traceprobe_set_print_fmt(&tu->tp, is_ret_probe(tu)) < 0) { in create_local_trace_uprobe()
1622 return trace_probe_event_call(&tu->tp); in create_local_trace_uprobe()
1624 free_trace_uprobe(tu); in create_local_trace_uprobe()
1630 struct trace_uprobe *tu; in destroy_local_trace_uprobe() local
1632 tu = trace_uprobe_primary_from_call(event_call); in destroy_local_trace_uprobe()
1634 free_trace_uprobe(tu); in destroy_local_trace_uprobe()