linux-stable/tools
Andrii Nakryiko 0a80cf67f3 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 <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20210815070609.987780-15-andrii@kernel.org
2021-08-17 00:45:08 +02:00
..
accounting
arch tools headers UAPI: Sync files changed by the memfd_secret new syscall 2021-07-14 10:05:35 -03:00
bootconfig bootconfig: Share the checksum function with tools 2021-06-10 13:41:26 -04:00
bpf Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2021-07-31 11:23:26 -07:00
build tools build: Fix quiet cmd indentation 2021-05-17 12:10:03 +09:00
cgroup tools/cgroup/slabinfo.py: updated to work on current kernel 2021-04-23 14:42:40 -07:00
debugging tools: Fix "the the" in a message in kernel-chktaint 2021-06-13 17:01:17 -06:00
edid
firewire
firmware
gpio tools: gpio-utils: fix various kernel-doc warnings 2021-03-26 14:56:19 +01:00
hv
iio iio: event_monitor: Enable events before monitoring 2021-03-25 19:13:52 +00:00
include bpf: Add bpf_get_attach_cookie() BPF helper to access bpf_cookie value 2021-08-17 00:45:07 +02:00
io_uring
kvm/kvm_stat tools/kvm_stat: Fix documentation typo 2021-05-07 06:06:22 -04:00
laptop
leds
lib libbpf: Add bpf_cookie to perf_event, kprobe, uprobe, and tp attach APIs 2021-08-17 00:45:08 +02:00
memory-model tools/memory-model: Fix smp_mb__after_spinlock() spelling 2021-05-10 16:27:20 -07:00
objtool A single ELF format fix for a section flags mismatch bug that breaks 2021-06-28 11:35:55 -07:00
pci
pcmcia
perf Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-08-05 15:08:47 -07:00
power tools/power/x86/intel-speed-select: v1.10 release 2021-06-18 15:29:32 +02:00
rcu tools/rcu: Add drgn script to dump number of RCU callbacks 2021-05-10 15:39:19 -07:00
scripts tools build: Fix quiet cmd indentation 2021-05-17 12:10:03 +09:00
spi spi: tools: make a symbolic link to the header file spi.h 2021-04-22 16:30:39 +01:00
testing selftests/bpf: Add bpf_cookie selftests for high-level APIs 2021-08-17 00:45:08 +02:00
thermal/tmon tools: do not include scripts/Kbuild.include 2021-04-25 05:26:13 +09:00
time
tracing
usb treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
virtio
vm tools/vm/page_owner_sort.c: check malloc() return 2021-06-29 10:53:47 -07:00
wmi
Makefile