public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Question regarding failing xcheck posix/bug-ga2-mem and resolv/mtrace-tst-leaks2 on Fedora 33
@ 2020-11-10 16:10 Stefan Liebler
  2020-11-17  8:36 ` Stefan Liebler
  2020-11-17  8:40 ` Florian Weimer
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Liebler @ 2020-11-10 16:10 UTC (permalink / raw)
  To: GNU C Library

Hi,

starting with Fedora 33, the xcheck tests posix/bug-ga2-mem and
resolv/mtrace-tst-leaks2 are failing with "Memory not freed" output of
mtrace.

Both tests are activating mtrace and are calling getaddrinfo or
res_init+gethostbyname for multiple rounds.

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. It seems as those loads
are recognized in the mtrace output. Does anybody else also get those fails?

Should we adjust the tests by:

- calling mtrace() after the first round?

- running the tests in a container e.g. with a /etc/nsswitch.conf with
"services: files" and "hosts: files" and a /etc/hosts containing
www.gnu.org? Those tests would then run with "make check" instead of
"make xcheck".

Any ideas?

Bye,
Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question regarding failing xcheck posix/bug-ga2-mem and resolv/mtrace-tst-leaks2 on Fedora 33
  2020-11-10 16:10 Question regarding failing xcheck posix/bug-ga2-mem and resolv/mtrace-tst-leaks2 on Fedora 33 Stefan Liebler
@ 2020-11-17  8:36 ` Stefan Liebler
  2020-11-17  8:40 ` Florian Weimer
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Liebler @ 2020-11-17  8:36 UTC (permalink / raw)
  To: libc-alpha

On 11/10/20 5:10 PM, Stefan Liebler via Libc-alpha wrote:
> Hi,
> 
> starting with Fedora 33, the xcheck tests posix/bug-ga2-mem and
> resolv/mtrace-tst-leaks2 are failing with "Memory not freed" output of
> mtrace.
> 
> Both tests are activating mtrace and are calling getaddrinfo or
> res_init+gethostbyname for multiple rounds.
> 
> 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. It seems as those loads
> are recognized in the mtrace output. Does anybody else also get those fails?
> 
> Should we adjust the tests by:
> 
> - calling mtrace() after the first round?
> 
> - running the tests in a container e.g. with a /etc/nsswitch.conf with
> "services: files" and "hosts: files" and a /etc/hosts containing
> www.gnu.org? Those tests would then run with "make check" instead of
> "make xcheck".
> 
> Any ideas?
> 
> Bye,
> Stefan
> 

ping

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question regarding failing xcheck posix/bug-ga2-mem and resolv/mtrace-tst-leaks2 on Fedora 33
  2020-11-10 16:10 Question regarding failing xcheck posix/bug-ga2-mem and resolv/mtrace-tst-leaks2 on Fedora 33 Stefan Liebler
  2020-11-17  8:36 ` Stefan Liebler
@ 2020-11-17  8:40 ` Florian Weimer
  2020-11-17 12:32   ` H.J. Lu
  2020-11-19 12:29   ` Stefan Liebler
  1 sibling, 2 replies; 5+ messages in thread
From: Florian Weimer @ 2020-11-17  8:40 UTC (permalink / raw)
  To: Stefan Liebler via Libc-alpha; +Cc: Stefan Liebler

* Stefan Liebler via Libc-alpha:

> Should we adjust the tests by:
>
> - calling mtrace() after the first round?
>
> - running the tests in a container e.g. with a /etc/nsswitch.conf with
> "services: files" and "hosts: files" and a /etc/hosts containing
> www.gnu.org? Those tests would then run with "make check" instead of
> "make xcheck".

A third option would be to call __nss_configure_lookup for hosts and
services, restricting them to nss_files.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question regarding failing xcheck posix/bug-ga2-mem and resolv/mtrace-tst-leaks2 on Fedora 33
  2020-11-17  8:40 ` Florian Weimer
@ 2020-11-17 12:32   ` H.J. Lu
  2020-11-19 12:29   ` Stefan Liebler
  1 sibling, 0 replies; 5+ messages in thread
From: H.J. Lu @ 2020-11-17 12:32 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Stefan Liebler via Libc-alpha, Stefan Liebler

On Tue, Nov 17, 2020 at 12:40 AM Florian Weimer <fw@deneb.enyo.de> wrote:
>
> * Stefan Liebler via Libc-alpha:
>
> > Should we adjust the tests by:
> >
> > - calling mtrace() after the first round?
> >
> > - running the tests in a container e.g. with a /etc/nsswitch.conf with
> > "services: files" and "hosts: files" and a /etc/hosts containing
> > www.gnu.org? Those tests would then run with "make check" instead of
> > "make xcheck".
>
> A third option would be to call __nss_configure_lookup for hosts and
> services, restricting them to nss_files.

https://sourceware.org/bugzilla/show_bug.cgi?id=26821

-- 
H.J.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question regarding failing xcheck posix/bug-ga2-mem and resolv/mtrace-tst-leaks2 on Fedora 33
  2020-11-17  8:40 ` Florian Weimer
  2020-11-17 12:32   ` H.J. Lu
@ 2020-11-19 12:29   ` Stefan Liebler
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Liebler @ 2020-11-19 12:29 UTC (permalink / raw)
  To: Florian Weimer, Stefan Liebler via Libc-alpha

On 11/17/20 9:40 AM, Florian Weimer wrote:
> * Stefan Liebler via Libc-alpha:
> 
>> Should we adjust the tests by:
>>
>> - calling mtrace() after the first round?
>>
>> - running the tests in a container e.g. with a /etc/nsswitch.conf with
>> "services: files" and "hosts: files" and a /etc/hosts containing
>> www.gnu.org? Those tests would then run with "make check" instead of
>> "make xcheck".
> 
> A third option would be to call __nss_configure_lookup for hosts and
> services, restricting them to nss_files.
> 

I've tried it, but unfortunately we can't use __nss_configure_lookup for
"services" as this already setups __nss_services_database. See nsswitch.c:
/* Structure to map database name to variable.  */
static const struct
{
  const char name[10];
  service_user **dbp;
} databases[] =
{
#define DEFINE_DATABASE(name)						      \
  { #name, &__nss_##name##_database },
#include "databases.def"
#undef DEFINE_DATABASE
};

__nss_configure_lookup()
{
...
/* Install new rules.  */
*databases[cnt].dbp = new_db;

The first getaddrinfo invocation calls gaih_inet -> gaih_inet_serv ->
__getservbyname_r -> __GI___nss_services_lookup2 (in nss/XXX-lookup.c):
As __nss_services_database is already set up, __nss_database_lookup2 is
not called!
Instead it directly continues with __nss_lookup -> __nss_lookup_function
where a new entry is malloc'ed via __tsearch as well as a
"known_function" struct.
Then the library is loaded via nss_load_library:
ni->library = nss_new_service (service_table ?: &default_table, ni->name);

As __nss_database_lookup2 was skipped, service_table is NULL and
nss_new_service adds a new service_library to the static function
variable default_table.
This leads to not freeing those entries which are then mentioned by mtrace.
See nss/nsswitch.c:
libc_freeres_fn (free_mem)
{
  name_database *top = service_table;
  service_library *library;

  if (top == NULL)
    /* Maybe we have not read the nsswitch.conf file.  */
    return;

I've just updated the bugzilla and posted the patch
"[PATCH] Use libnss_files.so for tests posix/bug-ga2 and
resolv/tst-leaks2 [BZ #26821]"
https://sourceware.org/pipermail/libc-alpha/2020-November/119788.html

Please have a look.

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-19 12:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 16:10 Question regarding failing xcheck posix/bug-ga2-mem and resolv/mtrace-tst-leaks2 on Fedora 33 Stefan Liebler
2020-11-17  8:36 ` Stefan Liebler
2020-11-17  8:40 ` Florian Weimer
2020-11-17 12:32   ` H.J. Lu
2020-11-19 12:29   ` Stefan Liebler

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).