History

bpf, x86: Attach a cookie to fentry/fexit/fmod_ret/lsm.

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.

Kui-Feng Lee committed 4 years ago

Commit 2fcc8241 parent e384c7b8 files · +69 −8Browse files

Showing the changes to include/uapi (1 of 8 files). Show all

Unified · Split

include/uapi/linux/bpf.h+9−0
@@ -1490,6 +1490,15 @@ union bpf_attr { · 1489 unmodified lines
14901490 __aligned_u64 addrs;
14911491 __aligned_u64 cookies;
14921492 } 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;
14931502 };
14941503 } link_create;
14951504