]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: fix a libbpf loader issue
authorYonghong Song <yhs@fb.com>
Wed, 21 Nov 2018 19:22:42 +0000 (11:22 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 21 Nov 2018 21:22:17 +0000 (22:22 +0100)
commit5c7a4837976751208325641b183cb01a0fc7dad5
tree220411837f9cd15fc51a8de1eef1b104e85c526a
parent94d717edb47aa3b1572b82c5b05bb2c6cc0a98ac
bpf: fix a libbpf loader issue

Commit 405046661673 ("tools/bpf: add support to read .BTF.ext sections")
added support to read .BTF.ext sections from an object file, create
and pass prog_btf_fd and func_info to the kernel.

The program btf_fd (prog->btf_fd) is initialized to be -1 to please
zclose so we do not need special handling dur prog close.
Passing -1 to the kernel, however, will cause loading error.
Passing btf_fd 0 to the kernel if prog->btf_fd is invalid
fixed the problem.

Fixes: 405046661673 ("tools/bpf: add support to read .BTF.ext sections")
Reported-by: Andrey Ignatov <rdna@fb.com>
Reported-by: Emre Cantimur <haydum@fb.com>
Tested-by: Andrey Ignatov <rdna@fb.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/lib/bpf/libbpf.c