public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/3] elf: Allow dlopen of filter object to work [BZ #16272]
@ 2019-10-17 10:33 David Kilroy
  2019-10-17 10:33 ` [PATCH 3/3] elf: avoid stack allocation in dl_open_worker David Kilroy
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: David Kilroy @ 2019-10-17 10:33 UTC (permalink / raw)
  To: libc-alpha; +Cc: nd

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

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2019-10-22 14:29 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-17 10:33 [PATCH 0/3] elf: Allow dlopen of filter object to work [BZ #16272] David Kilroy
2019-10-17 10:33 ` [PATCH 3/3] elf: avoid stack allocation in dl_open_worker David Kilroy
2019-10-17 10:33 ` [PATCH 1/3] elf: Allow dlopen of filter object to work [BZ #16272] David Kilroy
2019-10-18 11:43   ` Florian Weimer
2019-10-18 15:09     ` David Kilroy
2019-10-21 11:27       ` Florian Weimer
2019-10-21 14:12         ` David Kilroy
2019-10-21 14:21           ` Florian Weimer
2019-10-21 16:42             ` Szabolcs Nagy
2019-10-22  9:22               ` David Kilroy
2019-10-22  9:49                 ` Florian Weimer
2019-10-22 11:20                   ` David Kilroy
2019-10-22  9:43               ` Florian Weimer
2019-10-22 11:18                 ` David Kilroy
2019-10-22 11:22                   ` Florian Weimer
2019-10-22 11:27                     ` David Kilroy
2019-10-22 11:31                       ` Florian Weimer
2019-10-22  8:28             ` David Kilroy
2019-10-22  8:36               ` Florian Weimer
2019-10-22  9:39                 ` David Kilroy
2019-10-22  9:57                   ` Florian Weimer
2019-10-22 11:24                     ` David Kilroy
2019-10-22 14:29     ` David Kilroy
2019-10-17 10:33 ` [PATCH 2/3] elf: avoid redundant sort in dlopen David Kilroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).