This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: symbol name space issues with NSS modules
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Thorsten Kukuk <kukuk at suse dot de>, libc-alpha at sourceware dot org
- Date: Mon, 11 Apr 2016 15:09:33 -0700 (PDT)
- Subject: Re: symbol name space issues with NSS modules
- Authentication-results: sourceware.org; auth=none
- References: <20160404134356 dot GA20216 at suse dot de> <5702780D dot 7070208 at redhat dot com> <20160404142237 dot GA20583 at suse dot de> <57062C77 dot 1080103 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1604071516070 dot 26336 at digraph dot polyomino dot org dot uk> <20160408183921 dot 4FAAF2C3B21 at topped-with-meat dot com> <57080B62 dot 7070206 at redhat dot com> <20160408230727 dot 8E17C2C3B18 at topped-with-meat dot com> <5708EB5F dot 7020600 at redhat dot com>
> ISTR some work a while ago to improve dlmopen support, make it
> match Solaris behavior more closely. Seems like it'd be the
> ideal solution.
It is a large can of worms that is very far from "ideal". I won't go into
the details here, because it would be a very large digression. Suffice it
to say that it is not part of any near-term (or even medium-term) solution.
> The original report showed:
>
> #0 timeval_add (result=0x7fffffffd850, a=0x0, b=0x3d090) at ../../libiberty/timeval-utils.c:57
> #1 0x0000003d78a0f124 in timeval_current_ofs () from /lib64/libsamba-util.so.0
> #2 0x0000003d71e12b84 in name_query () from /usr/lib64/samba/libgse.so
> #3 0x00007ffff0d3d489 in _nss_wins_gethostbyname_r () from /lib64/libnss_wins.so.2
> #4 0x0000003d3ad0ebd3 in gethostbyname_r@@GLIBC_2.2.5 () from /lib64/libc.so.6
> #5 0x0000003d3ad0e316 in gethostbyname () from /lib64/libc.so.6
> ...
OK, this is indeed enough to know that libnss_wins.so.2 is at fault.
That module, of course, is not part of glibc.
> Frame #0 is GDB's symbol, which is what overrode a symbol of the same
> name in libsamba-util.so.0. On Fedora 23, I still see the same symbols
> as the OP saw.
Clearly GDB was built with -rdynamic, which is an unusual thing to do.
Normally a symbol like timeval_add would not be in an executable's .dynsym
and so would never affect DSOs.
The usual reason to use -rdynamic is so that dlopen'd modules in some sort
of plug-in system can access some of the main executable's symbols. But
-rdynamic is a very big and sloppy hammer. I would certainly recommend
exporting a specific intended ABI rather than every global function in gdb.
> libnss_wins.so.2 is provided by:
>
> $ rpm -qf /lib64/libnss_wins.so.2
> samba-winbind-modules-4.3.6-0.fc23.x86_64
>
> I already had those installed, most probably just because I installed
> Samba.
>
> I don't know how to make gethostname end up calling into this
> wins nss module. It doesn't for me, but I assume that remote debugging
> with gdb is still broken for anyone for who it does. All it takes to
> get to that gethostname call is "target remote <host>:<port>".
/etc/nsswitch.conf controls which modules will be called.
A line like "hosts: files wins dns" is probably what was being used.
This is a very complex and subtle set of problems that we are not going to
resolve generically in libc any time soon. So for now, anybody providing
third-party NSS modules needs to understand the issues. The simplest
workaround today is just to advise people to use nscd when using any
third-party modules in nsswitch.conf.