From 5f1c6d1039bf8273173d337033d24a394bbbf3ae Mon Sep 17 00:00:00 2001 From: kib Date: Wed, 20 Jan 2016 07:21:33 +0000 Subject: 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 --- libexec/rtld-elf/powerpc/reloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libexec/rtld-elf/powerpc') diff --git a/libexec/rtld-elf/powerpc/reloc.c b/libexec/rtld-elf/powerpc/reloc.c index 1fe9676..89a0089 100644 --- a/libexec/rtld-elf/powerpc/reloc.c +++ b/libexec/rtld-elf/powerpc/reloc.c @@ -94,8 +94,8 @@ do_copy_relocations(Obj_Entry *dstobj) req.ventry = fetch_ventry(dstobj, ELF_R_SYM(rela->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; -- cgit v1.1