aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/unix_bpf.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <[email protected]>2021-08-15 07:06:07 +0000
committerDaniel Borkmann <[email protected]>2021-08-16 22:45:08 +0000
commit0a80cf67f34cab7c18d74c28bb59e131670dc268 (patch)
tree53373765c64d1f3510f9914543f29a5608529411 /net/unix/unix_bpf.c
parentselftests/bpf: Extract uprobe-related helpers into trace_helpers.{c,h} (diff)
downloadkernel-0a80cf67f34cab7c18d74c28bb59e131670dc268.tar.gz
kernel-0a80cf67f34cab7c18d74c28bb59e131670dc268.zip
selftests/bpf: Add bpf_cookie selftests for high-level APIs
Add selftest with few subtests testing proper bpf_cookie usage. Kprobe and uprobe subtests are pretty straightforward and just validate that the same BPF program attached with different bpf_cookie will be triggered with those different bpf_cookie values. Tracepoint subtest is a bit more interesting, as it is the only perf_event-based BPF hook that shares bpf_prog_array between multiple perf_events internally. This means that the same BPF program can't be attached to the same tracepoint multiple times. So we have 3 identical copies. This arrangement allows to test bpf_prog_array_copy()'s handling of bpf_prog_array list manipulation logic when programs are attached and detached. The test validates that bpf_cookie isn't mixed up and isn't lost during such list manipulations. Perf_event subtest validates that two BPF links can be created against the same perf_event (but not at the same time, only one BPF program can be attached to perf_event itself), and that for each we can specify different bpf_cookie value. 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/unix_bpf.c')
0 files changed, 0 insertions, 0 deletions