public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/11724] New: ld.so - Initialization and Termination Functions incorrectly ordered
@ 2010-06-18 18:33 werkt0 at gmail dot com
  2010-06-18 18:40 ` [Bug libc/11724] " werkt0 at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: werkt0 at gmail dot com @ 2010-06-18 18:33 UTC (permalink / raw)
  To: glibc-bugs

The order of initialization and termination functions called when loading or
exiting via the loader is being sorted incorrectly in particular cases
(described below) according to the TIS ELF 1.2 standard:

"Before the initialization code for any object A is called, the initialization
code for any other objects that object A depends on are called."

The partial sorting algorithm used in elf/dl-deps.c and elf/dl-fini.c is
incorrect when the sorting section is reached with a particular (order
dependent) dependency hierarchy.  I have not been able to boil down to a
canonical example, but have anonymized it, and will attach following submission.
 Additionally, the partial sort is not input-order independent, as multiple runs
of the existing sort on the failure set, repeating if dependencies are found out
of order, is convergent.

The partial sort is not sufficient to perform the dependency analysis on all
inputs given the requirements of the standards doc, and I have drafted a patch
which uses the tsort implementation from coreutils.  This new sorting has been
tested on all cases where the current ld.so initializes things in the incorrect
order, and on a number of other programs.  The inability to reliably initialize
objects in the correct order is a major issue for me, particularly when working
with C++ and globally initialized variables dependent on linked objects'
initializations.

-- 
           Summary: ld.so - Initialization and Termination Functions
                    incorrectly ordered
           Product: glibc
           Version: 2.11
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: werkt0 at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: i686-linux-gnu
  GCC host triplet: i686-linux-gnu
GCC target triplet: i686-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=11724

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 12+ messages in thread
[parent not found: <bug-11724-131@http.sourceware.org/bugzilla/>]

end of thread, other threads:[~2014-06-30 17:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-18 18:33 [Bug libc/11724] New: ld.so - Initialization and Termination Functions incorrectly ordered werkt0 at gmail dot com
2010-06-18 18:40 ` [Bug libc/11724] " werkt0 at gmail dot com
2010-06-18 20:17 ` werkt0 at gmail dot com
2010-06-19 19:17 ` drepper at redhat dot com
2010-06-21 20:12 ` werkt0 at gmail dot com
2010-06-22 11:28 ` schwab at linux-m68k dot org
2010-06-22 16:55 ` werkt0 at gmail dot com
     [not found] <bug-11724-131@http.sourceware.org/bugzilla/>
2010-11-18 14:15 ` schwab@linux-m68k.org
2011-01-20  1:10 ` drepper.fsp at gmail dot com
2011-08-02 20:21 ` werkt0 at gmail dot com
2011-10-29 17:30 ` drepper.fsp at gmail dot com
2014-06-30 17:46 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).