]> git.ipfire.org Git - thirdparty/linux.git/commit
selftests/bpf: Isolate fmod_ret hooks by pid
authorSun Jian <sun.jian.kdev@gmail.com>
Fri, 13 Mar 2026 03:45:40 +0000 (11:45 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 19 Mar 2026 00:16:06 +0000 (17:16 -0700)
commit4a4fedb8a523e35d2ad80637bae85de3ee56646b
tree4a50eadeeed26067713c54be8037620800786244
parent888329ba6c8baa7908e08561c6e89d3fc5680131
selftests/bpf: Isolate fmod_ret hooks by pid

modify_return's fmod_ret programs can override bpf_modify_return_test()'s
return value, which conflicts with get_func_ip_test when selftests run in
parallel.

Store current tgid in BSS and make modify_return hooks act only for that
tgid. For other tasks, fentry/fexit become no-ops and fmod_ret returns the
original ret.

Drop the serial-only restriction and remove the TODO comment.

Tested:
  sudo ./test_progs -t modify_return
  sudo ./test_progs -t get_func_ip_test
  sudo ./test_progs -j$(nproc) -t modify_return
  sudo ./test_progs -j$(nproc) -t get_func_ip_test

Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com>
Link: https://lore.kernel.org/r/20260313034540.255805-1-sun.jian.kdev@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/modify_return.c
tools/testing/selftests/bpf/progs/modify_return.c