]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
libbpf: Add path_fd to struct bpf_link_create_opts
authorJiri Olsa <jolsa@kernel.org>
Thu, 11 Jun 2026 11:42:27 +0000 (13:42 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 15 Jun 2026 00:24:25 +0000 (17:24 -0700)
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>
Link: https://lore.kernel.org/r/20260611114230.950379-5-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/bpf.c
tools/lib/bpf/bpf.h

index f37e3416f61a57af13fb1c4b60d4ba809669476f..96819c082c772d6d9aec65c20f6d594cf895f8d8 100644 (file)
@@ -842,6 +842,7 @@ int bpf_link_create(int prog_fd, int target_fd,
                attr.link_create.uprobe_multi.ref_ctr_offsets = ptr_to_u64(OPTS_GET(opts, uprobe_multi.ref_ctr_offsets, 0));
                attr.link_create.uprobe_multi.cookies = ptr_to_u64(OPTS_GET(opts, uprobe_multi.cookies, 0));
                attr.link_create.uprobe_multi.pid = OPTS_GET(opts, uprobe_multi.pid, 0);
+               attr.link_create.uprobe_multi.path_fd = OPTS_GET(opts, uprobe_multi.path_fd, 0);
                if (!OPTS_ZEROED(opts, uprobe_multi))
                        return libbpf_err(-EINVAL);
                break;
index 012354131cf66867977baa89bdcbea916ee5a0b9..7534a593edae213e0d0c93155fda1df6b9db06e6 100644 (file)
@@ -444,6 +444,7 @@ struct bpf_link_create_opts {
                        const unsigned long *ref_ctr_offsets;
                        const __u64 *cookies;
                        __u32 pid;
+                       __u32 path_fd;
                } uprobe_multi;
                struct {
                        __u64 cookie;
@@ -477,7 +478,7 @@ struct bpf_link_create_opts {
        };
        size_t :0;
 };
-#define bpf_link_create_opts__last_field uprobe_multi.pid
+#define bpf_link_create_opts__last_field uprobe_multi.path_fd
 
 LIBBPF_API int bpf_link_create(int prog_fd, int target_fd,
                               enum bpf_attach_type attach_type,