Re: Reading Pinned maps in eBPF Programs


Andrii Nakryiko
 

On Thu, Aug 20, 2020 at 5:35 AM Ian <icampbe14@...> wrote:

Interestingly enough I am using clang version 10.0.0! Even with that creating a structure from the examples like so:

struct {
__uint(type, BPF_MAP_TYPE_HASH);
__uint(max_entries, 1);
__type(key, __u32);
__type(value, __u32);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} pid_map SEC(".maps");

I still get: libbpf: BTF is required, but is missing or corrupted.
Your BPF code must be relying on CO-RE. I can check if you can show me
your BPF source code.

The pinning and map definition itself doesn't rely on CO-RE and thus
doesn't need kernel BTF.


Here is my clang version output:

vagrant@vagrant:/vagrant$ clang -v
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

I will continue looking into new clang versions to see if mine is slightly out of date!


Join iovisor-dev@lists.iovisor.org to automatically receive all group messages.