]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bpf: Add cookie to tracing bpf_link_info
authorTao Chen <chen.dylane@linux.dev>
Fri, 6 Jun 2025 16:58:14 +0000 (00:58 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 9 Jun 2025 23:45:17 +0000 (16:45 -0700)
bpf_tramp_link includes cookie info, we can add it in bpf_link_info.

Signed-off-by: Tao Chen <chen.dylane@linux.dev>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250606165818.3394397-1-chen.dylane@linux.dev
include/uapi/linux/bpf.h
kernel/bpf/syscall.c
tools/include/uapi/linux/bpf.h

index 25e9cf92ffaf357ed88284b19f6d59be90b9a651..194ed9891b40370abefdca714bf47056d3aa864a 100644 (file)
@@ -6665,6 +6665,8 @@ struct bpf_link_info {
                        __u32 attach_type;
                        __u32 target_obj_id; /* prog_id for PROG_EXT, otherwise btf object id */
                        __u32 target_btf_id; /* BTF type id inside the object */
+                       __u32 :32;
+                       __u64 cookie;
                } tracing;
                struct {
                        __u64 cgroup_id;
index 0c267f37775b31963d0eb8f52c7697cc6903c63d..85e080c3333df7a85b0ccb9cfd9fcef07a35ee77 100644 (file)
@@ -3416,6 +3416,7 @@ static int bpf_tracing_link_fill_link_info(const struct bpf_link *link,
                container_of(link, struct bpf_tracing_link, link.link);
 
        info->tracing.attach_type = tr_link->attach_type;
+       info->tracing.cookie = tr_link->link.cookie;
        bpf_trampoline_unpack_key(tr_link->trampoline->key,
                                  &info->tracing.target_obj_id,
                                  &info->tracing.target_btf_id);
index 25e9cf92ffaf357ed88284b19f6d59be90b9a651..194ed9891b40370abefdca714bf47056d3aa864a 100644 (file)
@@ -6665,6 +6665,8 @@ struct bpf_link_info {
                        __u32 attach_type;
                        __u32 target_obj_id; /* prog_id for PROG_EXT, otherwise btf object id */
                        __u32 target_btf_id; /* BTF type id inside the object */
+                       __u32 :32;
+                       __u64 cookie;
                } tracing;
                struct {
                        __u64 cgroup_id;