This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Fixes for powerpc64 libc_p
On Wed, Oct 06, 2004 at 03:16:12PM -0700, Ulrich Drepper wrote:
> Alan Modra wrote:
> > rtld_search_dirs is declared as
> > static struct r_search_path_struct rtld_search_dirs attribute_relro;
> > ie. the struct will be write protected.
>
> Fix your environment. This can never trigger if you have a correct setup.
Never seems to be getting shorter these days..
$ readelf -a --wide elf/ld.so
[snip]
[12] .data.rel.ro PROGBITS 000000000002fce0 01fce0 0001b0 00 WA 0 0 8
[snip]
111: 000000000002fe68 16 OBJECT LOCAL DEFAULT 12 rtld_search_dirs
Right before the instruction that segfaults:
$ cat maps
08000000-0801f000 r-xp 00000000 08:07 3137067 .../elf/ld.so
0802f000-08030000 r--p 0001f000 08:07 3137067 .../elf/ld.so
08030000-08033000 rw-p 00020000 08:07 3137067 .../elf/ld.so
10000000-10001000 r-xp 00000000 08:07 3143297 .../dlfcn/failtest
[snip]
The mprotect that sets 0802f000-08030000 read-only happens via
_dl_protect_relro, called from _dl_relocate_object, called from dl_main
here:
if (GL(dl_rtld_map).l_opencount > 1)
{
/* There was an explicit ref to the dynamic linker as a shared lib.
Re-relocate ourselves with user-controlled symbol definitions. */
HP_TIMING_NOW (start);
_dl_relocate_object (&GL(dl_rtld_map), GL(dl_loaded)->l_scope, 0, 0);
--
Alan Modra
IBM OzLabs - Linux Technology Centre