From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9BDF13858D32; Tue, 19 Sep 2023 06:38:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9BDF13858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1695105509; bh=kMWeG5qL1mgltVndBvOmN3eIYaZgFrGjNLaqTB/IwgI=; h=From:To:Subject:Date:From; b=Ca3aPW55Gv+y7J+y37aI1SJUksL1wRTRzktP9ndqPG3TNFs2eJCAIPmXsyrWm6reG 1T/jIB+KjFzi7JSPBJ7XVSa4LDAq+tNlY6IXhakrqG5oqndrtUMOeMS/g8LKBkOjX+ E+STOWBEKrk/aL9LvYBc2aLq1TdZBvBHJ/FsAZrE= From: "fweimer at redhat dot com" To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/30869] New: Fine-tune ELF destructor ordering Date: Tue, 19 Sep 2023 06:38:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: dynamic-link X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fweimer at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30869 Bug ID: 30869 Summary: Fine-tune ELF destructor ordering Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P2 Component: dynamic-link Assignee: unassigned at sourceware dot org Reporter: fweimer at redhat dot com Target Milestone: --- The change in bug 30785 to use reverse constructor orders for destructors d= oes not match expectations of existing applications when objects are destructed= by _dl_fini. In particular, the destructors for the main program need to run first. This= may trigger additional destructor invocations if dlclose is called. After the m= ain program, the initially loaded objects should be destroyed, potentially triggering more dlclose calls. Only after that, the remaining dlopen'ed obj= ects should be destroyed. This way, applications have some control over destruct= or ordering through there dlclose calls, which seems useful. A similar issue occurs if dlopen is called from ELF constructors: The curre= nt code schedules an object for later destruction *before* it invokes ELF constructors. This means that dlopen'ed objects from ELF constructors may be destructed first, even if the original object calling dlopen might want to close these objects by calling dlclose from its destructor. These changes mostly apply to _dl_fini because when dlclose calls ELF destructors, explicitly dlopen'ed objects (from ELF constructors etc.) still have incremented direct-open counters, and they only become eligible for destruction if invoked ELF destructors invoke dlclose. --=20 You are receiving this mail because: You are on the CC list for the bug.=