iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.34k stars 3.86k forks source link

Program used external function 'bpf_probe_read_kernel' which could not be resolved! #3395

Open waectr opened 3 years ago

waectr commented 3 years ago

this is my issue!please help me

/virtual/main.c:44:9: warning: implicit declaration of function 'bpf_probe_read_kernel' is invalid in C99 [-Wimplicit-function-declaration] bpf_probe_read_kernel(&data.query, sizeof(data.query), tempp->query); ^ 1 warning generated. LLVM ERROR: Program used external function 'bpf_probe_read_kernel' which could not be resolved!

waectr commented 3 years ago

/virtual/main.c:44:9: warning: implicit declaration of function 'bpf_probe_read_kernel' is invalid in C99 [-Wimplicit-function-declaration] bpf_probe_read_kernel(&data.query, sizeof(data.query), tempp->query); ^ 1 warning generated. LLVM ERROR: Program used external function 'bpf_probe_read_kernel' which could not be resolved!

yonghong-song commented 3 years ago

Do you have a reproducible test case for this? if the underlying kernel does not support bpf_probe_read_kernel, bcc rewriter is supposed to have

#define bpf_probe_read_kernel bpf_probe_read

to fall back to old way bpf_probe_read.

waectr commented 3 years ago

ok thanks, this problem solved by your method!

yonghong-song commented 3 years ago

@waectr Sounds good. I think the rewriter should be automatically catch this. But if your kernel is a backported kernel with selected backported bpf features. it may not work. Is your kernel a backported kernel?

GerryHickman commented 1 year ago

I ran into this on RHEL7, which uses extensive backporting.

cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.9 (Maipo)
uname -r
3.10.0-1160.76.1.el7.x86_64

The bcc tools package on RHEL8 includes '/usr/share/bcc/tools/tcpstates', and I wanted to run this on RHEL7. The tool already has support for both tracepoint and kprobe, but would not run on RHEL7, due to 'bpf_probe_read_kernel'. I added two lines near the start of the bpf program

#define KBUILD_MODNAME "foo"
#define bpf_probe_read_kernel bpf_probe_read

and the 'tcpstates' tool is now able to run.

tthaiouwen commented 1 year ago

C:\Users\26898\Anaconda3\lib\site-packages\numba\decorators.py:146: RuntimeWarning: Caching is not available when the 'parallel' target is in use. Caching is now being disabled to allow execution to continue. warnings.warn(msg, RuntimeWarning) LLVM ERROR: Program used external function '.kernel.2222260625408' which could not be resolved!

tthaiouwen commented 1 year ago

How to solve this which has confused me many days?