aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2024-05-03 09:32:01 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2024-05-03 23:23:15 +0000
commitb27eb9ce96b838622e125fd969e8dc4914aabe18 (patch)
tree2082ebb10ed15217aeffc66505ca59fbe6ca06d6
parent548bfc56eb0b2cefa0fb8dc2478240bfef610309 (diff)
downloadsrc-b27eb9ce96b838622e125fd969e8dc4914aabe18.tar.gz
src-b27eb9ce96b838622e125fd969e8dc4914aabe18.zip
__cxa_thread_call_dtors(3): fix dtor pointer validity check
When checking for the destructor pointer belonging to some still loaded dso, do not limit the possible dso to the one instantiated the destructor. For instance, dso could set up the dtr pointer to a function from libcxx. PR: 278701 Reported by: vd Reviewed by: dim, emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D45074
-rw-r--r--lib/libc/stdlib/cxa_thread_atexit_impl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/stdlib/cxa_thread_atexit_impl.c b/lib/libc/stdlib/cxa_thread_atexit_impl.c
index f95384b30347..3123bd12dca8 100644
--- a/lib/libc/stdlib/cxa_thread_atexit_impl.c
+++ b/lib/libc/stdlib/cxa_thread_atexit_impl.c
@@ -102,7 +102,7 @@ walk_cb_call(struct cxa_thread_dtor *dtor)
{
struct dl_phdr_info phdr_info;
- if (_rtld_addr_phdr(dtor->dso, &phdr_info) &&
+ if (_rtld_addr_phdr(dtor->func, &phdr_info) &&
__elf_phdr_match_addr(&phdr_info, dtor->func))
dtor->func(dtor->obj);
else