svn commit: r229769 - stable/9/libexec/rtld-elf

Konstantin Belousov kib at FreeBSD.org
Sat Jan 7 10:49:05 UTC 2012


Author: kib
Date: Sat Jan  7 10:49:04 2012
New Revision: 229769
URL: http://svn.freebsd.org/changeset/base/229769

Log:
  MFC r229508:
  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.

Modified:
  stable/9/libexec/rtld-elf/rtld.c
Directory Properties:
  stable/9/libexec/rtld-elf/   (props changed)

Modified: stable/9/libexec/rtld-elf/rtld.c
==============================================================================
--- stable/9/libexec/rtld-elf/rtld.c	Sat Jan  7 10:33:01 2012	(r229768)
+++ stable/9/libexec/rtld-elf/rtld.c	Sat Jan  7 10:49:04 2012	(r229769)
@@ -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-stable-9 mailing list