svn commit: r229508 - head/libexec/rtld-elf

Konstantin Belousov kib at FreeBSD.org
Wed Jan 4 17:17:12 UTC 2012


Author: kib
Date: Wed Jan  4 17:17:11 2012
New Revision: 229508
URL: http://svn.freebsd.org/changeset/base/229508

Log:
  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

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Wed Jan  4 17:01:12 2012	(r229507)
+++ head/libexec/rtld-elf/rtld.c	Wed Jan  4 17:17:11 2012	(r229508)
@@ -515,10 +515,6 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
       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_
 
     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);


More information about the svn-src-head mailing list