[PATCH bpf-next] selftests/bpf: Expect at least one kprobe miss in missed/perf_kprobe

From: Qiliang Yuan

Date: Thu Oct 08 2026 - 21:49:29 EST


missed_kprobe attaches test1 to bpf_fentry_test1 and test2 to
bpf_kfunc_common_test, which test1 calls. test_missed_perf_kprobe()
expects the kprobe of test2 to miss exactly one run, the one test1
triggers, since kprobes don't nest.

bpf_kfunc_common_test is a kfunc of bpf_testmod that other tests call
as well. When one of them calls it from another kprobe while test2 is
attached, the kprobe of test2 counts an extra miss, and the test reads
2 instead of 1.

Expect at least one miss, as missed_kprobe_recursion does since
commit 08a7078feacf ("selftests/bpf: Improve missed_kprobe_recursion test robustness").

Fixes: 01e4ae474e39 ("selftests/bpf: Add test for missed counts of perf event link kprobe")
Signed-off-by: Qiliang Yuan <odys.yuan@xxxxxxxxx>
---
tools/testing/selftests/bpf/prog_tests/missed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/missed.c b/tools/testing/selftests/bpf/prog_tests/missed.c
index ed8857ae914a6..dc91be982dd32 100644
--- a/tools/testing/selftests/bpf/prog_tests/missed.c
+++ b/tools/testing/selftests/bpf/prog_tests/missed.c
@@ -36,7 +36,7 @@ static void test_missed_perf_kprobe(void)

ASSERT_EQ(info.type, BPF_LINK_TYPE_PERF_EVENT, "info.type");
ASSERT_EQ(info.perf_event.type, BPF_PERF_EVENT_KPROBE, "info.perf_event.type");
- ASSERT_EQ(info.perf_event.kprobe.missed, 1, "info.perf_event.kprobe.missed");
+ ASSERT_GE(info.perf_event.kprobe.missed, 1, "info.perf_event.kprobe.missed");

cleanup:
missed_kprobe__destroy(skel);

---
base-commit: e1d84a37cba984388988d2f1ddc84561413f0db2
change-id: 20261009-selftests-bpf-missed-perf-kprobe-05471f2aec76

Best regards,
--
Qiliang Yuan <odys.yuan@xxxxxxxxx>