summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-01-04 17:17:11 +0000
committerkib <kib@FreeBSD.org>2012-01-04 17:17:11 +0000
commit28642efd920da4bf04b76debc7f5c5ccec933f42 (patch)
treea8416e8ccdf1e476ad85f3e81d13f307fdf0526c /libexec
parent58790da236a467b022f57ba4881124ec51d14e9c (diff)
downloadFreeBSD-src-28642efd920da4bf04b76debc7f5c5ccec933f42.zip
FreeBSD-src-28642efd920da4bf04b76debc7f5c5ccec933f42.tar.gz
Postpone the resolution of IRELATIVE relocations and IFUNC-targeted
relocations until tls is initialized and stacks permissions correctly set. This allows the ifunc to call malloc(3) and some other heavy services. Add debug banner. MFC after: 3 days
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/rtld.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 6cddd15..3973c67 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -515,10 +515,6 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
ld_bind_now != NULL && *ld_bind_now != '\0', &obj_rtld, NULL) == -1)
die();
- if (resolve_objects_ifunc(obj_main,
- ld_bind_now != NULL && *ld_bind_now != '\0', NULL) == -1)
- die();
-
dbg("doing copy relocations");
if (do_copy_relocations(obj_main) == -1)
die();
@@ -549,6 +545,11 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
map_stacks_exec(NULL);
+ dbg("resolving ifuncs");
+ if (resolve_objects_ifunc(obj_main,
+ ld_bind_now != NULL && *ld_bind_now != '\0', NULL) == -1)
+ die();
+
wlock_acquire(rtld_bind_lock, &lockstate);
objlist_call_init(&initlist, &lockstate);
objlist_clear(&initlist);
OpenPOWER on IntegriCloud