Generating tailored BTF with vmlinux #109
-
If I have a kernel with BTF enabled, can I use vmlinux on the system to create tailored BTF for my eBPF programs with below command? I tried this and didn't see any issues when executing my eBPF program, so I think it's ok but I would like to get a quick confirmation from experts. Thanks a lot in advance for your help. bpftool gen min_core_btf ~/vmlinux ./vmlinux.tailored.btf ./ebpfprogram.o |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, you would be okay.
Example of a vmlinux.h containing only the types used by tracee: https://github.com/aquasecurity/tracee/blob/main/pkg/ebpf/c/vmlinux.h Example of a vmlinux with flavored types (for specific kernel versions): https://github.com/aquasecurity/tracee/blob/main/pkg/ebpf/c/vmlinux_flavors.h
And then you can have another header for the missing definitions: https://github.com/aquasecurity/tracee/blob/main/pkg/ebpf/c/vmlinux_missing.h Make sure to read https://nakryiko.com/posts/bpf-core-reference-guide/ also, to understand better this concept if you can't right now. |
Beta Was this translation helpful? Give feedback.
Yes, you would be okay.
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).Example of a vmlinux.h containing only the types used by tracee:
https://github.com/aquasecurity/trac…