Re: [PATCH bpf-next 09/13] selftests/bpf: Add tracing_multi bpf prog attach failure tests

[email protected]
Newsgroups org.kernel.vger.bpf
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Build failure due to undefined symbol `libbpf_find_prog_btf_id`.
--

--- Patch [9]: [PATCH bpf-next 09/13] selftests/bpf: Add tracing_multi bpf prog attach failure tests ---
commit c3b104cf9a90f8ddf11f23d2944ad76004fb3150
Author: Leon Hwang <[email protected]>

selftests/bpf: Add tracing_multi bpf prog attach failure tests

This patch adds tests for tracing_multi BPF program attach failures,
covering both libbpf and kernel failure modes.

> diff --git a/tools/testing/selftests/bpf/prog_tests/tracing_multi.c b/tools/testing/selftests/bpf/prog_tests/tracing_multi.c
> index 5ecb751af9be7..5cf11707eaf89 100644
> --- a/tools/testing/selftests/bpf/prog_tests/tracing_multi.c
> +++ b/tools/testing/selftests/bpf/prog_tests/tracing_multi.c
[ ... ]
> +	/* fail#4 (kernel) duplicate target through different fds */
> +	token_fd = bpf_object__token_fd(skel->obj);
> +	token_fd = token_fd < 0 ? 0 : token_fd;
> +	target_id = libbpf_find_prog_btf_id("target_1", fds[0], token_fd);

[Severity: Low]
Does this code compile successfully? libbpf_find_prog_btf_id is an
internal static function in libbpf, so calling it directly from selftests
seems like it would cause an implicit function declaration and undefined
reference linker error during the build.

> +	if (!ASSERT_GT(target_id, 0, "target_1_btf_id"))
> +		goto cleanup;
> +
> +	dup_fd = dup(fds[0]);
> +	if (!ASSERT_GE(dup_fd, 0, "dup_target_fd"))
> +		goto cleanup;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=9
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.