bpf: check if lsm link ptr is libbpf error
authorJulia Kartseva <hex@fb.com>
Fri, 7 Jan 2022 23:02:57 +0000 (15:02 -0800)
committerJulia Kartseva <hex@fb.com>
Mon, 10 Jan 2022 05:45:50 +0000 (21:45 -0800)
commitf409aa5c6363144c9711226319614f3b248d9828
treeea6c941dcb9e60fd9efa09706cd4186e60dc64c6
parent79a67f3ca4d32c37b5e754501852a85eae908a6a
bpf: check if lsm link ptr is libbpf error

BPF_RAW_TRACEPOINT_OPEN is expected to work only on x86 and x86_64,
since BPF trampoline is implemented only on these architectures.

Attach probing by bpf_program__attach_lsm already happens in
`bpf_lsm_supported`. The resulting pointer can store libbpf error and
that is the case for unsupported architectures.
Add libbpf error check to `bpf_lsm_supported` so execution does not
reach the point where unit startup fails.
src/core/bpf-lsm.c