selftests/bpf: Fix spurious test failures in core_retro selftest
authorAndrii Nakryiko <andriin@fb.com>
Fri, 31 Jul 2020 20:49:57 +0000 (13:49 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 2 Aug 2020 06:10:42 +0000 (23:10 -0700)
commitb5cc46cdff76cdfe2cb45ab2636d847efb1012cc
tree0ffeb2e274d95724b100c61ae7d1a9770a7ef259
parent5a6b1a206d1f399c9ea19173bd9a945a657f1fbf
selftests/bpf: Fix spurious test failures in core_retro selftest

core_retro selftest uses BPF program that's triggered on sys_enter
system-wide, but has no protection from some unrelated process doing syscall
while selftest is running. This leads to occasional test failures with
unexpected PIDs being returned. Fix that by filtering out all processes that
are not test_progs process.

Fixes: fcda189a5133 ("selftests/bpf: Add test relying only on CO-RE and no recent kernel features")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20200731204957.2047119-1-andriin@fb.com
tools/testing/selftests/bpf/prog_tests/core_retro.c
tools/testing/selftests/bpf/progs/test_core_retro.c