diff options
author | Andrii Nakryiko <[email protected]> | 2021-08-15 00:06:02 -0700 |
---|---|---|
committer | Daniel Borkmann <[email protected]> | 2021-08-17 00:45:08 +0200 |
commit | 668ace0ea5ab5acdb33cff0b66fcd8f41c16a0b0 (patch) | |
tree | 3931bd0dc283f65780b202d19fe891ee3ef107cc /net/unix/af_unix.c | |
parent | d88b71d4a91669f0b06693cd094dcd68f67ac58d (diff) |
libbpf: Use BPF perf link when supported by kernel
Detect kernel support for BPF perf link and prefer it when attaching to
perf_event, tracepoint, kprobe/uprobe. Underlying perf_event FD will be kept
open until BPF link is destroyed, at which point both perf_event FD and BPF
link FD will be closed.
This preserves current behavior in which perf_event FD is open for the
duration of bpf_link's lifetime and user is able to "disconnect" bpf_link from
underlying FD (with bpf_link__disconnect()), so that bpf_link__destroy()
doesn't close underlying perf_event FD.When BPF perf link is used, disconnect
will keep both perf_event and bpf_link FDs open, so it will be up to
(advanced) user to close them. This approach is demonstrated in bpf_cookie.c
selftests, added in this patch set.
Signed-off-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'net/unix/af_unix.c')
0 files changed, 0 insertions, 0 deletions