Skip to content

Uprobe path#12336

Closed
olsajiri wants to merge 7 commits into
kernel-patches:bpf-next_basefrom
olsajiri:uprobe_path
Closed

Uprobe path#12336
olsajiri wants to merge 7 commits into
kernel-patches:bpf-next_basefrom
olsajiri:uprobe_path

Conversation

@olsajiri

@olsajiri olsajiri commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@olsajiri olsajiri force-pushed the uprobe_path branch 2 times, most recently from 9db9e66 to 649c363 Compare June 5, 2026 11:38
@kernel-patches-daemon-bpf kernel-patches-daemon-bpf Bot force-pushed the bpf-next_base branch 11 times, most recently from 4f5632b to 970af1b Compare June 7, 2026 19:43
Resolve the uprobe_multi user path with user_path_at() instead of copying
the string with strndup_user() and passing it to kern_path(). This removes
the temporary allocation and keeps the lookup logic in one helper.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
@olsajiri olsajiri force-pushed the uprobe_path branch 2 times, most recently from 9c1db67 to a696120 Compare June 9, 2026 08:12
olsajiri added 5 commits June 9, 2026 12:05
Allow uprobe_multi link to identify the target binary by an already
opened file descriptor.

Adding new BPF_F_UPROBE_MULTI_PATH_FD flag and the path_fd field for
the attr.link_create.uprobe_multi struct.

When the flag is set, we resolve the target from path_fd, without the
flag, we keep the existing string path behavior.

I don't see a use case for supporting O_PATH file descriptors, because
we need need to read the binary first to get probes offsets, so I'm
using the CLASS(fd, f), which fails for O_PATH fds.

Assisted-by: Codex:GPT-5.4
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Adding the path_fd field to struct bpf_link_create_opts and passing it
through kernel attr interface.

Assisted-by: Codex:GPT-5.4
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Add a uprobe_multi link API selftest that opens /proc/self/exe and passes
the resulting descriptor through opts.uprobe_multi.path_fd with
BPF_F_UPROBE_MULTI_PATH_FD set.

Assisted-by: Codex:GPT-5.4
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Adding tests to attach_api_fails suite to make sure we fail
wrong setup for path_fd usage.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
We verify info.uprobe_multi.flags against wrong kprobe-multi flag
(BPF_F_KPROBE_MULTI_RETURN). It's the same value as the correct
flag (BPF_F_UPROBE_MULTI_RETURN), so there's not functional change.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
@olsajiri olsajiri closed this Jun 9, 2026
@olsajiri olsajiri deleted the uprobe_path branch June 9, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant