ebpf icon indicating copy to clipboard operation
ebpf copied to clipboard

New API in Collection{Spec} for modifying global BPF variables

Open smagnani96 opened this issue 1 year ago • 1 comments

Describe the bug

-- Newbie here, text to be adjusted --

Opening this issue to discuss a possible enhancement to the library regarding the interaction with static/global variables in an eBPF program. AFAIU, the current state of the library doesn't allow to interact with such data, since the map containing these varaibles (".rodata", ".data", ".bss") are not emitted (referring to https://github.com/cilium/ebpf/blob/main/cmd/bpf2go/main.go#L367 and https://github.com/cilium/ebpf/blob/main/cmd/bpf2go/gen/output.go#L108).

Useful pointers:

  1. https://github.com/cilium/ebpf/discussions/943
  2. https://stackoverflow.com/questions/78742654/how-does-mmaped-ebpf-map-shared-between-processes-synchronizes-operations

Ongoing effort:

  1. Map.Memory and ebpf.Variable support: https://github.com/ti-mo/ebpf/tree/tb/ebpf-variables
  2. bpf2go support for ebpf.Variable: #1543 (rebased on https://github.com/ti-mo/ebpf/tree/tb/ebpf-variables plus some required hack)

smagnani96 avatar Aug 08 '24 09:08 smagnani96

cc @ti-mo PTAL

lmb avatar Aug 12 '24 16:08 lmb

This was merged in https://github.com/cilium/ebpf/pull/1572. bpf2go work continuing in https://github.com/cilium/ebpf/pull/1543.

ti-mo avatar Nov 12 '24 16:11 ti-mo