mirror of
https://github.com/armbian/linux-cix.git
synced 2026-01-06 12:30:45 -08:00
libbpf: Fix hypothetical STT_SECTION extern NULL deref case
[ Upstream commit e0525cd72b5979d8089fe524a071ea93fd011dc9 ] Fix theoretical NULL dereference in linker when resolving *extern* STT_SECTION symbol against not-yet-existing ELF section. Not sure if it's possible in practice for valid ELF object files (this would require embedded assembly manipulations, at which point BTF will be missing), but fix the s/dst_sym/dst_sec/ typo guarding this condition anyways. Fixes:faf6ed321c("libbpf: Add BPF static linker APIs") Fixes:a46349227c("libbpf: Add linker extern resolution support for functions and global variables") Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20250220002821.834400-1-andrii@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5db897802c
commit
b55c470275
@@ -1974,7 +1974,7 @@ add_sym:
|
||||
|
||||
obj->sym_map[src_sym_idx] = dst_sym_idx;
|
||||
|
||||
if (sym_type == STT_SECTION && dst_sym) {
|
||||
if (sym_type == STT_SECTION && dst_sec) {
|
||||
dst_sec->sec_sym_idx = dst_sym_idx;
|
||||
dst_sym->st_value = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user