Comparing bpf helper probe results with `bpftool`
With #375 we added support to probe the running kernel for helper availability.
As bpftool/libbpf also support feature probing, we have been manually comparing results. To reduce some effort I put together a small CLI program (bpftoolcmp) that shells out to bpftool and compares its results with results from the APIs we have in the lib.
It's output currently looks like the following:
❯ go run -exec sudo cmd/bpftoolcmp/main.go
Running bpftool -j feature ...
Comparing available program types ...
Comparing available helper functions ...
False negative: API got different result than bpftool for: RawTracepoint/FnGetFuncIp
False negative: API got different result than bpftool for: Syscall/FnSkStorageGet
False negative: API got different result than bpftool for: Syscall/FnSkStorageDelete
False negative: API got different result than bpftool for: Syscall/FnDPath
False negative: API got different result than bpftool for: Syscall/FnGetFuncIp
False negative: API got different result than bpftool for: TracePoint/FnGetFuncIp
False negative: API got different result than bpftool for: PerfEvent/FnGetFuncIp
False negative: API got different result than bpftool for: RawTracepointWritable/FnGetFuncIp
Note: Probes for the FnGetFuncIp helper are not actually a false negative, but a false positive on bpftools end: see here. The rest is still to be investigated.
Instead of such a CLI tool that would be run manually, @lmb suggested making it part of the testsuite of the features package. E.g. adding a test like TestBPFToolComapre(). I also would prefer having this as an automated test in the suite, however a test like this will put a burden on us to investigate the lib and bpftool/libbpf in case of a new failure in my opinion.