On Sat, Mar 14, 2026 at 10:42 PM Sun Jian <[email protected]> wrote:
>
> 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
> modify_return and get_func_ip_test. When those 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.
>
> Add a dedicated bpf_trampoline_count_test target and switch
> trampoline_count to use it. This keeps the test semantics unchanged
> while isolating it from other modify_return-based 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 -t modify_return -vv
>   ./test_progs -t get_func_ip_test -vv
>   ./test_progs -j$(nproc) -t trampoline_count -vv
>   ./test_progs -j$(nproc) -t
>     trampoline_count,modify_return,get_func_ip_test -vv
>
> Signed-off-by: Sun Jian <[email protected]>
> ---
>  net/bpf/test_run.c                                        | 7 +++++++
>  tools/testing/selftests/bpf/prog_tests/trampoline_count.c | 3 +--
>  tools/testing/selftests/bpf/progs/test_trampoline_count.c | 6 +++---
>  3 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> index 178c4738e63b..b41147a29f16 100644
> --- a/net/bpf/test_run.c
> +++ b/net/bpf/test_run.c
> @@ -580,6 +580,12 @@ __bpf_kfunc int bpf_modify_return_test2(int a, int *b, 
> short c, int d,
>         return a + *b + c + d + (long)e + f + g;
>  }
>
> +__bpf_kfunc int bpf_trampoline_count_test(int a, int *b)
> +{
> +       *b += 1;
> +       return a + *b;
> +}

No. We're not adding test code to the kernel anymore.
That's what test_kmod is for.

pw-bot: cr

Reply via email to