]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Improve handling of corrupted ELF during map initialization
authorAndrii Nakryiko <andriin@fb.com>
Thu, 7 Nov 2019 02:08:55 +0000 (18:08 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 7 Nov 2019 15:20:38 +0000 (16:20 +0100)
commit4ddf9b92d446540502947d4fcce8f68ead1e07bd
treee7d3e842476215e3aa5c5642dad4f081cb723d76
parent08c525b4cead019907012c9c33cfde7c57b87ad2
libbpf: Improve handling of corrupted ELF during map initialization

If we get ELF file with "maps" section, but no symbols pointing to it, we'll
end up with division by zero. Add check against this situation and exit early
with error. Found by Coverity scan against Github libbpf sources.

Fixes: 053658a441c0 ("libbpf: refactor map initialization")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20191107020855.3834758-6-andriin@fb.com
tools/lib/bpf/libbpf.c