Skip to content

Commit c7beb48

Browse files
Tao Chenanakryiko
authored andcommitted
bpf: Add cookie to tracing bpf_link_info
bpf_tramp_link includes cookie info, we can add it in bpf_link_info. Signed-off-by: Tao Chen <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent f3effef commit c7beb48

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

include/uapi/linux/bpf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6665,6 +6665,8 @@ struct bpf_link_info {
66656665
__u32 attach_type;
66666666
__u32 target_obj_id; /* prog_id for PROG_EXT, otherwise btf object id */
66676667
__u32 target_btf_id; /* BTF type id inside the object */
6668+
__u32 :32;
6669+
__u64 cookie;
66686670
} tracing;
66696671
struct {
66706672
__u64 cgroup_id;

kernel/bpf/syscall.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3416,6 +3416,7 @@ static int bpf_tracing_link_fill_link_info(const struct bpf_link *link,
34163416
container_of(link, struct bpf_tracing_link, link.link);
34173417

34183418
info->tracing.attach_type = tr_link->attach_type;
3419+
info->tracing.cookie = tr_link->link.cookie;
34193420
bpf_trampoline_unpack_key(tr_link->trampoline->key,
34203421
&info->tracing.target_obj_id,
34213422
&info->tracing.target_btf_id);

tools/include/uapi/linux/bpf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6665,6 +6665,8 @@ struct bpf_link_info {
66656665
__u32 attach_type;
66666666
__u32 target_obj_id; /* prog_id for PROG_EXT, otherwise btf object id */
66676667
__u32 target_btf_id; /* BTF type id inside the object */
6668+
__u32 :32;
6669+
__u64 cookie;
66686670
} tracing;
66696671
struct {
66706672
__u64 cgroup_id;

0 commit comments

Comments
 (0)