[PATCH] Use libnss_files.so for tests posix/bug-ga2 and resolv/tst-leaks2 [BZ #26821]

H.J. Lu hjl.tools@gmail.com
Fri Nov 20 13:40:51 GMT 2020


On Fri, Nov 20, 2020 at 4:08 AM Stefan Liebler via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> The tests posix/bug-ga2-mem and resolv/mtrace-tst-leaks2 are failing on
> fedora 33 as mtrace reports memory leaks.
>
> The /etc/nsswitch.conf differs between
> Fedora 32: hosts:      files dns myhostname
> Fedora 33: hosts:      files resolve [!UNAVAIL=return] myhostname dns
>
> Therefore /lib64/libnss_resolve.so.2 (from systemd) and the dependencies
> libgcc_s.so.1 and libpthread.so.0 are loaded.
>
> Usually all malloc'ed resources from getaddrinfo / gethostbyname are freed
> and the libraries are dlclose'd in nss/nsswitch.c:libc_freeres_fn (free_mem).
> Unfortunately, /lib64/libnss_resolve.so.2 is marked with DF_1_NODELETE.
> As this library is not unmapped, you'll see "Memory not freed".
>
> Therefore those tests are now only relying on libnss_files.so by making
> them test-container tests and providing the required configuration files.
>
> By moving the tests to tests-container, those are now running with
> "make check".  Therefore the mtrace part of the tests are also moved
> from "make xcheck" to "make check".
>
> bug-ga2.c is now using test-driver.c in order to support WAIT_FOR_DEBUGGER
> environment variable.
> ---
>  posix/Makefile                           |  6 +++---
>  posix/bug-ga2.c                          | 13 +++++++------
>  posix/bug-ga2.root/etc/hosts             |  1 +
>  posix/bug-ga2.root/etc/nsswitch.conf     |  2 ++
>  posix/bug-ga2.root/etc/services          |  1 +
>  resolv/Makefile                          |  7 +++----
>  resolv/tst-leaks2.c                      |  6 ++++--
>  resolv/tst-leaks2.root/etc/hosts         |  1 +
>  resolv/tst-leaks2.root/etc/nsswitch.conf |  1 +
>  9 files changed, 23 insertions(+), 15 deletions(-)
>  create mode 100644 posix/bug-ga2.root/etc/hosts
>  create mode 100644 posix/bug-ga2.root/etc/nsswitch.conf
>  create mode 100644 posix/bug-ga2.root/etc/services
>  create mode 100644 resolv/tst-leaks2.root/etc/hosts
>  create mode 100644 resolv/tst-leaks2.root/etc/nsswitch.conf
>

LGTM.

Thanks.

-- 
H.J.


More information about the Libc-alpha mailing list