selftests/bpf: Use target-less SEC() definitions in various tests
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 28 Apr 2022 18:53:49 +0000 (11:53 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 28 Apr 2022 21:46:04 +0000 (23:46 +0200)
commit32c03c4954a03d46f603f94acac9d2705bd5c9c6
tree749d2f957655dcb434d8b2b502b95d18052258da
parentcc7d8f2c8ecc003a67d4cf189d04124461524a16
selftests/bpf: Use target-less SEC() definitions in various tests

Add new or modify existing SEC() definitions to be target-less and
validate that libbpf handles such program definitions correctly.

For kprobe/kretprobe we also add explicit test that generic
bpf_program__attach() works in cases when kprobe definition contains
proper target. It wasn't previously tested as selftests code always
explicitly specified the target regardless.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20220428185349.3799599-4-andrii@kernel.org
tools/testing/selftests/bpf/prog_tests/attach_probe.c
tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
tools/testing/selftests/bpf/progs/kprobe_multi.c
tools/testing/selftests/bpf/progs/test_attach_probe.c
tools/testing/selftests/bpf/progs/test_module_attach.c