]> sourceware.org Git - glibc.git/commit
elf: Allow dlopen of filter object to work [BZ #16272]
authorDavid Kilroy <David.Kilroy@arm.com>
Wed, 12 Feb 2020 17:28:15 +0000 (14:28 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 12 Feb 2020 17:29:48 +0000 (14:29 -0300)
commiteb447b7b4bd6177f876ba9420ad9e048c27bae91
treecbde7ab262bfc6b74c6b4a7f9eb1984fdb3e6485
parent6721b9d52e3bdc7cbec97e6b2952c523c14aebee
elf: Allow dlopen of filter object to work [BZ #16272]

There are two fixes that are needed to be able to dlopen filter
objects. First _dl_map_object_deps cannot assume that map will be at
the beginning of l_searchlist.r_list[], as filtees are inserted before
map. Secondly dl_open_worker needs to ensure that filtees get
relocated.

In _dl_map_object_deps:

* avoiding removing relocation dependencies of map by setting
  l_reserved to 0 and otherwise processing the rest of the search
  list.

* ensure that map remains at the beginning of l_initfini - the list
  of things that need initialisation (and destruction). Do this by
  splitting the copy up. This may not be required, but matches the
  initialization order without dlopen.

Modify dl_open_worker to relocate the objects in new->l_inifini.
new->l_initfini is constructed in _dl_map_object_deps, and lists the
objects that need initialization and destruction. Originally the list
of objects in new->l_next are relocated. All of these objects should
also be included in new->l_initfini (both lists are populated with
dependencies in _dl_map_object_deps). We can't use new->l_prev to pick
up filtees, as during a recursive dlopen from an interposed malloc
call, l->prev can contain objects that are not ready for relocation.

Add tests to verify that symbols resolve to the filtee implementation
when auxiliary and filter objects are used, both as a normal link and
when dlopen'd.

Tested by running the testsuite on x86_64.
elf/Makefile
elf/dl-deps.c
elf/dl-open.c
elf/tst-auxobj-dlopen.c [new file with mode: 0644]
elf/tst-auxobj.c [new file with mode: 0644]
elf/tst-filterobj-aux.c [new file with mode: 0644]
elf/tst-filterobj-dlopen.c [new file with mode: 0644]
elf/tst-filterobj-filtee.c [new file with mode: 0644]
elf/tst-filterobj-filtee.h [new file with mode: 0644]
elf/tst-filterobj-flt.c [new file with mode: 0644]
elf/tst-filterobj.c [new file with mode: 0644]
This page took 0.071447 seconds and 5 git commands to generate.