diff options
author | kib <kib@FreeBSD.org> | 2016-01-20 07:21:33 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2016-01-20 07:21:33 +0000 |
commit | 5f1c6d1039bf8273173d337033d24a394bbbf3ae (patch) | |
tree | 80a3a7f9f52931a90d1e9533d93f368fdd3ed703 /libexec/rtld-elf/i386/reloc.c | |
parent | 7a5a23853a3d5af0f3ffaa536704ff7c5533b65a (diff) | |
download | FreeBSD-src-5f1c6d1039bf8273173d337033d24a394bbbf3ae.zip FreeBSD-src-5f1c6d1039bf8273173d337033d24a394bbbf3ae.tar.gz |
Do not call callbacks for dl_iterate_phdr(3) with the rtld bind and
phdr locks locked. This allows to call rtld services from the
callback, which is only reasonable for dlopen(path, RTLD_NOLOAD) to
test existence of the library in the image, and for dlsym(). The
later might still be not quite safe, due to the lazy resolution of
filters.
To allow dropping the locks around iteration in dl_iterate_phdr(3), we
insert markers to track current position between relocks. The global
objects list is converted to tailq and all iterators skip markers,
globallist_next() and globallist_curr() helpers are added.
Reported and tested by: davide
Reviewed by: kan
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Diffstat (limited to 'libexec/rtld-elf/i386/reloc.c')
-rw-r--r-- | libexec/rtld-elf/i386/reloc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c index 55b6537..2d6021c 100644 --- a/libexec/rtld-elf/i386/reloc.c +++ b/libexec/rtld-elf/i386/reloc.c @@ -86,7 +86,8 @@ do_copy_relocations(Obj_Entry *dstobj) req.ventry = fetch_ventry(dstobj, ELF_R_SYM(rel->r_info)); req.flags = SYMLOOK_EARLY; - for (srcobj = dstobj->next; srcobj != NULL; srcobj = srcobj->next) { + for (srcobj = globallist_next(dstobj); srcobj != NULL; + srcobj = globallist_next(srcobj)) { res = symlook_obj(&req, srcobj); if (res == 0) { srcsym = req.sym_out; |