Re: [PATCH bpf-next 6/9] selftests/bpf: Verify tracing link_create logs

From: bot+bpf-ci

Date: Mon Nov 09 2026 - 09:51:26 EST


> selftests/bpf: Verify tracing link_create logs

TL;DR: Test issue: the invalid attach_type subtest in tracing_link.c may fail
earlier in the generic check, so it may not exercise the new tracing log.
Using BPF_TRACE_FEXIT on the fentry program might fix it.

> diff --git a/tools/testing/selftests/bpf/prog_tests/tracing_link.c b/tools/testing/selftests/bpf/prog_tests/tracing_link.c
> new file mode 100644
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/tracing_link.c

[ ... ]

> +static void test_log_invalid_attach_type(void)
> +{
> + const char *msg = "Invalid attach_type.\n";
> +
> + test_fentry_link_create_log(0, 0, 0, BPF_XDP, false, msg);
> +}

Does this subtest reach the tracing-specific log added by "bpf: Add log
support for tracing link_create"?

With BPF_XDP on the fentry program, link_create() fails earlier in the
generic check:

ret = bpf_prog_attach_check_attach_type(prog, attr->link_create.attach_type);
if (ret) {
bpf_log(log, "Invalid attach_type.\n");
goto out;
}

For BPF_PROG_TYPE_TRACING, attach_type_to_prog_type(BPF_XDP) returns
BPF_PROG_TYPE_XDP, so bpf_prog_attach_check_attach_type() returns -EINVAL
and the case below is never reached:

case BPF_PROG_TYPE_TRACING:
if (attr->link_create.attach_type != prog->expected_attach_type) {
bpf_log(log, "Invalid attach_type.\n");

Both messages are identical, so this subtest would still pass if the
tracing-branch bpf_log() were removed. The generic check is already
covered by the invalid_attach_type subtest in xdp_link.c.

Would passing an attach type that maps to BPF_PROG_TYPE_TRACING but
differs from the program's expected_attach_type, for example
BPF_TRACE_FEXIT for this fentry program, exercise the new log instead?


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/42633880300