On Sat, Sep 19, 2020 at 4:50 AM Toke Høiland-Jørgensen <toke@xxxxxxxxxx> wrote: > > From: Toke Høiland-Jørgensen <toke@xxxxxxxxxx> > > This enables support for attaching freplace programs to multiple attach > points. It does this by amending the UAPI for bpf_link_Create with a target > btf ID that can be used to supply the new attachment point along with the > target program fd. The target must be compatible with the target that was > supplied at program load time. > > The implementation reuses the checks that were factored out of > check_attach_btf_id() to ensure compatibility between the BTF types of the > old and new attachment. If these match, a new bpf_tracing_link will be > created for the new attach target, allowing multiple attachments to > co-exist simultaneously. > > The code could theoretically support multiple-attach of other types of > tracing programs as well, but since I don't have a use case for any of > those, there is no API support for doing so. > > Signed-off-by: Toke Høiland-Jørgensen <toke@xxxxxxxxxx> > --- Acked-by: Andrii Nakryiko <andriin@xxxxxx> > include/linux/bpf.h | 2 + > include/uapi/linux/bpf.h | 9 +++- > kernel/bpf/syscall.c | 102 +++++++++++++++++++++++++++++++++------- > kernel/bpf/verifier.c | 9 ++++ > tools/include/uapi/linux/bpf.h | 9 +++- > 5 files changed, 108 insertions(+), 23 deletions(-) > [...]