lizrice / learning-ebpf

Learning eBPF, published by O'Reilly - out now! Here's where you'll find a VM config for the examples, and more
https://www.amazon.com/Learning-eBPF-Programming-Observability-Networking/dp/1098135121
Apache License 2.0
1.19k stars 255 forks source link

Fix chapter3/ SEC('raw_tp') #27

Closed 64J0 closed 10 months ago

64J0 commented 1 year ago

Description:

With this PR, I'm changing the hello-func.bpf.c instruction SEC("raw_tp") to SEC("raw_tp/").

Must close https://github.com/lizrice/learning-ebpf/issues/25.

qmonnet commented 1 year ago

Nice! But this change should not be necessary with a recent version of the tooling. As far as I understand, loading fails because the libbpf version used to compile your bpftool binary doesn't have libbpf/libbpf@eee09dc7044306f91c41327ca08b294e3c2efa69 (libbpf v0.8+). When opening issues, I would encourage you to provide your versions for bpftool, libbpf (and when relevant, LLVM).

All this being said, the change is harmless, and should help load the sample program with older versions of bpftool/libbpf.