]> git.ipfire.org Git - thirdparty/linux.git/commit
selftests/bpf: Test bpf_program__clone() attach_btf_id override
authorMykyta Yatsenko <yatsenko@meta.com>
Tue, 17 Mar 2026 17:39:23 +0000 (10:39 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 21 Mar 2026 20:17:14 +0000 (13:17 -0700)
commitceebdeec6e8c6c879260a7293ac66c08eb185d43
treec8c201d0972babaf38ee9ca107fc8d17a5ca5082
parent3be706b937f3d4cf1b0236561eb23d064e833253
selftests/bpf: Test bpf_program__clone() attach_btf_id override

Add a test that verifies bpf_program__clone() respects caller-provided
attach_btf_id in bpf_prog_load_opts.

The BPF program has SEC("fentry/bpf_fentry_test1"). It is cloned twice
from the same prepared object: first with no opts, verifying the
callback resolves attach_btf_id from sec_name to bpf_fentry_test1;
then with attach_btf_id overridden to bpf_fentry_test2, verifying the
loaded program is actually attached to bpf_fentry_test2. Both results
are checked via bpf_prog_get_info_by_fd().

Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Link: https://lore.kernel.org/r/20260317-veristat_prepare-v4-3-74193d4cc9d9@meta.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/clone_attach_btf_id.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/clone_attach_btf_id.c [new file with mode: 0644]