Commit 82315333 authored by Jiri Olsa's avatar Jiri Olsa Committed by Andrii Nakryiko
Browse files

bpf: Add support to retrieve ref_ctr_offset for uprobe perf link



Adding support to retrieve ref_ctr_offset for uprobe perf link,
which got somehow omitted from the initial uprobe link info changes.

Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Acked-by: default avatarYafang Shao <laoar.shao@gmail.com>
Link: https://lore.kernel.org/bpf/20250509153539.779599-2-jolsa@kernel.org
parent cb4a1192
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6724,6 +6724,7 @@ struct bpf_link_info {
					__u32 name_len;
					__u32 offset; /* offset from file_name */
					__u64 cookie;
					__u64 ref_ctr_offset;
				} uprobe; /* BPF_PERF_EVENT_UPROBE, BPF_PERF_EVENT_URETPROBE */
				struct {
					__aligned_u64 func_name; /* in/out */
+3 −2
Original line number Diff line number Diff line
@@ -3800,14 +3800,14 @@ static int bpf_perf_link_fill_kprobe(const struct perf_event *event,
static int bpf_perf_link_fill_uprobe(const struct perf_event *event,
				     struct bpf_link_info *info)
{
	u64 ref_ctr_offset, offset;
	char __user *uname;
	u64 addr, offset;
	u32 ulen, type;
	int err;

	uname = u64_to_user_ptr(info->perf_event.uprobe.file_name);
	ulen = info->perf_event.uprobe.name_len;
	err = bpf_perf_link_fill_common(event, uname, &ulen, &offset, &addr,
	err = bpf_perf_link_fill_common(event, uname, &ulen, &offset, &ref_ctr_offset,
					&type, NULL);
	if (err)
		return err;
@@ -3819,6 +3819,7 @@ static int bpf_perf_link_fill_uprobe(const struct perf_event *event,
	info->perf_event.uprobe.name_len = ulen;
	info->perf_event.uprobe.offset = offset;
	info->perf_event.uprobe.cookie = event->bpf_cookie;
	info->perf_event.uprobe.ref_ctr_offset = ref_ctr_offset;
	return 0;
}
#endif
+1 −1
Original line number Diff line number Diff line
@@ -1489,7 +1489,7 @@ int bpf_get_uprobe_info(const struct perf_event *event, u32 *fd_type,
				    : BPF_FD_TYPE_UPROBE;
	*filename = tu->filename;
	*probe_offset = tu->offset;
	*probe_addr = 0;
	*probe_addr = tu->ref_ctr_offset;
	return 0;
}
#endif	/* CONFIG_PERF_EVENTS */
+1 −0
Original line number Diff line number Diff line
@@ -6724,6 +6724,7 @@ struct bpf_link_info {
					__u32 name_len;
					__u32 offset; /* offset from file_name */
					__u64 cookie;
					__u64 ref_ctr_offset;
				} uprobe; /* BPF_PERF_EVENT_UPROBE, BPF_PERF_EVENT_URETPROBE */
				struct {
					__aligned_u64 func_name; /* in/out */