libbpf: Improve ELF relo sanitization

Add few sanity checks for relocations to prevent div-by-zero and
out-of-bounds array accesses in libbpf.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20211103173213.1376990-6-andrii@kernel.org
This commit is contained in:
Andrii Nakryiko 2021-11-03 10:32:13 -07:00 • committed by Alexei Starovoitov
commit b7332d2820