diff options
author | Andrii Nakryiko <andriin@fb.com> | 2019-07-26 14:24:38 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-07-26 17:23:16 -0700 |
commit | 5d01ab7bac467edfc530e6ccf953921def935c62 (patch) | |
tree | 5d4799e4c7b1c856189060cf94d60dff4b5d3a5e /tools/debugging | |
parent | 0a062ba725cdad3b167782179ee914a8402a0184 (diff) | |
download | linux-5d01ab7bac467edfc530e6ccf953921def935c62.tar.bz2 |
libbpf: fix erroneous multi-closing of BTF FD
Libbpf stores associated BTF FD per each instance of bpf_program. When
program is unloaded, that FD is closed. This is wrong, because leads to
a race and possibly closing of unrelated files, if application
simultaneously opens new files while bpf_programs are unloaded.
It's also unnecessary, because struct btf "owns" that FD, and
btf__free(), called from bpf_object__close() will close it. Thus the fix
is to never have per-program BTF FD and fetch it from obj->btf, when
necessary.
Fixes: 2993e0515bb4 ("tools/bpf: add support to read .BTF.ext sections")
Reported-by: Andrey Ignatov <rdna@fb.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/debugging')
0 files changed, 0 insertions, 0 deletions