Lines Matching refs:tu

86 static int register_uprobe_event(struct trace_uprobe *tu);
87 static int unregister_uprobe_event(struct trace_uprobe *tu);
90 struct trace_uprobe *tu; member
210 base_addr = udd->bp_addr - udd->tu->offset; in translate_user_vaddr()
269 static inline bool is_ret_probe(struct trace_uprobe *tu) in is_ret_probe() argument
271 return tu->consumer.ret_handler != NULL; in is_ret_probe()
276 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_is_busy() local
278 return trace_probe_is_enabled(&tu->tp); in trace_uprobe_is_busy()
281 static bool trace_uprobe_match_command_head(struct trace_uprobe *tu, in trace_uprobe_match_command_head() argument
290 len = strlen(tu->filename); in trace_uprobe_match_command_head()
291 if (strncmp(tu->filename, argv[0], len) || argv[0][len] != ':') in trace_uprobe_match_command_head()
294 if (tu->ref_ctr_offset == 0) in trace_uprobe_match_command_head()
296 (int)(sizeof(void *) * 2), tu->offset); in trace_uprobe_match_command_head()
299 (int)(sizeof(void *) * 2), tu->offset, in trace_uprobe_match_command_head()
300 tu->ref_ctr_offset); in trace_uprobe_match_command_head()
306 return trace_probe_match_command_args(&tu->tp, argc, argv); in trace_uprobe_match_command_head()
312 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_match() local
314 return strcmp(trace_probe_name(&tu->tp), event) == 0 && in trace_uprobe_match()
315 (!system || strcmp(trace_probe_group_name(&tu->tp), system) == 0) && in trace_uprobe_match()
316 trace_uprobe_match_command_head(tu, argc, argv); in trace_uprobe_match()
337 struct trace_uprobe *tu; in alloc_trace_uprobe() local
340 tu = kzalloc(struct_size(tu, tp.args, nargs), GFP_KERNEL); in alloc_trace_uprobe()
341 if (!tu) in alloc_trace_uprobe()
344 ret = trace_probe_init(&tu->tp, event, group, true); in alloc_trace_uprobe()
348 dyn_event_init(&tu->devent, &trace_uprobe_ops); in alloc_trace_uprobe()
349 tu->consumer.handler = uprobe_dispatcher; in alloc_trace_uprobe()
351 tu->consumer.ret_handler = uretprobe_dispatcher; in alloc_trace_uprobe()
352 init_trace_uprobe_filter(tu->tp.event->filter); in alloc_trace_uprobe()
353 return tu; in alloc_trace_uprobe()
356 kfree(tu); in alloc_trace_uprobe()
361 static void free_trace_uprobe(struct trace_uprobe *tu) in free_trace_uprobe() argument
363 if (!tu) in free_trace_uprobe()
366 path_put(&tu->path); in free_trace_uprobe()
367 trace_probe_cleanup(&tu->tp); in free_trace_uprobe()
368 kfree(tu->filename); in free_trace_uprobe()
369 kfree(tu); in free_trace_uprobe()
375 struct trace_uprobe *tu; in find_probe_event() local
377 for_each_trace_uprobe(tu, pos) in find_probe_event()
378 if (strcmp(trace_probe_name(&tu->tp), event) == 0 && in find_probe_event()
379 strcmp(trace_probe_group_name(&tu->tp), group) == 0) in find_probe_event()
380 return tu; in find_probe_event()
386 static int unregister_trace_uprobe(struct trace_uprobe *tu) in unregister_trace_uprobe() argument
390 if (trace_probe_has_sibling(&tu->tp)) in unregister_trace_uprobe()
394 if (trace_event_dyn_busy(trace_probe_event_call(&tu->tp))) in unregister_trace_uprobe()
397 ret = unregister_uprobe_event(tu); in unregister_trace_uprobe()
402 dyn_event_remove(&tu->devent); in unregister_trace_uprobe()
403 trace_probe_unlink(&tu->tp); in unregister_trace_uprobe()
404 free_trace_uprobe(tu); in unregister_trace_uprobe()
439 static int append_trace_uprobe(struct trace_uprobe *tu, struct trace_uprobe *to) in append_trace_uprobe() argument
443 ret = trace_probe_compare_arg_type(&tu->tp, &to->tp); in append_trace_uprobe()
450 if (trace_uprobe_has_same_uprobe(to, tu)) { in append_trace_uprobe()
457 ret = trace_probe_append(&tu->tp, &to->tp); in append_trace_uprobe()
459 dyn_event_add(&tu->devent, trace_probe_event_call(&tu->tp)); in append_trace_uprobe()
491 static int register_trace_uprobe(struct trace_uprobe *tu) in register_trace_uprobe() argument
498 ret = validate_ref_ctr_offset(tu); in register_trace_uprobe()
503 old_tu = find_probe_event(trace_probe_name(&tu->tp), in register_trace_uprobe()
504 trace_probe_group_name(&tu->tp)); in register_trace_uprobe()
506 if (is_ret_probe(tu) != is_ret_probe(old_tu)) { in register_trace_uprobe()
511 ret = append_trace_uprobe(tu, old_tu); in register_trace_uprobe()
516 ret = register_uprobe_event(tu); in register_trace_uprobe()
526 dyn_event_add(&tu->devent, trace_probe_event_call(&tu->tp)); in register_trace_uprobe()
540 struct trace_uprobe *tu; in __trace_uprobe_create() local
675 tu = alloc_trace_uprobe(group, event, argc, is_return); in __trace_uprobe_create()
676 if (IS_ERR(tu)) { in __trace_uprobe_create()
677 ret = PTR_ERR(tu); in __trace_uprobe_create()
682 tu->offset = offset; in __trace_uprobe_create()
683 tu->ref_ctr_offset = ref_ctr_offset; in __trace_uprobe_create()
684 tu->path = path; in __trace_uprobe_create()
685 tu->filename = filename; in __trace_uprobe_create()
690 ret = traceprobe_parse_probe_arg(&tu->tp, i, argv[i], in __trace_uprobe_create()
696 ptype = is_ret_probe(tu) ? PROBE_PRINT_RETURN : PROBE_PRINT_NORMAL; in __trace_uprobe_create()
697 ret = traceprobe_set_print_fmt(&tu->tp, ptype); in __trace_uprobe_create()
701 ret = register_trace_uprobe(tu); in __trace_uprobe_create()
706 free_trace_uprobe(tu); in __trace_uprobe_create()
737 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_release() local
739 return unregister_trace_uprobe(tu); in trace_uprobe_release()
745 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_show() local
746 char c = is_ret_probe(tu) ? 'r' : 'p'; in trace_uprobe_show()
749 seq_printf(m, "%c:%s/%s %s:0x%0*lx", c, trace_probe_group_name(&tu->tp), in trace_uprobe_show()
750 trace_probe_name(&tu->tp), tu->filename, in trace_uprobe_show()
751 (int)(sizeof(void *) * 2), tu->offset); in trace_uprobe_show()
753 if (tu->ref_ctr_offset) in trace_uprobe_show()
754 seq_printf(m, "(0x%lx)", tu->ref_ctr_offset); in trace_uprobe_show()
756 for (i = 0; i < tu->tp.nr_args; i++) in trace_uprobe_show()
757 seq_printf(m, " %s=%s", tu->tp.args[i].name, tu->tp.args[i].comm); in trace_uprobe_show()
817 struct trace_uprobe *tu; in probes_profile_seq_show() local
822 tu = to_trace_uprobe(ev); in probes_profile_seq_show()
823 seq_printf(m, " %s %-44s %15lu\n", tu->filename, in probes_profile_seq_show()
824 trace_probe_name(&tu->tp), tu->nhit); in probes_profile_seq_show()
946 static void __uprobe_trace_func(struct trace_uprobe *tu, in __uprobe_trace_func() argument
956 struct trace_event_call *call = trace_probe_event_call(&tu->tp); in __uprobe_trace_func()
960 if (WARN_ON_ONCE(tu->tp.size + dsize > PAGE_SIZE)) in __uprobe_trace_func()
966 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in __uprobe_trace_func()
967 size = esize + tu->tp.size + dsize; in __uprobe_trace_func()
974 if (is_ret_probe(tu)) { in __uprobe_trace_func()
983 memcpy(data, ucb->buf, tu->tp.size + dsize); in __uprobe_trace_func()
989 static int uprobe_trace_func(struct trace_uprobe *tu, struct pt_regs *regs, in uprobe_trace_func() argument
994 if (is_ret_probe(tu)) in uprobe_trace_func()
998 trace_probe_for_each_link_rcu(link, &tu->tp) in uprobe_trace_func()
999 __uprobe_trace_func(tu, 0, regs, ucb, dsize, link->file); in uprobe_trace_func()
1005 static void uretprobe_trace_func(struct trace_uprobe *tu, unsigned long func, in uretprobe_trace_func() argument
1012 trace_probe_for_each_link_rcu(link, &tu->tp) in uretprobe_trace_func()
1013 __uprobe_trace_func(tu, func, regs, ucb, dsize, link->file); in uretprobe_trace_func()
1023 struct trace_uprobe *tu; in print_uprobe_event() local
1027 tu = trace_uprobe_primary_from_call( in print_uprobe_event()
1029 if (unlikely(!tu)) in print_uprobe_event()
1032 if (is_ret_probe(tu)) { in print_uprobe_event()
1034 trace_probe_name(&tu->tp), in print_uprobe_event()
1039 trace_probe_name(&tu->tp), in print_uprobe_event()
1044 if (print_probe_args(s, tu->tp.args, tu->tp.nr_args, data, entry) < 0) in print_uprobe_event()
1057 static int trace_uprobe_enable(struct trace_uprobe *tu, filter_func_t filter) in trace_uprobe_enable() argument
1061 tu->consumer.filter = filter; in trace_uprobe_enable()
1062 tu->inode = d_real_inode(tu->path.dentry); in trace_uprobe_enable()
1064 if (tu->ref_ctr_offset) in trace_uprobe_enable()
1065 ret = uprobe_register_refctr(tu->inode, tu->offset, in trace_uprobe_enable()
1066 tu->ref_ctr_offset, &tu->consumer); in trace_uprobe_enable()
1068 ret = uprobe_register(tu->inode, tu->offset, &tu->consumer); in trace_uprobe_enable()
1071 tu->inode = NULL; in trace_uprobe_enable()
1079 struct trace_uprobe *tu; in __probe_event_disable() local
1081 tu = container_of(tp, struct trace_uprobe, tp); in __probe_event_disable()
1082 WARN_ON(!uprobe_filter_is_empty(tu->tp.event->filter)); in __probe_event_disable()
1085 tu = container_of(pos, struct trace_uprobe, tp); in __probe_event_disable()
1086 if (!tu->inode) in __probe_event_disable()
1089 uprobe_unregister(tu->inode, tu->offset, &tu->consumer); in __probe_event_disable()
1090 tu->inode = NULL; in __probe_event_disable()
1098 struct trace_uprobe *tu; in probe_event_enable() local
1122 tu = container_of(tp, struct trace_uprobe, tp); in probe_event_enable()
1123 WARN_ON(!uprobe_filter_is_empty(tu->tp.event->filter)); in probe_event_enable()
1133 tu = container_of(pos, struct trace_uprobe, tp); in probe_event_enable()
1134 ret = trace_uprobe_enable(tu, filter); in probe_event_enable()
1184 struct trace_uprobe *tu; in uprobe_event_define_fields() local
1186 tu = trace_uprobe_primary_from_call(event_call); in uprobe_event_define_fields()
1187 if (unlikely(!tu)) in uprobe_event_define_fields()
1190 if (is_ret_probe(tu)) { in uprobe_event_define_fields()
1199 return traceprobe_define_arg_fields(event_call, size, &tu->tp); in uprobe_event_define_fields()
1279 struct trace_uprobe *tu; in uprobe_perf_close() local
1286 tu = container_of(tp, struct trace_uprobe, tp); in uprobe_perf_close()
1287 if (trace_uprobe_filter_remove(tu->tp.event->filter, event)) in uprobe_perf_close()
1291 tu = container_of(pos, struct trace_uprobe, tp); in uprobe_perf_close()
1292 ret = uprobe_apply(tu->inode, tu->offset, &tu->consumer, false); in uprobe_perf_close()
1304 struct trace_uprobe *tu; in uprobe_perf_open() local
1311 tu = container_of(tp, struct trace_uprobe, tp); in uprobe_perf_open()
1312 if (trace_uprobe_filter_add(tu->tp.event->filter, event)) in uprobe_perf_open()
1316 err = uprobe_apply(tu->inode, tu->offset, &tu->consumer, true); in uprobe_perf_open()
1330 struct trace_uprobe *tu; in uprobe_perf_filter() local
1333 tu = container_of(uc, struct trace_uprobe, consumer); in uprobe_perf_filter()
1334 filter = tu->tp.event->filter; in uprobe_perf_filter()
1343 static void __uprobe_perf_func(struct trace_uprobe *tu, in __uprobe_perf_func() argument
1347 struct trace_event_call *call = trace_probe_event_call(&tu->tp); in __uprobe_perf_func()
1364 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in __uprobe_perf_func()
1366 size = esize + tu->tp.size + dsize; in __uprobe_perf_func()
1380 if (is_ret_probe(tu)) { in __uprobe_perf_func()
1389 memcpy(data, ucb->buf, tu->tp.size + dsize); in __uprobe_perf_func()
1391 if (size - esize > tu->tp.size + dsize) { in __uprobe_perf_func()
1392 int len = tu->tp.size + dsize; in __uprobe_perf_func()
1404 static int uprobe_perf_func(struct trace_uprobe *tu, struct pt_regs *regs, in uprobe_perf_func() argument
1407 if (!uprobe_perf_filter(&tu->consumer, 0, current->mm)) in uprobe_perf_func()
1410 if (!is_ret_probe(tu)) in uprobe_perf_func()
1411 __uprobe_perf_func(tu, 0, regs, ucb, dsize); in uprobe_perf_func()
1415 static void uretprobe_perf_func(struct trace_uprobe *tu, unsigned long func, in uretprobe_perf_func() argument
1419 __uprobe_perf_func(tu, func, regs, ucb, dsize); in uretprobe_perf_func()
1428 struct trace_uprobe *tu; in bpf_get_uprobe_info() local
1431 tu = find_probe_event(pevent, group); in bpf_get_uprobe_info()
1433 tu = trace_uprobe_primary_from_call(event->tp_event); in bpf_get_uprobe_info()
1434 if (!tu) in bpf_get_uprobe_info()
1437 *fd_type = is_ret_probe(tu) ? BPF_FD_TYPE_URETPROBE in bpf_get_uprobe_info()
1439 *filename = tu->filename; in bpf_get_uprobe_info()
1440 *probe_offset = tu->offset; in bpf_get_uprobe_info()
1481 struct trace_uprobe *tu; in uprobe_dispatcher() local
1488 tu = container_of(con, struct trace_uprobe, consumer); in uprobe_dispatcher()
1489 tu->nhit++; in uprobe_dispatcher()
1491 udd.tu = tu; in uprobe_dispatcher()
1499 dsize = __get_data_size(&tu->tp, regs); in uprobe_dispatcher()
1500 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in uprobe_dispatcher()
1503 store_trace_args(ucb->buf, &tu->tp, regs, esize, dsize); in uprobe_dispatcher()
1505 if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) in uprobe_dispatcher()
1506 ret |= uprobe_trace_func(tu, regs, ucb, dsize); in uprobe_dispatcher()
1509 if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) in uprobe_dispatcher()
1510 ret |= uprobe_perf_func(tu, regs, ucb, dsize); in uprobe_dispatcher()
1519 struct trace_uprobe *tu; in uretprobe_dispatcher() local
1524 tu = container_of(con, struct trace_uprobe, consumer); in uretprobe_dispatcher()
1526 udd.tu = tu; in uretprobe_dispatcher()
1534 dsize = __get_data_size(&tu->tp, regs); in uretprobe_dispatcher()
1535 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in uretprobe_dispatcher()
1538 store_trace_args(ucb->buf, &tu->tp, regs, esize, dsize); in uretprobe_dispatcher()
1540 if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) in uretprobe_dispatcher()
1541 uretprobe_trace_func(tu, func, regs, ucb, dsize); in uretprobe_dispatcher()
1544 if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) in uretprobe_dispatcher()
1545 uretprobe_perf_func(tu, func, regs, ucb, dsize); in uretprobe_dispatcher()
1561 static inline void init_trace_event_call(struct trace_uprobe *tu) in init_trace_event_call() argument
1563 struct trace_event_call *call = trace_probe_event_call(&tu->tp); in init_trace_event_call()
1571 static int register_uprobe_event(struct trace_uprobe *tu) in register_uprobe_event() argument
1573 init_trace_event_call(tu); in register_uprobe_event()
1575 return trace_probe_register_event_call(&tu->tp); in register_uprobe_event()
1578 static int unregister_uprobe_event(struct trace_uprobe *tu) in unregister_uprobe_event() argument
1580 return trace_probe_unregister_event_call(&tu->tp); in unregister_uprobe_event()
1589 struct trace_uprobe *tu; in create_local_trace_uprobe() local
1607 tu = alloc_trace_uprobe(UPROBE_EVENT_SYSTEM, "DUMMY_EVENT", 0, in create_local_trace_uprobe()
1610 if (IS_ERR(tu)) { in create_local_trace_uprobe()
1612 (int)PTR_ERR(tu)); in create_local_trace_uprobe()
1614 return ERR_CAST(tu); in create_local_trace_uprobe()
1617 tu->offset = offs; in create_local_trace_uprobe()
1618 tu->path = path; in create_local_trace_uprobe()
1619 tu->ref_ctr_offset = ref_ctr_offset; in create_local_trace_uprobe()
1620 tu->filename = kstrdup(name, GFP_KERNEL); in create_local_trace_uprobe()
1621 init_trace_event_call(tu); in create_local_trace_uprobe()
1623 ptype = is_ret_probe(tu) ? PROBE_PRINT_RETURN : PROBE_PRINT_NORMAL; in create_local_trace_uprobe()
1624 if (traceprobe_set_print_fmt(&tu->tp, ptype) < 0) { in create_local_trace_uprobe()
1629 return trace_probe_event_call(&tu->tp); in create_local_trace_uprobe()
1631 free_trace_uprobe(tu); in create_local_trace_uprobe()
1637 struct trace_uprobe *tu; in destroy_local_trace_uprobe() local
1639 tu = trace_uprobe_primary_from_call(event_call); in destroy_local_trace_uprobe()
1641 free_trace_uprobe(tu); in destroy_local_trace_uprobe()