eunomia-bpf / bpf-developer-tutorial

eBPF Developer Tutorial: Learning eBPF Step by Step with Examples
https://eunomia.dev/tutorials/
MIT License
2.66k stars 373 forks source link

[BUG]24-hide libbpf: failed to find BTF info for global/extern symbol 'pid_to_hide' #143

Open zer0-1s opened 2 weeks ago

zer0-1s commented 2 weeks ago

Describe the bug A clear and concise description of what the bug is. 在编译 24-hide 代码时,编译错误

598 warnings generated.
libbpf: failed to find BTF info for global/extern symbol 'pid_to_hide'
Error: failed to link '.output/pidhide.tmp.bpf.o': No such file or directory (2)
make: *** [Makefile:112: .output/pidhide.bpf.o] Error 254
make: *** Deleting file '.output/pidhide.bpf.o'

To Reproduce Steps to reproduce the behavior:

cd src/24-hide
make

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

image

Desktop (please complete the following information):

Additional context

Add any other context about the problem here.

https://lore.kernel.org/bpf/CAEf4BzZnZ=jqTxShQ7p2tp=0sT5iMEJVB+zqhf55XtwQHOODtA@mail.gmail.com/T/

有一个patch与此类似

zer0-1s commented 2 weeks ago

修改pidhide.bpf.c

const volatile char pid_to_hide[MAX_PID_LEN] = "";

参考patch可以修改,完成编译操作