]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
libbpf: never interpret subprogs in .text as entry programs
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 10 Oct 2024 21:17:30 +0000 (14:17 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:53:14 +0000 (13:53 +0100)
commit035defb4d367eb7478249681c000d16f7997e8c6
tree8f27e7cb95c28ff065fe89e454bf770b13a7d6a4
parentf2c82fddede4e8e7fb24e453ee6afc0c8570e7e6
libbpf: never interpret subprogs in .text as entry programs

[ Upstream commit db089c9158c1d535a36dfc010e5db37fccea2561 ]

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: bd054102a8c7 ("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: Sasha Levin <sashal@kernel.org>
tools/lib/bpf/libbpf.c