Skip to content

When I use bpf2go to load the BPF application, the BTF information is incomplete. #1514

Answered by ti-mo
binw666 asked this question in Q&A
Discussion options

You must be logged in to vote

2 observations here:

  1. I don't think your use of spec, err := handle.Spec(&btf.Spec{}) is correct, afaik you need to call handle.Spec(nil) since the Handle doesn't represent a kmod BTF blob. The parameter is to specify a base BTF that a kmod BTF needs to parse successfully. That may fix your application and should let you obtain the BTF for the loaded BPF program.

  2. ebpf-go has a fundamentally different way of passing (user) program BTF to the kernel. Unlike libbpf, it completely parses the BTF blob into Go structures and attaches each funcinfo and lineinfo and the types they point to directly to each asm.Instruction in ProgramSpec.Instructions. When loading a program into the kernel, it …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@binw666
Comment options

@ti-mo
Comment options

ti-mo Sep 6, 2024
Maintainer

@binw666
Comment options

Answer selected by binw666
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants