]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/bpf: Add tests for kprobe.session optimization
authorAndrey Grodzovsky <andrey.grodzovsky@crowdstrike.com>
Mon, 2 Mar 2026 20:08:37 +0000 (15:08 -0500)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 5 Mar 2026 23:14:53 +0000 (15:14 -0800)
commita28441dd29617b330d7284dc00b610be196b783f
treea3b8d83ae866ec5c264a31ed4821fc747de2831d
parent6afc431db1b4c21fec96cf6bea29489f4dce17c5
selftests/bpf: Add tests for kprobe.session optimization

Extend existing kprobe_multi_test subtests to validate the
kprobe.session exact function name optimization:

In kprobe_multi_session.c, add test_kprobe_syms which attaches a
kprobe.session program to an exact function name (bpf_fentry_test1)
exercising the fast syms[] path that bypasses kallsyms parsing.  It
calls session_check() so bpf_fentry_test1 is hit by both the wildcard
and exact probes, and test_session_skel_api validates
kprobe_session_result[0] == 4 (entry + return from each probe).

In test_attach_api_fails, add fail_7 and fail_8 verifying error code
consistency between the wildcard pattern path (slow, parses kallsyms)
and the exact function name path (fast, uses syms[] array).  Both
paths must return -ENOENT for non-existent functions.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@crowdstrike.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20260302200837.317907-4-andrey.grodzovsky@crowdstrike.com
tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
tools/testing/selftests/bpf/progs/kprobe_multi_session.c