[git commit 0.9.32] libdl: search for ELF_RTYPE_CLASS_DLSYM in dlsym()

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Wed Jun 29 09:34:38 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=ae9fec983c95a6f0055c4ee477ac7f30e569cf7d
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/0.9.32

On FDPIC platforms, functions are passed by function descriptor, not by
pointers. If you don't specify ELF_RTYPE_CLASS_DLSYM when calling
_dl_find_hash() the return value from dlsym() will be a pointer not a
function descriptor, crashing the program.

The bug was introduced when TLS support was added in
534661b91c98492995274c364c8177c45efc63db

Closes bug#3433

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 ldso/libdl/libdl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index 52c77b0..f59889c 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -667,7 +667,7 @@ void *dlsym(void *vhandle, const char *name)
 	tpnt = NULL;
 	if (handle == _dl_symbol_tables)
 		tpnt = handle->dyn; /* Only search RTLD_GLOBAL objs if global object */
-	ret = _dl_find_hash(name2, handle, tpnt, 0, &sym_ref);
+	ret = _dl_find_hash(name2, handle, tpnt, ELF_RTYPE_CLASS_DLSYM, &sym_ref);
 
 #if defined(USE_TLS) && USE_TLS && defined SHARED
 	if (sym_ref.tpnt) {
-- 
1.7.3.4



More information about the uClibc-cvs mailing list