Commit e5670fa0 authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Alexei Starovoitov

libbpf: Treat STV_INTERNAL same as STV_HIDDEN for functions

Do the same global -> static BTF update for global functions with STV_INTERNAL
visibility to turn on static BPF verification mode.
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210507054119.270888-7-andrii@kernel.org
parent 247b8634
...@@ -700,13 +700,14 @@ bpf_object__add_programs(struct bpf_object *obj, Elf_Data *sec_data, ...@@ -700,13 +700,14 @@ bpf_object__add_programs(struct bpf_object *obj, Elf_Data *sec_data,
if (err) if (err)
return err; return err;
/* if function is a global/weak symbol, but has hidden /* if function is a global/weak symbol, but has restricted
* visibility (STV_HIDDEN), mark its BTF FUNC as static to * (STV_HIDDEN or STV_INTERNAL) visibility, mark its BTF FUNC
* enable more permissive BPF verification mode with more * as static to enable more permissive BPF verification mode
* outside context available to BPF verifier * with more outside context available to BPF verifier
*/ */
if (GELF_ST_BIND(sym.st_info) != STB_LOCAL if (GELF_ST_BIND(sym.st_info) != STB_LOCAL
&& GELF_ST_VISIBILITY(sym.st_other) == STV_HIDDEN) && (GELF_ST_VISIBILITY(sym.st_other) == STV_HIDDEN
|| GELF_ST_VISIBILITY(sym.st_other) == STV_INTERNAL))
prog->mark_btf_static = true; prog->mark_btf_static = true;
nr_progs++; nr_progs++;
......
Markdown is supported
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