]> git.ipfire.org Git - thirdparty/glibc.git/commit
elf: Remove fallback to the start of DT_STRTAB for dladdr
authorFangrui Song <maskray@google.com>
Mon, 2 May 2022 16:06:39 +0000 (09:06 -0700)
committerFangrui Song <maskray@google.com>
Mon, 2 May 2022 16:06:39 +0000 (09:06 -0700)
commit8e28aa3a51bf0ef3683f2aed4b5b448744897b66
tree72b9e532be69784543b8705a8c72a36f42d6721c
parent4e7e4f3b4ba723bef4b1bcff8902ea38162737d9
elf: Remove fallback to the start of DT_STRTAB for dladdr

When neither DT_HASH nor DT_GNU_HASH is present, the code scans
[DT_SYMTAB, DT_STRTAB). However, there is no guarantee that .dynstr
immediately follows .dynsym (e.g. lld typically places .gnu.version
after .dynsym).

In the absence of a hash table, symbol lookup will always fail
(map->l_nbuckets == 0 in dl-lookup.c) as if the object has no symbol, so
it seems fair for dladdr to do the same.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
elf/dl-addr.c