]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/bpf: move trampoline_count to dedicated bpf_testmod target
authorSun Jian <sun.jian.kdev@gmail.com>
Tue, 24 Mar 2026 04:49:49 +0000 (12:49 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 24 Mar 2026 20:39:32 +0000 (13:39 -0700)
commit7f5b0a60a8b925db0cde62d87f1031dc04acbeb2
treed81a6889d473aa162023d5271b2ec8a171656c68
parentd9d7125e445dc06c2d9bd3dbd070dcbcd41a540f
selftests/bpf: move trampoline_count to dedicated bpf_testmod target

trampoline_count fills all trampoline attachment slots for a single
target function and verifies that one extra attach fails with -E2BIG.

It currently targets bpf_modify_return_test, which is also used by
other selftests such as modify_return, get_func_ip_test, and
get_func_args_test. When such tests run in parallel, they can contend
for the same per-function trampoline quota and cause unexpected attach
failures. This issue is currently masked by harness serialization.

Move trampoline_count to a dedicated bpf_testmod target and register it
for fmod_ret attachment. Also route the final trigger through
trigger_module_test_read(), so the execution path exercises the same
dedicated target.

This keeps the test semantics unchanged while isolating it from other
selftests, so it no longer needs to run in serial mode. Remove the
TODO comment as well.

Tested:
  ./test_progs -t trampoline_count -vv
  ./test_progs -j$(nproc) -t trampoline_count -vv
  ./test_progs -j$(nproc) -t \
    trampoline_count,modify_return,get_func_ip_test,get_func_args_test -vv
  20 runs of:
    ./test_progs -j$(nproc) -t \
      trampoline_count,modify_return,get_func_ip_test,get_func_args_test

Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20260324044949.869801-1-sun.jian.kdev@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/trampoline_count.c
tools/testing/selftests/bpf/progs/test_trampoline_count.c
tools/testing/selftests/bpf/test_kmods/bpf_testmod.c