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: David Kilroy <David dot Kilroy at arm dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>, nd <nd at arm dot com>
- Date: Mon, 21 Oct 2019 14:11:52 +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=O8/Qr/+kc6lIR9IjU7e/DDs8UR+ePaiXptivu2StF54=; b=lnqKsSFz1O0GJtVDnfZx0T1XCsB2vFYKyXkjGZYyL7na4OqOJ/SmHyYV2Z8+y+rjeNF+GZ/J+jG4bFQnuagWdXosac4SC7r17yuUEJPaLg8iWBMWRnh1nFicHWLrdVVVsd3ckV46AgL8x+gOsM/omT0AHECeu7KxZ+xZ/K22B3mAc65t1jH+AmpehE7QLpQq7DHivrTFU3Fq+L5+rE1jUGm2G3ph2s51M6eksnWz+ENejH7MNYaFXvGZQmhAIhloRE5ugKL/V4cs2O0ZWraVELRSNnZm/DAoAoVOWtN8vT5mSuLgqGrZGRB51+961dPrc5o21bSwIPIRBMxYlhQ9UA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S0A0gh9kZF8fAcKp7vWmumyNdOwbJUqX/4qg4uKM8u1GHbGfVyUEou3SajiIMcEYJXdJPPRcAyM/sqbNjLkuRxcHbaQUIjIp1g5hOlIQqsyfzABFSUZu2PFTCwXc63VFH3NphYBMp6gDjkt9kYHtJ5s9XTIp2ZZWsEv0bTYszi+e0ip0tHlrs+wVS2mbYfn65A7ZFRhIUyEUeNnJclRL5UfEYQBREjqiW0KBJcUqJB4eXfFLdjr8dz/gvqicVErATabEF821BKwsaAL3+Obylw//c1pSlJYPOTFFuXwHyGHoS01rzGWrvmdohTwitjsCSZJhqYGGCpMrN5SbRGVljw==
- Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=David dot Kilroy 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>
> Florian Weimer
> * David Kilroy:
> [Changes related to inserting the filtee before the filter]
> David, have you ever used filters on Solaris? Can you comment on the
> expected behavior for them?
Unfortunately, I don't have access to Solaris.
I've commented below.
> >>I have much more trouble ascertaining whether this change is correct.
> >>Are we certain that new->l_initfini is not a subset of the maps that
> >>have been loaded?
> > That is something I'm not sure about (yet). I'll look into this
> > further. My reasoning for switching to using l_initfini was that the
> > filtee's constructors were crashing, and clearly anything that needed
> > initialisation ought to be relocated first.
> In an off-list discussion, Carlos also had some concerns about the state of
> filter support. Based on the Solaris documentation,
> it seems to me that filters are mostly a link editor feature. Sorting the filtee
> prior to the filter appears to be the right thing to do.
This is the documentation I've been looking at for filter objects.
> However, what seems to be missing currently is ignoring the filter during
> symbol binding. I think if the filter contains symbols that are not present in
> the filtee, it is possible to bind them. That does not seem to match the
> documented Solaris behavior.
That's my understanding. To get the Solaris behaviour in this case we could
remove the filter from search (and init) paths - but only for filter objects
though, as auxiliary objects may want to bind some symbols in the filter.
> The Solaris documentation does not mention symbol filtering (constraining
> the set of exported symbols) at run time. This kind of filtering is achieved at
> run time because the link editor only looks at symbols in the filter and does
> not consult the filtee.
My assumption was that on Solaris only the symbols mentioned in the filter
actually get bound at runtime. I haven't looked at what would have to be done
to support that behaviour. I'm sounds non-trivial :)
This would matter if the filtee exported a symbol that the application actually
wanted to pick up from a library later on the search path. As far as I'm aware
this doesn't occur for us, so the lack of support is not a problem.
> On GNU, I think we support this via a linker script which specifies a link-time
> object with a link-time ABI (typically a subset of the run-time ABI). Therefore,
> filter support is redundant.
Do you have a link with some description? I've been digging around, and not
come across separately specifying the link-time ABI.
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...