> On Mon, Jan 31, 2022 at 04:49:36PM -0800, Andrii Nakryiko wrote: > On Thu, Jan 27, 2022 at 12:27 AM Dmitrii Dolgov <9erthalion6@xxxxxxxxx> wrote: > > > > Commit 82e6b1eee6a8 ("bpf: Allow to specify user-provided bpf_cookie for > > BPF perf links") introduced the concept of user specified bpf_cookie, > > which could be accessed by BPF programs using bpf_get_attach_cookie(). > > For troubleshooting purposes it is convenient to expose bpf_cookie via > > bpftool as well, so there is no need to meddle with the target BPF > > program itself. > > > > $ bpftool perf > > pid 83 fd 9: prog_id 5 bpf_cookie: 123 tracepoint sched_process_exec > > > > I think a more natural place to expose this would be in `bpftool link > show` output, as bpf_cookie is actually per attachment (i.e., link) > information (not a per-program). We'll need to anticipate multi-attach > use cases (e.g., multi-attach kprobe and fentry programs we are > discussing at the moment). Yes, makes sense. I guess it will require extending bpf_link & bpf_link_info to store a cookie on attachment and carry it around, otherwise I don't see other ways to extract it. Is that fine, or it's not supposed to be extendable (as with bpf_task_fd_query API)?