foniod / redbpf

Rust library for building and running BPF/eBPF modules
Apache License 2.0
1.71k stars 136 forks source link

Fix symbols resolving for position-independent executables #308

Closed nbaksalyar closed 2 years ago

nbaksalyar commented 2 years ago

This PR fixes the symbols resolver for position-independent executables which have ET_DYN or ET_EXEC flags in the ELF header. In that case, virtual addresses need to be translated into physical addresses using the offsets information from ELF headers. For reference, see the BCC implementation.

I think it's also worth adding tests in this case. Please let me know if you want me to include them within this PR.