libbpf: Mark BPF subprogs with hidden visibility as static for BPF verifier
authorAndrii Nakryiko <andrii@kernel.org>
Fri, 23 Apr 2021 18:13:34 +0000 (11:13 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 23 Apr 2021 21:05:26 +0000 (14:05 -0700)
commitaea28a602fa19fb4fe66374030ab7e2c8ddf643e
tree044aaf22b476bf1e16840f21a1a34eb996eed748
parent0fec7a3cee1cf8e4f86ff563d229408ccbdc2d66
libbpf: Mark BPF subprogs with hidden visibility as static for BPF verifier

Define __hidden helper macro in bpf_helpers.h, which is a short-hand for
__attribute__((visibility("hidden"))). Add libbpf support to mark BPF
subprograms marked with __hidden as static in BTF information to enforce BPF
verifier's static function validation algorithm, which takes more information
(caller's context) into account during a subprogram validation.

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/20210423181348.1801389-5-andrii@kernel.org
tools/lib/bpf/bpf_helpers.h
tools/lib/bpf/btf.c
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf_internal.h