]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/bpf: Add tests for livepatch + bpf trampoline
authorSong Liu <song@kernel.org>
Mon, 27 Oct 2025 17:50:23 +0000 (10:50 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 4 Nov 2025 01:22:06 +0000 (17:22 -0800)
commit62d2d0a33839c28173909616db2ef16e1a4a5071
tree45bc559e4b5204726ef54faa9596d91edc025b7c
parent3e9a18e1c3e931abecf501cbb23d28d69f85bb56
selftests/bpf: Add tests for livepatch + bpf trampoline

Both livepatch and BPF trampoline use ftrace. Special attention is needed
when livepatch and fexit program touch the same function at the same
time, because livepatch updates a kernel function and the BPF trampoline
need to call into the right version of the kernel function.

Use samples/livepatch/livepatch-sample.ko for the test.

The test covers two cases:
  1) When a fentry program is loaded first. This exercises the
     modify_ftrace_direct code path.
  2) When a fentry program is loaded first. This exercises the
     register_ftrace_direct code path.

Signed-off-by: Song Liu <song@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20251027175023.1521602-4-song@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
tools/testing/selftests/bpf/config
tools/testing/selftests/bpf/prog_tests/livepatch_trampoline.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/livepatch_trampoline.c [new file with mode: 0644]