lockc-project / lockc

Making containers more secure with eBPF and Linux Security Modules (LSM)
https://lockc-project.github.io/
Apache License 2.0
218 stars 19 forks source link

bpf: Fix map pinning #171

Closed vadorovsky closed 2 years ago

vadorovsky commented 2 years ago

Aya relies on the pinning field in BPF map definitions. libbpf doesn't provide that field, so instead of using their bpf_map_def struct, here we define our bpf_elf_map struct which has it.

Our structure is similar to those available in Cilium[0] and some selftests in the kernel tree[1].

[0] https://github.com/cilium/cilium/blob/v1.11.1/bpf/include/bpf/loader.h#L19-L29 [1] https://elixir.bootlin.com/linux/v5.16.8/source/samples/bpf/tc_l2_redirect_kern.c#L23

Fixes: #169 Signed-off-by: Michal Rostecki mrostecki@opensuse.org