Skip to content

Generating tailored BTF with vmlinux #109

Discussion options

You must be logged in to vote

Yes, you would be okay.

  • The vmlinux.h will have the types from the kernel where you generated the file (considering you used /sys/kernel/btf/vmlinux to generate it, for example).
  • libbpf will be smart to do the relocations and some simple type relocations if types have changed.
  • problem rises if your eBPF program uses types that aren't available in the kernel where you're running your eBPF object. then you have to have "multiple" types declared.
  • a good approach is to have a vmlinux.h file (like) with ONLY the types your eBPF use. then, to have "flavored types" for the kernels it supports.

Example of a vmlinux.h containing only the types used by tracee:

https://github.com/aquasecurity/trac…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@havefuncoding1
Comment options

Answer selected by rafaeldtinoco
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