foniod / redbpf

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

redbpf: compute symbol offset rather than address #357

Closed ajwerner closed 1 year ago

ajwerner commented 1 year ago

Fixes #356

BPF expects offsets in the object files rather than virtual memory addresses. In some cases, the virtual memory offset of the .text section is 0, in which case the correction in this change is a no-op. If the .text section has a non-zero address offset, the previous logic for determining the symbol offset was wrong.

ajwerner commented 1 year ago

Preempted by https://github.com/foniod/redbpf/pull/308.