After commit 68ca5d4eebb8 ("bpf: support BPF cookie in raw tracepoint (raw_tp, tp_btf) programs"), we can show the cookie in bpf_link_info like kprobe etc.
Unified · Split
| @@ -6651,6 +6651,8 @@ struct bpf_link_info { · 6650 unmodified lines | |||
| 6651 | struct { | 6651 | struct { |
| 6652 | __aligned_u64 tp_name; /* in/out: tp_name buffer ptr */ | 6652 | __aligned_u64 tp_name; /* in/out: tp_name buffer ptr */ |
| 6653 | __u32 tp_name_len; /* in/out: tp_name buffer len */ | 6653 | __u32 tp_name_len; /* in/out: tp_name buffer len */ |
| 6654 | __u32 :32; | ||
| 6655 | __u64 cookie; | ||
| 6654 | } raw_tracepoint; | 6656 | } raw_tracepoint; |
| 6655 | struct { | 6657 | struct { |
| 6656 | __u32 attach_type; | 6658 | __u32 attach_type; |
| @@ -3688,6 +3688,7 @@ static int bpf_raw_tp_link_fill_link_info(const struct bpf_link *link, · 3687 unmodified lines | |||
| 3688 | return -EINVAL; | 3688 | return -EINVAL; |
| 3689 | 3689 | ||
| 3690 | info->raw_tracepoint.tp_name_len = tp_len + 1; | 3690 | info->raw_tracepoint.tp_name_len = tp_len + 1; |
| 3691 | info->raw_tracepoint.cookie = raw_tp_link->cookie; | ||
| 3691 | 3692 | ||
| 3692 | if (!ubuf) | 3693 | if (!ubuf) |
| 3693 | return 0; | 3694 | return 0; |
| @@ -6651,6 +6651,8 @@ struct bpf_link_info { · 6650 unmodified lines | |||
| 6651 | struct { | 6651 | struct { |
| 6652 | __aligned_u64 tp_name; /* in/out: tp_name buffer ptr */ | 6652 | __aligned_u64 tp_name; /* in/out: tp_name buffer ptr */ |
| 6653 | __u32 tp_name_len; /* in/out: tp_name buffer len */ | 6653 | __u32 tp_name_len; /* in/out: tp_name buffer len */ |
| 6654 | __u32 :32; | ||
| 6655 | __u64 cookie; | ||
| 6654 | } raw_tracepoint; | 6656 | } raw_tracepoint; |
| 6655 | struct { | 6657 | struct { |
| 6656 | __u32 attach_type; | 6658 | __u32 attach_type; |