This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 0/3] elf: Allow dlopen of filter object to work [BZ #16272]
- From: David Kilroy <David dot Kilroy at arm dot com>
- To: "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Cc: nd <nd at arm dot com>
- Date: Thu, 17 Oct 2019 10:33:18 +0000
- Subject: [PATCH 0/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=t0ICEtP1nMYU8HmwanTRO7LaLbn68khs+TTJenx/dSs=; b=avAw3XhOgMdaGuzYo3rBmcCBTpgAWVG2EyEcEUy5xtyvREyh7TKn1gGyPMO/q6jSqQGElnUfSoOUMODLsJIgat5vXl6UWb8t+cHx7lpKOya700EP/R4hJSxtZcn62PoQ7vMJ3c9PSIZIHCqQpLGWRoVAgyC4QJjRBATgB+vPl89bIxZMMuxVTotONdcwuNjEyS0xrt6Xs5yPVel1cenev/m8Vloo9860ANDShMl13TX3X7+tia2Sj/miczGqD7R+AxJWCDKdjhiENpioF4tgXHXYW6EsH50krGv804A2Twe07eFakKxavwJ/doCL0p4RIQnOZF3KrESsnOKsEXRybg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SoPNdjH7l0No2uwCtgiRzYzG4aX4toSRpg3s2qkRGoTA9UgGZa0VNuE786AdnWcS9Z0fHAL6G7sZz66DsgKyeiEJfmiXmmLpYCLUOveNru0Agr7eA/X4fD5nsatzdhiIdxWUN2pM3OG+EtrU1QNOKpsarXfX8f5i/8sUMP9xQbfwN+tOxYjhbSFAFnse2jUo+nhxI6tEOw5Qbu84++TsRIKvBdzuyGx2jq55e6BXbftRB5o2yEvloiBGhUQ7NjIdDYxMUPYw3RF0aJmGHRzjPAQwoBqlCpCd046zb4pOQs+8aJ8yd1tz7TR95Yp9QRWqlc+HewEZLbfQKZFDpkMN7w==
- Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=David dot Kilroy at arm dot com;
Glibc currently supports filter objects (shared libraries compiled
with -Wl,--filter) by inserting the filtee ahead of the filter object
in the search path. This works for the case where the application is
linked against the filter object.
When the application tries to use dlopen to load the filter object,
glibc currently fails with:
Inconsistency detected by ld.so: dl-deps.c: 574: _dl_map_object_deps:
Assertion `map->l_searchlist.r_list[0] == map' failed!
This fails because dl_map_object_deps assumes that the library being
loaded is at the head of the search list.
The filtee object also needs to be relocated when dlopen is used.
The first patch attempts to address these in a minimal way, and adds a
test case verify the fix.
The follow up patches do some cleanup. If we can use l_initfini to do
the relocations, then the call to _dl_sort_maps is redundant. Once
that is removed there is no need for the stack allocation of map.
David Kilroy (3):
elf: Allow dlopen of filter object to work [BZ #16272]
elf: avoid redundant sort in dlopen
elf: avoid stack allocation in dl_open_worker
elf/Makefile | 12 +++++++++--
elf/dl-deps.c | 35 ++++++++++++++++++++++--------
elf/dl-open.c | 32 +++++++++++++--------------
elf/tst-filterobj-dlopen.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++
elf/tst-filterobj-flt.c | 24 +++++++++++++++++++++
elf/tst-filterobj-lib.c | 24 +++++++++++++++++++++
elf/tst-filterobj-lib.h | 18 ++++++++++++++++
elf/tst-filterobj.c | 34 +++++++++++++++++++++++++++++
8 files changed, 205 insertions(+), 28 deletions(-)
create mode 100644 elf/tst-filterobj-dlopen.c
create mode 100644 elf/tst-filterobj-flt.c
create mode 100644 elf/tst-filterobj-lib.c
create mode 100644 elf/tst-filterobj-lib.h
create mode 100644 elf/tst-filterobj.c
--
2.7.4