浏览代码

libdl: search for ELF_RTYPE_CLASS_DLSYM in dlsym()

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@gmail.com>
Bernhard Reutner-Fischer 13 年之前
父节点
当前提交
6b76a71299
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      ldso/libdl/libdl.c

+ 1 - 1
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) {