This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH 1/3] elf: Allow dlopen of filter object to work [BZ #16272]
- From: Szabolcs Nagy <Szabolcs dot Nagy at arm dot com>
- To: Florian Weimer <fweimer at redhat dot com>, David Kilroy <David dot Kilroy at arm dot com>
- Cc: nd <nd at arm dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Mon, 21 Oct 2019 16:42:16 +0000
- Subject: Re: [PATCH 1/3] elf: Allow dlopen of filter object to work [BZ #16272]
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=605ES3SGP/vF5j83wqVU/pm7gaoCVPhr3rP/bNOduag=; b=CWo/lG+8mVwUDVfvEBmxeGkc27NPu6J1EBRer68A8svAf/qBb2PdABEcrDRAiix9lG78rKBbl1G8gBaaD1SWcYI+DqvoCLnE9/ieOiHpBCgMOHbwOKsoL+NCCiTySYG0inakxYez11mz/FLeAEF7pg+EycbtR9lBKi92CLqoYRBHwF5xqJyyUH9jjLR8nYZBj1pUQRRL1bRp7AIJI07FZWwUBwlm1HUUzGJH2g99/sFYPxKMY05K94i3qPe6eOs6suYdIPAqgZFCb6tr+XO6NhvYP5KtSanNqckFu9rgRUJlaOM+0hwgC1Ats9qTURuL3jAQDA9nAeQPwlKQPiHhkw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=STyXcta1mFDamVKsKMEZw/qDfab3ELbWIuVWPKzKqRxmB/46FdAeEpMvYV8Vfh//wfsVhnUtcixG2paaPmwRdvG3yuG8PtJKysLgznpmb8Pu6uwDqoepMf8mdEOKZdbNbcFwWaSnJqwJ75K0x2DLLzrTTrBKTftj/YeW4NIZxl0Oylt3NUuNNWaXfiYzLDTO56354UNXRpU8TB0wOdcGCNiiowVnmkQdxL+y7V3UAtI/2Cb0RMJ4UQCo1DPvFE2ogl17yazzQyYeHe3wT9f2a6OQ+dG4Z6acZha/5PlmAFVvu0pDAdOMwG0ZYQ0cB0vm3ltKhvzNUULErjaljFjcRw==
- Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs dot Nagy at arm dot com;
- References: <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <AM0PR08MB40687D100B008154893A0870916C0@AM0PR08MB4068.eurprd08.prod.outlook.com> <email@example.com> <AM0PR08MB4068157ED98FB1133F64226F91690@AM0PR08MB4068.eurprd08.prod.outlook.com> <firstname.lastname@example.org>
On 21/10/2019 15:21, Florian Weimer wrote:
> * David Kilroy:
>> I suspect that this wouldn't work in my use case though. External projects
>> link against the filter object we produce, and don't know about the filtee
>> (which is effectively an implementation detail). Different suppliers can also
>> supply the library (which may or may not be a filter object), so having the
>> external project link the library differently based on implementation is...
> If you currently use a symbolic link for the .so link object, it should
> be easy enough to replace that with the script. If the link time DSO is
> stored under its soname, then of course this does not work, but you
> wouldn't be able to transparently inject the filter either, so that
> doesn't seem to be your scenario.
linker script only works at static link time, not for dlopen.
> I'm less clear how this all interacts with dlopen. It seems that you
> want a simple alias mechanism for dlopen. In that case, a simple
> symbolic link with the soname should work, and you don't need a separate
> filter object, either.
the scenario is:
libA.so and libB.so export a set of symbols. this is abi
and there are multiple providers of libA.so and libB.so.
one provider wants to have a single libinternal.so that
defines all the symbols of libA and libB as they share a
lot of code.
(1) having libA.so and libB.so as "wrapper libraries" around
libinternal.so with RTLD_NEXT would work, but that's less
efficient because of the extra indirection,
(2) the filter library magic would avoid the wrapper.
(3) symlinking libA.so and libB.so to libinternal.so makes
all symbols visible when either of them is loaded, polluting
the link namespace.
(4) creating two copies of libinternal.so with different
set of exported symbols would work just waste memory (assuming
there is no internal global state that needs to be shared)
i think if link namespace pollution is ok then (3) is the best
solution otherwise it's less clear, but probably (4) is most
(libinternal.so is a video driver lib and libA, libB, .. are
various opengl libs with fixed abi)