From ebb52db16e1b39b87ba1d679f441751f7417ac72 Mon Sep 17 00:00:00 2001 From: Dylan Reimerink Date: Fri, 26 Apr 2024 14:10:00 +0200 Subject: [PATCH] features: Fix test `TestHaveProgramType/Extension` in kernel >=v6.8 In kernel v6.8, logic was added that restricts valid func info BTF for programs that can be replaced with an BPF_PROG_TYPE_EXT program. Before this change the parameters of the extension program had to be the same as the original program. Commit https://github.com/torvalds/linux/commit/5eccd2db42d77e357 made it so the verifier asserts that the BTF func info of "main" programs must have exactly 1 parameter of a pointer type to the context struct, even if the code doesn't use the context like in our case. Signed-off-by: Dylan Reimerink --- features/prog.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/features/prog.go b/features/prog.go index a11363796..dc13b86d3 100644 --- a/features/prog.go +++ b/features/prog.go @@ -125,6 +125,9 @@ var haveProgramTypeMatrix = internal.FeatureMatrix[ebpf.ProgramType]{ Name: "a", Type: &btf.FuncProto{ Return: &btf.Int{}, + Params: []btf.FuncParam{ + {Name: "ctx", Type: &btf.Pointer{Target: &btf.Struct{Name: "xdp_md"}}}, + }, }, Linkage: btf.GlobalFunc, }