Comments (7)
yes, you need kernel BTF for CO-RE to work. You can work around that for such trivial example by adding
#define BPF_NO_PRESERVE_ACCESS_INDEX
before vmlinux.h include, but is there any reason why you can't upgrade your Ubuntu to something a bit more modern that will restrict you less in what you can do with BPF?
from libbpf-bootstrap.
Yes, I have a huge set of BCC-style kprobes that we are using with Centos 7/RHEL servers, amazon Linux 1 & 2, ubuntu 18.04 +, etc. The goal is to migrate these to libbpf and BPF CO-RE using btfhub files for the older kernels. I assumed this would be possible after seeing the BTF files for the kernels we currently support via BCC and kernel headers.
from libbpf-bootstrap.
BTW, I did modify this kprobe example to load the BTF for my kernel using the opts:
struct bpf_object_open_opts openopts = {};
openopts.sz = sizeof(struct bpf_object_open_opts);
openopts.btf_custom_path = "/tmp/vmlinux.btf";
...
...
/* Load and verify BPF application */
skel = kprobe_bpf__open_opts(&openopts);
/tmp/vmlinux.btf is the file I obtained for my kernel from btfhub-archives.
from libbpf-bootstrap.
#define BPF_NO_PRESERVE_ACCESS_INDEX
Adding this define did not resolve the issue.
from libbpf-bootstrap.
Even after adding
#define BPF_NO_GLOBAL_DATA
#define BPF_NO_PRESERVE_ACCESS_INDEX
there is still a problem due to, I believe, the usage of BPF_CORE_READ:
filename = BPF_CORE_READ(name, name);
When I code around this using bpf_probe_read_user, I am able to get things to work. This brings me back to a core question (no pun intented), are the bpf core helpers not going to work on older kernels even if you have the BTF for that kernel available?
from libbpf-bootstrap.
it should work with btf_custom_path. What's the libbpf debug log output once you specify custom BTF?
from libbpf-bootstrap.
I got this working. My BTF file didn't have all of the symbols I needed for this. I have run this example on 4.15.0-180-generic and on 3.10.0-957 (centos 7.6).
from libbpf-bootstrap.
Related Issues (20)
- Build fails with llvm-strip: not found HOT 1
- libbpf: sec '.relusdt/libc.so.6:libc:setjmp': corrupted symbol #29 pointing to invalid section #65522 for relo #3 HOT 2
- Hello, the argp tutorial link mentioned in your blog does not exist. Can I obtain this tutorial from here? HOT 1
- error while loading shared libraries: libLLVM-14.so HOT 1
- Hi, I was building example when I got this error. I don't know how to deal with this error, please help me, thanks. HOT 5
- The vmlinux file cannot be found on the system. The vmlinux.h header file cannot be generated HOT 3
- Fail to set up performance monitor on a CPU/Core HOT 3
- libbpf: failed to find valid kernel BTF,libbpf: failed to load object 'bootstrap_bpf',libbpf: failed to load BPF skeleton 'bootstrap_bpf': -3 HOT 4
- is it possible to add `.clang-format` to the project? HOT 4
- fentry/fexit example breaks when using different syscall HOT 2
- When use bpf_skb_output(), error occurs: [unknown func bpf_skb_output#111] HOT 4
- CLion CMakeList.txt modifications HOT 1
- libbpf: failed to find BTF for extern 'bpf_ct_release' [138] section: -2 HOT 1
- sockfilter HOT 2
- failed run xdp program HOT 2
- How to share skb with user-space in kprobe
- How to compile ebpf-program so that it can run in kernel-version not support BTF
- BPF program load failed: Argument list too long HOT 1
- unknown type and function name errors while building examples HOT 1
- Getting flags from clone3 systemcall using BPF_KPROBE HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libbpf-bootstrap.