- Notifications
You must be signed in to change notification settings - Fork730
ebpf-go is a pure-Go library to read, modify and load eBPF programs and attach them to various hooks in the Linux kernel.
License
cilium/ebpf
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
ebpf-go is a pure Go library that provides utilities for loading, compiling, anddebugging eBPF programs. It has minimal external dependencies and is intended tobe used in long running processes.
Seeebpf.io for complementary projects from the wider eBPFecosystem.
Please take a look at ourGetting Started guide.
Contributions are highly encouraged, as they highlight certain use cases ofeBPF and the library, and help shape the future of the project.
The community actively monitors ourGitHub Discussions page.Please search for existing threads before starting a new one. Refrain fromopening issues on the bug tracker if you're just starting out or if you're notsure if something is a bug in the library code.
Alternatively,join the#ebpf-go channel on Slack if youhave other questions regarding the project. Note that this channel is ephemeraland has its history erased past a certain point, which is less helpful forothers running into the same problem later.
This library includes the following packages:
- asm contains a basicassembler, allowing you to write eBPF assembly instructions directlywithin your Go code. (You don't need to use this if you prefer to write your eBPF program in C.)
- cmd/bpf2go allowscompiling and embedding eBPF programs written in C within Go code. As well ascompiling the C code, it auto-generates Go code for loading and manipulatingthe eBPF program and map objects.
- link allows attaching eBPFto various hooks
- perf allows reading from a
PERF_EVENT_ARRAY
- ringbuf allows reading from a
BPF_MAP_TYPE_RINGBUF
map - features implements the equivalentof
bpftool feature probe
for discovering BPF-related kernel features using native Go. - rlimit provides a convenient API to liftthe
RLIMIT_MEMLOCK
constraint on kernels before 5.11. - btf allows reading the BPF Type Format.
- pin provides APIs for working with pinned objects on bpffs.
- A version of Go that issupported byupstream
- CI is run against kernel.org LTS releases. >= 4.4 should work but EOL'ed versionsare not supported.
MIT
The eBPF honeygopher is based on the Go gopher designed by Renee French.
About
ebpf-go is a pure-Go library to read, modify and load eBPF programs and attach them to various hooks in the Linux kernel.