summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2006-09-08 14:59:54 +0000
committerkib <kib@FreeBSD.org>2006-09-08 14:59:54 +0000
commitc0568f66e009e5381a46c6705378a6617e430a46 (patch)
tree42bd5fcb6f6a270f066d94b4ebdbff6fe8a70a0f /libexec
parent72bebbd5968d80256e977d3c6c6644a0e6ce50a8 (diff)
downloadFreeBSD-src-c0568f66e009e5381a46c6705378a6617e430a46.zip
FreeBSD-src-c0568f66e009e5381a46c6705378a6617e430a46.tar.gz
When looking up the symbol by dlsym, look it not only in the object
given as dso handle, but also in the implicit dependencies of that dso. Also, const-ify the read-only parameter objlist of symlook_list. Reported by: "Simon 'corecode' Schubert" <corecode at fs ei tum de> Approved by: kan (mentor) X-MFC-After: 6.2
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/rtld.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 68908bd..61fbbf6 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -123,7 +123,7 @@ static const void **get_program_var_addr(const char *);
static void set_program_var(const char *, const void *);
static const Elf_Sym *symlook_default(const char *, unsigned long,
const Obj_Entry *, const Obj_Entry **, const Ver_Entry *, int);
-static const Elf_Sym *symlook_list(const char *, unsigned long, Objlist *,
+static const Elf_Sym *symlook_list(const char *, unsigned long, const Objlist *,
const Obj_Entry **, const Ver_Entry *, int flags, DoneList *);
static void trace_loaded_objects(Obj_Entry *obj);
static void unlink_object(Obj_Entry *);
@@ -1851,21 +1851,18 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve,
return NULL;
}
+ DoneList donelist;
+ const Objlist *srch_list;
+ donelist_init(&donelist);
if (obj->mainprog) {
- DoneList donelist;
-
/* Search main program and all libraries loaded by it. */
- donelist_init(&donelist);
- def = symlook_list(name, hash, &list_main, &defobj, ve, flags,
- &donelist);
+ srch_list = &list_main;
} else {
- /*
- * XXX - This isn't correct. The search should include the whole
- * DAG rooted at the given object.
- */
- def = symlook_obj(name, hash, obj, ve, flags);
- defobj = obj;
+ /* Search the whole DAG rooted at the given object. */
+ srch_list = &(obj->dagmembers);
}
+ def = symlook_list(name, hash, srch_list, &defobj, ve, flags,
+ &donelist);
}
if (def != NULL) {
@@ -2336,7 +2333,7 @@ symlook_default(const char *name, unsigned long hash, const Obj_Entry *refobj,
}
static const Elf_Sym *
-symlook_list(const char *name, unsigned long hash, Objlist *objlist,
+symlook_list(const char *name, unsigned long hash, const Objlist *objlist,
const Obj_Entry **defobj_out, const Ver_Entry *ventry, int flags,
DoneList *dlp)
{
OpenPOWER on IntegriCloud