This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RE: [PATCH v4 1/3] elf: Allow dlopen of filter object to work [BZ #16272]
- From: David Kilroy <David dot Kilroy at arm dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Cc: nd <nd at arm dot com>
- Date: Wed, 19 Feb 2020 12:37:12 +0000
- Subject: RE: [PATCH v4 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=7jvQiObJTVP/0Akk+fntB0fPdtYFXdcO8erjwemKx0A=; b=ZA9dBrZkP0cymW3zpsH4o0yrDOoc8TSJAVqYYcvpVRHqvj8OGCmFh251nyfuhQDRs3KggqYAP9iqnHmvEjCVJ54kykyXuXP3IPIRwJ4xS81w3Gdat4zB9MxaqdtZbyOokSTa3RrpBw+kGlAREdOS9DpCVKAsu1ntZoFlmi27XAGegFmrHC+7mN7ACqSwnuj1DDKfMpob374lQvFkUYNDdF2mdRKoiZzL3jLlRc7tQtyx3BA5FT89eUt2CuUxHefLORp8iJge7or3uh7y33ve3kDM0scB+mYU22hK99HiA+gAv+sIHps19XzzgvKwgHL5FiqtxYdHo24xl2cY/7t7Fw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e98GRxCtgNYqzJo+4x7vVTjVl8nTatJ1VXFOtOE/uYnkBKJcqSTQjSOhL1cNk0xDAJp/JB1croT1vdS+WYaLgvG2mprRA6WwQ0s1hoHrgxAz64JsOzRQ1S5V+0a9loinyiVZ5Di1Gmgu691v4mh8DOr9UbJPBTmB+6qmRlxvL0qJd1rvpleVFvwb7Fox0NmFC8GfckuDI739I7fLVXNkUL/1Ya4Nxkz61qEUTnV5KxCZOeAOVG9Phc3WPE1c/hNpgj+Z77KWlQ0JmRIjqrfVpZPCUYIDcFZklTieuEWmFZAkBk92DJPb2eGyD+OvDtjykfTpc+zvhpQaqlmxEu71og==
- Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=David dot Kilroy at arm dot com;
- References: <1580296643-36839-1-git-send-email-david.kilroy@arm.com> <1580296643-36839-2-git-send-email-david dot kilroy at arm dot com> <d84eb46e-7a30-0d6b-8385-6ce3678f81c8@linaro.org> <VI1PR08MB29581BC5743AB9024168051B91180@VI1PR08MB2958.eurprd08.prod.outlook.com> <c2de4d42-7beb-9dce-d5f7-168a1b50af5f@linaro.org>
> On 11/02/2020 12:59, David Kilroy wrote:
> >
> > Adhemerval Zanella said:
> >>
> >> On 29/01/2020 08:17, David Kilroy wrote:
> >>> 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.
> >>
> >> LGTM, thanks.
> >>
> >> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> >
> >
> > <snip>
> >
> >>> diff --git a/elf/tst-auxobj-dlopen.c b/elf/tst-auxobj-dlopen.c
> >>> new file mode 100644
> >>> index 0000000..7f91bdd
> >>> --- /dev/null
> >>> +++ b/elf/tst-auxobj-dlopen.c
> >>> @@ -0,0 +1,47 @@
> >>> +/* Test for BZ16272, dlopen'ing an auxiliary filter object.
> >>
> >> Just a nip and tuck: usually bugzilla reports are references as
> >> BZ#NNNNN.
> >
> > Thanks for reviewing! Should I resubmit with this fixed? I'd also
> need
> > someone to actually apply the changes (assuming no other objections).
>
> I can take care of applying this patch and no need to resubmit, I can
> change it locally for you.
>
I see the patches have been committed now :)
Thanks for the help!
Dave.