On Fri, Jul 17, 2020 at 12:52:10PM +0200, Toke Høiland-Jørgensen wrote: > > > It's a circular reference, obviously. > > Need to think through the complications and locking. > > Yup, will do so when I get back to this. One other implication of this > change: If we make the linked_prog completely dynamic you can no longer > do: > > link_fd = bpf_raw_tracepoint_open(prog); > close(link_fd); > link_fd = bpf_raw_tracepoint_open(prog): > > since after that close(), the original linked_prog will be gone. Unless > we always leave at least one linked_prog alive? But then we can't > guarantee that it's the target that was supplied on program load if it > was reattached. Is that acceptable? I think both options are fine. We can start with simple case where close would destroy the last link and if somebody complains we can keep 'at least one alive'. This is such low level implementation detail that I don't think any user can reliably count on it staying this way.