Skip to content
Commit 462c124c authored by Yonghong Song's avatar Yonghong Song Committed by Daniel Borkmann
Browse files

bpf: fix a libbpf loader issue



Commit 2993e051 ("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: 2993e051 ("tools/bpf: add support to read .BTF.ext sections")
Reported-by: default avatarAndrey Ignatov <rdna@fb.com>
Reported-by: default avatarEmre Cantimur <haydum@fb.com>
Tested-by: default avatarAndrey Ignatov <rdna@fb.com>
Signed-off-by: default avatarYonghong Song <yhs@fb.com>
Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent f6161a8f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment