From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2BC0B385840C; Fri, 10 Sep 2021 23:28:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BC0B385840C From: "glibc at v dot ewheeler.net" To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/18684] dlmopen a DSO that dlopen's into RTLD_GLOBAL segfaults. Date: Fri, 10 Sep 2021 23:28:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: dynamic-link X-Bugzilla-Version: 2.21 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: glibc at v dot ewheeler.net 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: security- X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: 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 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 23:28:38 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D18684 --- Comment #3 from Eric Wheeler --- Created attachment 13661 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D13661&action=3Ded= it 1-line patch plus comments originally written by Carlos O'Donell Here is a summary of related comments from Michael Kerrisk from here: https://sourceware.org/legacy-ml/libc-alpha/2015-07/msg00628.html --------------------------------------------------------------------- [...] This is precisely the use case the Solaris dlmopen() does support: isolation of load namespaces, while allowing DSOs inside a namespace to share symbols via RTLD_GLOBAL. >=20 > This trick fails for the same reason that calling dlmopen > with RTLD_GLOBAL would fail if you removed the check in dlfcn/dmlopen.c > (dlmopen_doit). When you go to add the DSO to the global > search list you find there is no search list setup. In the case of > the application we have rtld setup the global search list. >=20 > Which begs the question? What should the global search list > be for a new namespace? I propose that the global search > list for a new namespace should be a copy of the symbol search > list (scope) of the first DSO loaded into the namespace with > RTLD_GLOBAL, and subsequent RTLD_GLOBAL loads into the namespace > add to that list. The above is what Solaris appears to provide. [...] One other deviation that I note from Solaris. The dlopen() man page currently says: If filename is NULL, then the returned handle is for the main program. And this is what glibc currently does *regardless* of the namespace from which the dlopen(NULL, flags) call is made. But, in the context of dlmopen(LM_ID_NEWLM) namespaces, I'd expect this call to return=20 something like "the root of the this namespace". And that is what Solaris appears to do. [...] The dlmopen() seems to have been added to Solaris to support precisely the use cases that Carlos describes, and the glibc implementation doesn't support those cases at all. --=20 You are receiving this mail because: You are on the CC list for the bug.=