ebpf icon indicating copy to clipboard operation
ebpf copied to clipboard

ebpf-go is a pure-Go library to read, modify and load eBPF programs and attach them to various hooks in the Linux kernel.

Results 142 ebpf issues
Sort by recently updated
recently updated
newest added

Some light refactoring to clean up bpf2go a little.

One of our legacy code paths currently does a dodgy pointer conversion: unsafe.Pointer(^uintptr(0)) This is (correctly) flagged by linters as being a bit bogus, since unsafe.Pointer conversions do have an...

The BPF uapi uses a special type `__aligned_u64` to store pointers: ```C struct { /* anonymous struct used by BPF_OBJ_* commands */ __aligned_u64 pathname; __u32 bpf_fd; __u32 file_flags; }; ```...

enhancement

Dear community, with this PR I would like to introduce the `Map.Drain` API to traverse a map while also removing its entries. The current `MapIterator.Next` traverse a map without removing...

Adds support for attaching bpf programs to [netkit devices](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=22360fad5889cbefe1eca695b0cc0273ab280b56) using bpf links. Generated code is currently based on `6.7-rc4` TODO : - [x] Decide on a way to create `netkit`...

#1255 In the current Go `binary.Size()` implementation, the size of struct types are cached to prevent subsequent reflect based encoding for the same types over and over again but aren't...

While an example program already exists for the incoming traffic hook with XDP, an example for a TC program was missing. This example shows how to load an eBPF program...

https://github.com/cilium/ebpf/pull/1257 proposes to add support for attaching netkit programs, but we don't want to take on a dependency to vishvananda/netlink, even for testing. We've decided to drop the netkit tests...

help wanted
good first issue

lmb once said: My personal preference would be to make the parts of bpf2go that are useful available via Go API so that power users can build their own tools....

### Describe the bug Type matches relocation are currently not supported. `bpf_core_type_matches()` (using `BPF_TYPE_MATCHES`) is defined in libbpf: https://github.com/libbpf/libbpf/blob/v1.3.0/src/bpf_core_read.h#L194 Type match relocations was added in llvm/clang 15: https://github.com/llvm/llvm-project/commit/d129ac27e872e189363e3d8cd6bc4e2152cd73ec Example of...

bug