From: David Kilroy <David.Kilroy@arm.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>
Cc: nd <nd@arm.com>
Subject: RE: [PATCH v3 1/3] elf: Allow dlopen of filter object to work [BZ #16272]
Date: Tue, 21 Jan 2020 16:34:00 -0000 [thread overview]
Message-ID: <VI1PR08MB2958D43F83AFC179D2657930910D0@VI1PR08MB2958.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <DB6PR0801MB1751580C5C28AC97DA6C4D1991310@DB6PR0801MB1751.eurprd08.prod.outlook.com>
> -----Original Message-----
> From: David Kilroy
> > -----Original Message-----
> > From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> >
> > > diff --git a/elf/dl-deps.c b/elf/dl-deps.c
> > > index c29b988..bb85c83 100644
> > > --- a/elf/dl-deps.c
> > > +++ b/elf/dl-deps.c
> > > @@ -550,13 +550,14 @@ Filters not supported with
> > LD_TRACE_PRELINKING"));
> > > }
> > >
> > > /* Maybe we can remove some relocation dependencies now. */
> > > - assert (map->l_searchlist.r_list[0] == map);
> >
> > Ok, the first entry is the filtee object.
> >
> > > struct link_map_reldeps *l_reldeps = NULL;
> > > if (map->l_reldeps != NULL)
> > > {
> > > - for (i = 1; i < nlist; ++i)
> > > + for (i = 0; i < nlist; ++i)
> > > map->l_searchlist.r_list[i]->l_reserved = 1;
> > >
> > > + /* Avoid removing relocation dependencies of the main binary.
> > */
> > > + map->l_reserved = 0;
> > > struct link_map **list = &map->l_reldeps->list[0];
> > > for (i = 0; i < map->l_reldeps->act; ++i)
> > > if (list[i]->l_reserved)
> > > @@ -581,16 +582,32 @@ Filters not supported with
> > LD_TRACE_PRELINKING"));
> > > }
> > > }
> > >
> > > - for (i = 1; i < nlist; ++i)
> > > + for (i = 0; i < nlist; ++i)
> > > map->l_searchlist.r_list[i]->l_reserved = 0;
> > > }
> >
> > I am trying to understand why we can't skip first element here.
> Neither
> > of the tests actually exercise this code patch (they won't add a
> > dependency on l_reldeps), so could you provide an example/testcase
> > where it requires such change?
>
> I haven't observed the use case that this code handles. I just tried to
> maintain the existing behaviour that we avoid doing this for the main
> object.
>
> I've been trying to understand what triggers this, but not getting very
> far.
> Does anyone have any hints as to how I need to setup the test so that
> we do
> trigger relocation removals?
OK, so I git blamed this code to commit c4bb124a75 from 2001. I adapted
elf/relmod5 to include a filter library, and that is working. But it's not
hitting the relocation removal code (checked by adding _dlerror_printfs).
I then ran all tests in the elf directory. Only elf/tst-libc_dlvsym-static and
elf/tst-dlmopen1 enter the for loop, but the l_reserved check is always false.
In both of the above cases map is libc.so.6 and list[i] is libdl.so.2
I verified the same is the case without any of my commits applied.
Have changes elsewhere superseded this? Suggestions as to what I should do
here appreciated :)
Dave.
next prev parent reply other threads:[~2020-01-21 15:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-03 17:30 [PATCH v3 0/3] " David Kilroy
2019-12-03 17:30 ` [PATCH v3 1/3] " David Kilroy
2020-01-14 18:31 ` Adhemerval Zanella
2020-01-15 12:37 ` David Kilroy
2020-01-17 14:04 ` Adhemerval Zanella
2020-01-17 17:00 ` David Kilroy
2020-01-21 16:34 ` David Kilroy [this message]
2020-01-22 20:39 ` Adhemerval Zanella
2019-12-03 17:30 ` [PATCH v3 2/3] elf: avoid redundant sort in dlopen David Kilroy
2020-01-14 19:42 ` Adhemerval Zanella
2019-12-03 17:30 ` [PATCH v3 3/3] elf: avoid stack allocation in dl_open_worker David Kilroy
2020-01-14 20:04 ` Adhemerval Zanella
2019-12-18 16:32 ` [PATCH v3 0/3] elf: Allow dlopen of filter object to work [BZ #16272] David Kilroy
2019-12-18 19:33 ` Adhemerval Zanella
2019-12-19 11:43 ` David Kilroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=VI1PR08MB2958D43F83AFC179D2657930910D0@VI1PR08MB2958.eurprd08.prod.outlook.com \
--to=david.kilroy@arm.com \
--cc=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.org \
--cc=nd@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).