This is the mail archive of the libc-hacker@sourceware.org mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi! If ld.so is prelinked and a program is executed through ld.so (/lib*/ld-*.so --library-path whatever /the/program) and kernel mmaps prelink at its base address, then _r_debug.r_map is NULL. _r_debug is initialized by _dl_debug_initialize calls. When invoking /the/program directly, GL(dl_ns)[ns]._ns_loaded is initialized before first call to _dl_debug_initialize, but when invoking program using ld.so, it is non-NULL only on the second and following _dl_debug_initialize calls. But at that point _r_debug.r_brk is already non-zero. If ld.so is not prelinked or kernel mmaps it elsewhere, one of the following _dl_debug_initialize calls will have ldbase != 0 and it will be still reinitialized. But when rtld's l_addr is 0 (i.e. it is mmapped at the prelinked address), _dl_debug_initialize never reinitializes it. We talked about splitting _dl_debug_initialize into _dl_debug_initialize and _dl_debug_query which wouldn't initialize it, just return the struct address, while _dl_debug_initialize would reinitialize always, but I think that just can't work in other namespaces. The following patch is much shorter, we simply keep reinitializing until r_map is non-NULL. If r->r_map is non-NULL, we know r->r_brk is also != 0. 2006-10-09 Jakub Jelinek <jakub@redhat.com> * elf/dl-debug.c (_dl_debug_initialize): Check r->r_map for 0 rather than r->r_brk. --- libc/elf/dl-debug.c.jj 2006-10-19 17:28:01.000000000 +0200 +++ libc/elf/dl-debug.c 2006-11-09 12:04:37.000000000 +0100 @@ -54,7 +54,7 @@ _dl_debug_initialize (ElfW(Addr) ldbase, else r = &GL(dl_ns)[ns]._ns_debug; - if (r->r_brk == 0 || ldbase != 0) + if (r->r_map == NULL || ldbase != 0) { /* Tell the debugger where to find the map of loaded objects. */ r->r_version = 1 /* R_DEBUG_VERSION XXX */; Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |