This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RE: [PATCH v3 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>
- Date: Wed, 15 Jan 2020 12:03:37 +0000
- Subject: RE: [PATCH v3 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=Qra61AtaDbcHzVfsP/iAq3K8vZJDn5NH8Y73EBDfVTY=; b=Q35X6ibOQpRjtFU8oxewPNCfr8dAuM549jp3Uq1mTbxcbokpIVPRCt4LDm8zgpYLLvIT4gnj97YMzOBOJ8Zij+3/SIpjqETJlM8JdR1gBD9WG6Mt4cOEzvCQQn0Pidfbe8jvDqdBLl5QZ6oYtQt7ip1tzH6xd7T60TIipPAS0auAjbiTssor4QT3T8C3t1HNJMNp1rFKqwVQRIbKMgLhUzyqr//ed1aNYQ4DqM6UjIbTL1I4adajszK7DScqPNVKOgOIGhysD+h4pHgQzoK2Yyq1kLYKLD4H7tfIk8tnBfmgfHuJfz3c6Ga5QQf/KOCEYfJs3MUKnHmYq2fKGuTo8Q==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KfuAWbnmufjF3ZpqDFgr0nS6mdMelNW2vnhh3McWkdoUkR3igVNVYrfjtcHdsYK+IaAFuUduj4bis19rkjmDPz9cdKw6p/2r99SoIZ1THdAG+6M2ZEY4omm5N6U296qo7Cxr5gqHhQ4fo+HdI5UY4rQqDSSaQcPh/bR0zyJGTfqDsVyZ+ThhtQmPBKu/0brHt0KcMQdafvbWz9K/efAYtJj9eE1l8itXJdODgx+sBU8G8EEdRviqMqQzYl3DYanUlclmGeRqn5bROZQeomFKOvl0BLYhojIZMK1Fn5sCO9aJwGkfCwIeInHHMeWojpdRn1RQBjFzma9Zo9ofldNvvA==
- Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=David dot Kilroy at arm dot com;
- References: <1575394197-18006-1-git-send-email-david.kilroy@arm.com> <1575394197-18006-2-git-send-email-david.kilroy@arm.com> <2729fb89-bc76-6b15-8f52-50322e6d0307@linaro.org>
> -----Original Message-----
> From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
>
> Since these are the only filter tests, I think we should also add some
> minimal one to check for invalid filter filter object (which does not
> provide the required symbol interfaces provided by the filtee).
>
> I think also it is worth to extend the tests to cover for auxiliary
> filters as well (DT_AUXILIARY), since it intersects with DT_FILTERS.
> It should be similar to DT_FILTER tests, with the only difference
> that non existent auxiliary filters does not trigger a loader error
> (if the symbol is provided by the filter or another auxiliary filter).
>
> The patch itself looks good, thanks for working on it.
Thanks for the feedback!
I'll rebase and take a look at resolving your comments on the 3 commits.
That may take a couple days :)
I think all your comments are clear enough, and I should be able to
deal with. Just on this one...
> > - /* Sort the initializer list to take dependencies into account.
> The binary
> > - itself will always be initialize last. */
> > - memcpy (l_initfini, map->l_searchlist.r_list,
> > - nlist * sizeof (struct link_map *));
...
> > + if (i > 0)
> > + {
> > + /* Copy the binary into position 0. */
> > + memcpy (l_initfini, &map->l_searchlist.r_list[i],
> > + sizeof (struct link_map *));
> > + /* Copy the filtees. */
> > + memcpy (&l_initfini[1], map->l_searchlist.r_list,
> > + i * sizeof (struct link_map *));
> > + /* Copy the remainder. */
> > + memcpy (&l_initfini[i + 1], &map->l_searchlist.r_list[i + 1],
> > + (nlist - i - 1) * sizeof (struct link_map *));
>
> Ok (although I not sure if is the correct idiom to use memcpy to
> copy array of pointers
>
>
> > + }
> > + else
> > + memcpy (l_initfini, map->l_searchlist.r_list,
> > + nlist * sizeof (struct link_map *));
> > +
The original code was using a memcpy (presumably for speed), so I tried to
stick with that. I'm happy to change the new branch to use a loop to copy the
pointers - should I leave the original copy as a memcpy?
Dave.