Skip to content

Commit 83e5c82

Browse files
committed
libbpf: never interpret subprogs in .text as entry programs
JIRA: https://issues.redhat.com/browse/RHEL-85485 commit db089c9 Author: Andrii Nakryiko <andrii@kernel.org> Date: Thu Oct 10 14:17:30 2024 -0700 libbpf: never interpret subprogs in .text as entry programs Libbpf pre-1.0 had a legacy logic of allowing singular non-annotated (i.e., not having explicit SEC() annotation) function to be treated as sole entry BPF program (unless there were other explicit entry programs). This behavior was dropped during libbpf 1.0 transition period (unless LIBBPF_STRICT_SEC_NAME flag was unset in libbpf_mode). When 1.0 was released and all the legacy behavior was removed, the bug slipped through leaving this legacy behavior around. Fix this for good, as it actually causes very confusing behavior if BPF object file only has subprograms, but no entry programs. Fixes: bd05410 ("libbpf: enforce strict libbpf 1.0 behaviors") Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20241010211731.4121837-1-andrii@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Viktor Malik <vmalik@redhat.com>
1 parent e266ad5 commit 83e5c82

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/lib/bpf/libbpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4389,7 +4389,7 @@ static int bpf_object__collect_externs(struct bpf_object *obj)
43894389

43904390
static bool prog_is_subprog(const struct bpf_object *obj, const struct bpf_program *prog)
43914391
{
4392-
return prog->sec_idx == obj->efile.text_shndx && obj->nr_programs > 1;
4392+
return prog->sec_idx == obj->efile.text_shndx;
43934393
}
43944394

43954395
struct bpf_program *

0 commit comments

Comments
 (0)