mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
0542d8a7a327b642d10583e1d948d651d96f2fdf
Use this --debug to better understand what libbpf does of CO-RE relocation tricks and lookup of BTF-IDs. Example output: [...] libbpf: loading kernel BTF '/sys/kernel/btf/vmlinux': 0 libbpf: map 'ktrace01.data': created successfully, fd=4 libbpf: sec 'kprobe/udp_send_skb': found 4 CO-RE relocations libbpf: prog 'udp_send_skb': relo #0: kind <byte_off> (0), spec is [2] struct pt_regs.di (0:14 @ offset 112) libbpf: CO-RE relocating [0] struct pt_regs: found target candidate [176] struct pt_regs in [vmlinux] libbpf: prog 'udp_send_skb': relo #0: matching candidate #0 [176] struct pt_regs.di (0:14 @ offset 112) libbpf: prog 'udp_send_skb': relo #0: patched insn #0 (LDX/ST/STX) off 112 -> 112 libbpf: prog 'udp_send_skb': relo #1: kind <byte_off> (0), spec is [7] struct sk_buff___local.hash (0:1 @ offset 4) libbpf: CO-RE relocating [0] struct sk_buff___local: found target candidate [2965] struct sk_buff in [vmlinux] [...] Notice how the BTF-ID of 'struct sk_buff' is resolved to be 2965. Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Practical BPF examples
This git repository contains a diverse set of practical BPF examples that solve (or demonstrate) a specific use-case using BPF.
It is meant to ease doing rapid prototyping and development, writing C-code BPF programs using libbpf. The goal is to make is easier for developers to get started coding.
Many developers struggle to get a working BPF build environment. The repo enviroment makes it easy to build/compile BPF programs by doing the necessary libbpf setup transparently and detect missing compile dependencies (via the (configure)[configure] script). It is a declared goal to make BPF programming more consumable by detecting and reporting issues (when possible).
Description
Languages
C
93.6%
Shell
4.7%
Makefile
1.6%