-
Does cilium/ebpf provides a method to update btf info when I try to add a program in a CollectionSpec?
What I get return: What I confused? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, thanks for the question. ebpf-go unmarshals all BTF info (including .btf.ext) into Go types and attaches them as metadata to individual Here's an example of how to attach your own funcinfo to an instruction: Line 38 in e3234a1 Unless you're using a program type that relies on correct funcinfo to validate function arguments, a dummy (like we're using in the test) should be fine to satisfy the verifier. Good luck! |
Beta Was this translation helpful? Give feedback.
Hi, thanks for the question. ebpf-go unmarshals all BTF info (including .btf.ext) into Go types and attaches them as metadata to individual
asm.Instruction
s when loading an ELF. When loading the program into the kernel, the metadata is marshaled back into BTF wire format along with the program. This is why, when you inspect a loaded program's BTF with bpftool, it'll only contain the types used by your program's funcinfo, not the original BTF blob that came with the ELF. The same concept applies to maps created by ebpf-go.Here's an example of how to attach your own funcinfo to an instruction:
ebpf/info_test.go
Line 38 in e3234a1