Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestHaveProgramType/Extension fails on kernels >6.7 #1451

Closed
lmb opened this issue Apr 26, 2024 · 2 comments · Fixed by #1452
Closed

TestHaveProgramType/Extension fails on kernels >6.7 #1451

lmb opened this issue Apr 26, 2024 · 2 comments · Fixed by #1452
Labels
bug Something isn't working

Comments

@lmb
Copy link
Collaborator

lmb commented Apr 26, 2024

Describe the bug

Running the testsuite against new kernels results in an error:

--- FAIL: TestHaveProgramType (0.07s)
    --- FAIL: TestHaveProgramType/Extension (0.00s)
        feature.go:30: Feature 'Extension' isn't supported even though kernel is newer than v5.6
FAIL
FAIL	github.com/cilium/ebpf/features	0.670s
FAIL

How to reproduce

Using newest vimto:

vimto -kernel :stable-selftests -- go test -short -count 1 ./features

Version information

main

@lmb lmb added the bug Something isn't working label Apr 26, 2024
@dylandreimerink
Copy link
Member

I dumped the error which causes the probe to fail which is:

load program: invalid argument:
	Cannot replace static functions
	processed 0 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0

Logic related to this error was changed in this patch set: https://lore.kernel.org/all/20231215011334.2307144-1-andrii@kernel.org/

@dylandreimerink
Copy link
Member

I think I figured it out. This patch adds the following logic:

		/* if main BPF program has associated BTF info, validate that
		 * it's matching expected signature, and otherwise mark BTF
		 * info for main program as unreliable
		 */
		if (env->prog->aux->func_info_aux) {
			ret = btf_prepare_func_args(env, 0);
			if (ret || sub->arg_cnt != 1 || sub->args[0].arg_type != ARG_PTR_TO_CTX)
				env->prog->aux->func_info_aux[0].unreliable = true;
		}

So if a program is a main program (it is directly attached / an entrypoint) then its BTF must have exactly 1 argument, that being a pointer to CTX. But in our current probe the func info doesn't include a parameter. This causes the first XDP program to be marked unreliable, which causes the Cannot replace static functions error when trying to load the extension. Fix PR incoming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants