aliyun / coolbpf

MIT License
247 stars 39 forks source link

Add eBPF map information to the generated elf file #38

Open chengshuyi opened 1 year ago

chengshuyi commented 1 year ago

The following steps may be involved:

  1. Add eBPF map information to the map segment
  2. Add the relocate information of eBPF map
  3. Write test cases, involving a simple eBPF program, using an eBPF map, and using libbpf-rs to load and pass.

For details, please refer to the logic of Libbpf processing. The functions that may be involved in libbpf include bpf_objectelf_collect (collecting elf information, such as eBPF program instructions, map information, relocation information, etc.) and bpf_objectrelocate_data (mainly relocating map information, that is, the map's fd )

LavenderQAQ commented 1 year ago

/assign

chengshuyi commented 1 year ago

This part seems complicated. I'll see if the libbpf can provide a method to construct a bpf_program instance to facilitate our loading of the eBPF program.
[1] https://lore.kernel.org/bpf/686fce03-cee7-c268-8bfc-ce49230210b9@linux.alibaba.com/T/#u