This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: symbol name space issues with NSS modules


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]