This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH,HURD] Fix call to _dl_sysdep_start_cleanup
- From: Samuel Thibault <samuel dot thibault at ens-lyon dot org>
- To: roland at gnu dot org
- Cc: libc-alpha at sources dot redhat dot com
- Date: Thu, 16 Apr 2009 19:30:56 +0200
- Subject: [PATCH,HURD] Fix call to _dl_sysdep_start_cleanup
Hello,
_dl_sysdep_start_cleanup() is supposed to be called after all calls
to _dl_relocate_object(), because the latter somtimes calls mprotect.
This is currently not the case, here is a patch to fix it. That fixes
GNU/Hurd boot with libc compiled with binutils >= 2.19.
Samuel
2009-04-16 Samuel Thibault <samuel.thibault@ens-lyon.org>
* elf/rtld.c (dl_main): Really call _dl_sysdep_start_cleanup after all
calls to _dl_relocate_object.
Index: elf/rtld.c
===================================================================
RCS file: /cvs/glibc/libc/elf/rtld.c,v
retrieving revision 1.382
diff -u -p -r1.382 rtld.c
--- elf/rtld.c 1 Apr 2009 00:26:18 -0000 1.382
+++ elf/rtld.c 16 Apr 2009 01:46:07 -0000
@@ -2181,8 +2181,6 @@ dl_main()
if (l->l_tls_blocksize != 0 && tls_init_tp_called)
_dl_add_to_slotinfo (l);
}
-
- _dl_sysdep_start_cleanup ();
}
else
{
@@ -2237,13 +2235,6 @@ dl_main()
HP_TIMING_DIFF (relocate_time, start, stop);
- /* Do any necessary cleanups for the startup OS interface code.
- We do these now so that no calls are made after rtld re-relocation
- which might be resolved to different functions than we expect.
- We cannot do this before relocating the other objects because
- _dl_relocate_object might need to call `mprotect' for DT_TEXTREL. */
- _dl_sysdep_start_cleanup ();
-
/* Now enable profiling if needed. Like the previous call,
this has to go here because the calls it makes should use the
rtld versions of the functions (particularly calloc()), but it
@@ -2299,6 +2290,13 @@ dl_main()
HP_TIMING_ACCUM_NT (relocate_time, add);
}
+ /* Do any necessary cleanups for the startup OS interface code.
+ We do these now so that no calls are made after rtld re-relocation
+ which might be resolved to different functions than we expect.
+ We cannot do this before relocating the other objects because
+ _dl_relocate_object might need to call `mprotect' for DT_TEXTREL. */
+ _dl_sysdep_start_cleanup ();
+
#ifdef SHARED
/* Auditing checkpoint: we have added all objects. */
if (__builtin_expect (GLRO(dl_naudit) > 0, 0))