Lines Matching refs:tu

88 static int register_uprobe_event(struct trace_uprobe *tu);
89 static int unregister_uprobe_event(struct trace_uprobe *tu);
208 base_addr = udd->bp_addr - udd->tu->offset; in translate_user_vaddr()
264 static inline bool is_ret_probe(struct trace_uprobe *tu) in is_ret_probe() argument
266 return tu->consumer.ret_handler != NULL; in is_ret_probe()
271 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_is_busy() local
273 return trace_probe_is_enabled(&tu->tp); in trace_uprobe_is_busy()
276 static bool trace_uprobe_match_command_head(struct trace_uprobe *tu, in trace_uprobe_match_command_head() argument
285 len = strlen(tu->filename); in trace_uprobe_match_command_head()
286 if (strncmp(tu->filename, argv[0], len) || argv[0][len] != ':') in trace_uprobe_match_command_head()
289 if (tu->ref_ctr_offset == 0) in trace_uprobe_match_command_head()
291 (int)(sizeof(void *) * 2), tu->offset); in trace_uprobe_match_command_head()
294 (int)(sizeof(void *) * 2), tu->offset, in trace_uprobe_match_command_head()
295 tu->ref_ctr_offset); in trace_uprobe_match_command_head()
301 return trace_probe_match_command_args(&tu->tp, argc, argv); in trace_uprobe_match_command_head()
307 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_match() local
310 strcmp(trace_probe_name(&tu->tp), event) == 0) && in trace_uprobe_match()
311 (!system || strcmp(trace_probe_group_name(&tu->tp), system) == 0) && in trace_uprobe_match()
312 trace_uprobe_match_command_head(tu, argc, argv); in trace_uprobe_match()
333 struct trace_uprobe *tu; in alloc_trace_uprobe() local
336 tu = kzalloc(struct_size(tu, tp.args, nargs), GFP_KERNEL); in alloc_trace_uprobe()
337 if (!tu) in alloc_trace_uprobe()
340 ret = trace_probe_init(&tu->tp, event, group, true); in alloc_trace_uprobe()
344 dyn_event_init(&tu->devent, &trace_uprobe_ops); in alloc_trace_uprobe()
345 tu->consumer.handler = uprobe_dispatcher; in alloc_trace_uprobe()
347 tu->consumer.ret_handler = uretprobe_dispatcher; in alloc_trace_uprobe()
348 init_trace_uprobe_filter(tu->tp.event->filter); in alloc_trace_uprobe()
349 return tu; in alloc_trace_uprobe()
352 kfree(tu); in alloc_trace_uprobe()
357 static void free_trace_uprobe(struct trace_uprobe *tu) in free_trace_uprobe() argument
359 if (!tu) in free_trace_uprobe()
362 path_put(&tu->path); in free_trace_uprobe()
363 trace_probe_cleanup(&tu->tp); in free_trace_uprobe()
364 kfree(tu->filename); in free_trace_uprobe()
365 kfree(tu); in free_trace_uprobe()
371 struct trace_uprobe *tu; in find_probe_event() local
373 for_each_trace_uprobe(tu, pos) in find_probe_event()
374 if (strcmp(trace_probe_name(&tu->tp), event) == 0 && in find_probe_event()
375 strcmp(trace_probe_group_name(&tu->tp), group) == 0) in find_probe_event()
376 return tu; in find_probe_event()
382 static int unregister_trace_uprobe(struct trace_uprobe *tu) in unregister_trace_uprobe() argument
386 if (trace_probe_has_sibling(&tu->tp)) in unregister_trace_uprobe()
390 if (trace_event_dyn_busy(trace_probe_event_call(&tu->tp))) in unregister_trace_uprobe()
393 ret = unregister_uprobe_event(tu); in unregister_trace_uprobe()
398 dyn_event_remove(&tu->devent); in unregister_trace_uprobe()
399 trace_probe_unlink(&tu->tp); in unregister_trace_uprobe()
400 free_trace_uprobe(tu); in unregister_trace_uprobe()
433 static int append_trace_uprobe(struct trace_uprobe *tu, struct trace_uprobe *to) in append_trace_uprobe() argument
437 ret = trace_probe_compare_arg_type(&tu->tp, &to->tp); in append_trace_uprobe()
444 if (trace_uprobe_has_same_uprobe(to, tu)) { in append_trace_uprobe()
451 ret = trace_probe_append(&tu->tp, &to->tp); in append_trace_uprobe()
453 dyn_event_add(&tu->devent, trace_probe_event_call(&tu->tp)); in append_trace_uprobe()
485 static int register_trace_uprobe(struct trace_uprobe *tu) in register_trace_uprobe() argument
492 ret = validate_ref_ctr_offset(tu); in register_trace_uprobe()
497 old_tu = find_probe_event(trace_probe_name(&tu->tp), in register_trace_uprobe()
498 trace_probe_group_name(&tu->tp)); in register_trace_uprobe()
500 if (is_ret_probe(tu) != is_ret_probe(old_tu)) { in register_trace_uprobe()
505 ret = append_trace_uprobe(tu, old_tu); in register_trace_uprobe()
510 ret = register_uprobe_event(tu); in register_trace_uprobe()
520 dyn_event_add(&tu->devent, trace_probe_event_call(&tu->tp)); in register_trace_uprobe()
534 struct trace_uprobe *tu; in __trace_uprobe_create() local
671 tu = alloc_trace_uprobe(group, event, argc, is_return); in __trace_uprobe_create()
672 if (IS_ERR(tu)) { in __trace_uprobe_create()
673 ret = PTR_ERR(tu); in __trace_uprobe_create()
678 tu->offset = offset; in __trace_uprobe_create()
679 tu->ref_ctr_offset = ref_ctr_offset; in __trace_uprobe_create()
680 tu->path = path; in __trace_uprobe_create()
681 tu->filename = filename; in __trace_uprobe_create()
690 ret = traceprobe_parse_probe_arg(&tu->tp, i, argv[i], &ctx); 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
955 struct trace_event_call *call = trace_probe_event_call(&tu->tp); in __uprobe_trace_func()
959 if (WARN_ON_ONCE(tu->tp.size + dsize > PAGE_SIZE)) in __uprobe_trace_func()
965 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in __uprobe_trace_func()
966 size = esize + tu->tp.size + dsize; in __uprobe_trace_func()
971 if (is_ret_probe(tu)) { in __uprobe_trace_func()
980 memcpy(data, ucb->buf, tu->tp.size + dsize); in __uprobe_trace_func()
986 static int uprobe_trace_func(struct trace_uprobe *tu, struct pt_regs *regs, in uprobe_trace_func() argument
991 if (is_ret_probe(tu)) in uprobe_trace_func()
995 trace_probe_for_each_link_rcu(link, &tu->tp) in uprobe_trace_func()
996 __uprobe_trace_func(tu, 0, regs, ucb, dsize, link->file); in uprobe_trace_func()
1002 static void uretprobe_trace_func(struct trace_uprobe *tu, unsigned long func, in uretprobe_trace_func() argument
1009 trace_probe_for_each_link_rcu(link, &tu->tp) in uretprobe_trace_func()
1010 __uprobe_trace_func(tu, func, regs, ucb, dsize, link->file); in uretprobe_trace_func()
1020 struct trace_uprobe *tu; in print_uprobe_event() local
1024 tu = trace_uprobe_primary_from_call( in print_uprobe_event()
1026 if (unlikely(!tu)) in print_uprobe_event()
1029 if (is_ret_probe(tu)) { in print_uprobe_event()
1031 trace_probe_name(&tu->tp), in print_uprobe_event()
1036 trace_probe_name(&tu->tp), in print_uprobe_event()
1041 if (trace_probe_print_args(s, tu->tp.args, tu->tp.nr_args, data, entry) < 0) in print_uprobe_event()
1054 static int trace_uprobe_enable(struct trace_uprobe *tu, filter_func_t filter) in trace_uprobe_enable() argument
1058 tu->consumer.filter = filter; in trace_uprobe_enable()
1059 tu->inode = d_real_inode(tu->path.dentry); in trace_uprobe_enable()
1061 if (tu->ref_ctr_offset) in trace_uprobe_enable()
1062 ret = uprobe_register_refctr(tu->inode, tu->offset, in trace_uprobe_enable()
1063 tu->ref_ctr_offset, &tu->consumer); in trace_uprobe_enable()
1065 ret = uprobe_register(tu->inode, tu->offset, &tu->consumer); in trace_uprobe_enable()
1068 tu->inode = NULL; in trace_uprobe_enable()
1075 struct trace_uprobe *tu; in __probe_event_disable() local
1077 tu = container_of(tp, struct trace_uprobe, tp); in __probe_event_disable()
1078 WARN_ON(!uprobe_filter_is_empty(tu->tp.event->filter)); in __probe_event_disable()
1080 list_for_each_entry(tu, trace_probe_probe_list(tp), tp.list) { 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()
1127 list_for_each_entry(tu, trace_probe_probe_list(tp), tp.list) { in probe_event_enable()
1128 ret = trace_uprobe_enable(tu, filter); in probe_event_enable()
1178 struct trace_uprobe *tu; in uprobe_event_define_fields() local
1180 tu = trace_uprobe_primary_from_call(event_call); in uprobe_event_define_fields()
1181 if (unlikely(!tu)) in uprobe_event_define_fields()
1184 if (is_ret_probe(tu)) { in uprobe_event_define_fields()
1193 return traceprobe_define_arg_fields(event_call, size, &tu->tp); in uprobe_event_define_fields()
1273 struct trace_uprobe *tu; in uprobe_perf_close() local
1280 tu = container_of(tp, struct trace_uprobe, tp); in uprobe_perf_close()
1281 if (trace_uprobe_filter_remove(tu->tp.event->filter, event)) in uprobe_perf_close()
1284 list_for_each_entry(tu, trace_probe_probe_list(tp), tp.list) { in uprobe_perf_close()
1285 ret = uprobe_apply(tu->inode, tu->offset, &tu->consumer, false); in uprobe_perf_close()
1297 struct trace_uprobe *tu; in uprobe_perf_open() local
1304 tu = container_of(tp, struct trace_uprobe, tp); in uprobe_perf_open()
1305 if (trace_uprobe_filter_add(tu->tp.event->filter, event)) in uprobe_perf_open()
1308 list_for_each_entry(tu, trace_probe_probe_list(tp), tp.list) { in uprobe_perf_open()
1309 err = uprobe_apply(tu->inode, tu->offset, &tu->consumer, true); in uprobe_perf_open()
1323 struct trace_uprobe *tu; in uprobe_perf_filter() local
1326 tu = container_of(uc, struct trace_uprobe, consumer); in uprobe_perf_filter()
1327 filter = tu->tp.event->filter; in uprobe_perf_filter()
1336 static void __uprobe_perf_func(struct trace_uprobe *tu, in __uprobe_perf_func() argument
1340 struct trace_event_call *call = trace_probe_event_call(&tu->tp); in __uprobe_perf_func()
1357 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in __uprobe_perf_func()
1359 size = esize + tu->tp.size + dsize; in __uprobe_perf_func()
1373 if (is_ret_probe(tu)) { in __uprobe_perf_func()
1382 memcpy(data, ucb->buf, tu->tp.size + dsize); in __uprobe_perf_func()
1384 if (size - esize > tu->tp.size + dsize) { in __uprobe_perf_func()
1385 int len = tu->tp.size + dsize; in __uprobe_perf_func()
1397 static int uprobe_perf_func(struct trace_uprobe *tu, struct pt_regs *regs, in uprobe_perf_func() argument
1400 if (!uprobe_perf_filter(&tu->consumer, 0, current->mm)) in uprobe_perf_func()
1403 if (!is_ret_probe(tu)) in uprobe_perf_func()
1404 __uprobe_perf_func(tu, 0, regs, ucb, dsize); in uprobe_perf_func()
1408 static void uretprobe_perf_func(struct trace_uprobe *tu, unsigned long func, in uretprobe_perf_func() argument
1412 __uprobe_perf_func(tu, func, regs, ucb, dsize); in uretprobe_perf_func()
1421 struct trace_uprobe *tu; in bpf_get_uprobe_info() local
1424 tu = find_probe_event(pevent, group); in bpf_get_uprobe_info()
1426 tu = trace_uprobe_primary_from_call(event->tp_event); in bpf_get_uprobe_info()
1427 if (!tu) in bpf_get_uprobe_info()
1430 *fd_type = is_ret_probe(tu) ? BPF_FD_TYPE_URETPROBE in bpf_get_uprobe_info()
1432 *filename = tu->filename; in bpf_get_uprobe_info()
1433 *probe_offset = tu->offset; in bpf_get_uprobe_info()
1475 struct trace_uprobe *tu; in uprobe_dispatcher() local
1482 tu = container_of(con, struct trace_uprobe, consumer); in uprobe_dispatcher()
1483 tu->nhit++; in uprobe_dispatcher()
1485 udd.tu = tu; in uprobe_dispatcher()
1493 dsize = __get_data_size(&tu->tp, regs); in uprobe_dispatcher()
1494 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in uprobe_dispatcher()
1497 store_trace_args(ucb->buf, &tu->tp, regs, esize, dsize); in uprobe_dispatcher()
1499 if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) in uprobe_dispatcher()
1500 ret |= uprobe_trace_func(tu, regs, ucb, dsize); in uprobe_dispatcher()
1503 if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) in uprobe_dispatcher()
1504 ret |= uprobe_perf_func(tu, regs, ucb, dsize); in uprobe_dispatcher()
1513 struct trace_uprobe *tu; in uretprobe_dispatcher() local
1518 tu = container_of(con, struct trace_uprobe, consumer); in uretprobe_dispatcher()
1520 udd.tu = tu; in uretprobe_dispatcher()
1528 dsize = __get_data_size(&tu->tp, regs); in uretprobe_dispatcher()
1529 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in uretprobe_dispatcher()
1532 store_trace_args(ucb->buf, &tu->tp, regs, esize, dsize); in uretprobe_dispatcher()
1534 if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) in uretprobe_dispatcher()
1535 uretprobe_trace_func(tu, func, regs, ucb, dsize); in uretprobe_dispatcher()
1538 if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) in uretprobe_dispatcher()
1539 uretprobe_perf_func(tu, func, regs, ucb, dsize); in uretprobe_dispatcher()
1555 static inline void init_trace_event_call(struct trace_uprobe *tu) in init_trace_event_call() argument
1557 struct trace_event_call *call = trace_probe_event_call(&tu->tp); in init_trace_event_call()
1565 static int register_uprobe_event(struct trace_uprobe *tu) in register_uprobe_event() argument
1567 init_trace_event_call(tu); in register_uprobe_event()
1569 return trace_probe_register_event_call(&tu->tp); in register_uprobe_event()
1572 static int unregister_uprobe_event(struct trace_uprobe *tu) in unregister_uprobe_event() argument
1574 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 if (!tu->filename) { in create_local_trace_uprobe()
1620 init_trace_event_call(tu); in create_local_trace_uprobe()
1622 ptype = is_ret_probe(tu) ? PROBE_PRINT_RETURN : PROBE_PRINT_NORMAL; in create_local_trace_uprobe()
1623 if (traceprobe_set_print_fmt(&tu->tp, ptype) < 0) { in create_local_trace_uprobe()
1628 return trace_probe_event_call(&tu->tp); in create_local_trace_uprobe()
1630 free_trace_uprobe(tu); in create_local_trace_uprobe()
1636 struct trace_uprobe *tu; in destroy_local_trace_uprobe() local
1638 tu = trace_uprobe_primary_from_call(event_call); in destroy_local_trace_uprobe()
1640 free_trace_uprobe(tu); in destroy_local_trace_uprobe()