Pass a cookie along with BPF_LINK_CREATE requests. Add a bpf_cookie field to struct bpf_tracing_link to attach a cookie. The cookie of a bpf_tracing_link is available by calling bpf_get_attach_cookie when running the BPF program of the attached link. The value of a cookie will be set at bpf_tramp_run_ctx by the trampoline of the link.
Showing the changes to tools/include/uapi (1 of 8 files). Show all
Unified · Split
| @@ -1490,6 +1490,15 @@ union bpf_attr { · 1489 unmodified lines | |||
| 1490 | __aligned_u64 addrs; | 1490 | __aligned_u64 addrs; |
| 1491 | __aligned_u64 cookies; | 1491 | __aligned_u64 cookies; |
| 1492 | } kprobe_multi; | 1492 | } kprobe_multi; |
| 1493 | struct { | ||
| 1494 | /* this is overlaid with the target_btf_id above. */ | ||
| 1495 | __u32 target_btf_id; | ||
| 1496 | /* black box user-provided value passed through | ||
| 1497 | * to BPF program at the execution time and | ||
| 1498 | * accessible through bpf_get_attach_cookie() BPF helper | ||
| 1499 | */ | ||
| 1500 | __u64 cookie; | ||
| 1501 | } tracing; | ||
| 1493 | }; | 1502 | }; |
| 1494 | } link_create; | 1503 | } link_create; |
| 1495 | 1504 | ||