aboutsummaryrefslogtreecommitdiff
path: root/libexec/rtld-elf/i386
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2016-01-20 07:21:33 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2016-01-20 07:21:33 +0000
commit9fee0541f2815c1ea70ccc13402f3ed6c4ed9fdf (patch)
tree80a3a7f9f52931a90d1e9533d93f368fdd3ed703 /libexec/rtld-elf/i386
parenta63987426ff03a08080457524bc453a8d69ec526 (diff)
downloadsrc-9fee0541f2815c1ea70ccc13402f3ed6c4ed9fdf.tar.gz
src-9fee0541f2815c1ea70ccc13402f3ed6c4ed9fdf.zip
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
Notes
Notes: svn path=/head/; revision=294373
Diffstat (limited to 'libexec/rtld-elf/i386')
-rw-r--r--libexec/rtld-elf/i386/reloc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c
index 55b653713242..2d6021c97796 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;