[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#754813: Bug#757941: static linking: alternatives for glibc?



reassign 754813 libc6
reassign 757941 libc6
forcemerge 754813 757941
severity 754813 important
retitle 754813 libc6 version 2.19 breaks NSS loading for static binaries
forwarded 754813 https://sourceware.org/bugzilla/show_bug.cgi?id=17250
tag 754813 + upstream
thanks

On Tue, Oct 07, 2014 at 09:58:04AM +0400, Michael Tokarev wrote:
> 07.10.2014 08:34, Steve Langasek wrote:
> []
> >>> Was the removal of gethostby* APIs from the static glibc intentional?
> > 
> >> Yes.  It's the nsswitch problem.  The behavior of those APIs is controlled
> >> by the nsswitch mechanism (specifically the hosts configuration), which is
> >> inherently dynamic and doesn't support static linking.
> > 
> > It nevertheless is expected to work when the corresponding NSS modules are
> > present.  It's not truly static, but the dynamic loading from static libc is
> > supported.
> 
> When a statically linked app calls getaddrinfo() (it is getnameinfo not
> gethostbyname), the call immediately returns "host not found, try again",
> without any attempt to load anything or look for other files.
> 
> This is with jessie glibc.  With wheezy's glibc it worked when the right
> nss modules are presnt (iirc anyway -- I know it worked, I didn't check
> _how_ it worked).
> 
> > So bug #757941 should be reassigned to glibc, instead of claiming that this
> > is somehow expected glibc behavior.
> > 
> >>> Perhaps glibc upstream would be willing to restore them?
> > 
> >> It would be nice, but I doubt you'll make much progress.  Lots of people
> >> have complained about this over the years.
> > 
> > At issue here is a glibc regression, not the standard complaints about
> > static glibc being not truly static.
> 
> Regression or not, but there are several other problems here.
> 

This is a regression introduced in 2.19 by the following commit:

| commit 0d23a5c1b1908700d25b7e3c6cece148e19dded4
| Author: Maciej W. Rozycki <macro@codesourcery.com>
| Date:   Fri Jan 31 17:51:31 2014 +0000
| 
|     [BZ #16046] Static dlopen correction fallout fixes.
|     
|     Fixes to address issues from BZ #15022 resolution, as follows:
|     
|     * TLS updates to csu/libc-tls.c -- we now have a proper main map, so
|       there's no longer a need to create a separate fake one to keep TLS
|       structures,
|     
|     * random updates to elf/dl-close.c -- LM_ID_BASE is now a valid name
|       space ID for static executables as well, so assert that we don't
|       unload the main map.  Similarly dl_nns isn't supposed to be 0 for
|       static executables anymore,
|     
|     * actual BZ #16046 fix to elf/dl-iteratephdr.c -- the dl_iterate_phdr
|       special function for static executables isn't needed anymore, provided
|       that l_phdr and l_phnum members of the main map have been properly
|       initialized (done in _dl_non_dynamic_init in elf/dl-support.c now),
|     
|     * ld.so.cache loader update to elf/dl-load.c --
|       GL(dl_ns)[LM_ID_BASE]._ns_loaded is now always initialized in static
|       executables so can become the fallback loader map to check for
|       DF_1_NODEFLIB, provided that the l_flags_1 member of the main map has
|       been properly initialized (done in elf/dl-support.c now); this also
|       ensures previous semantics elsewhere in elf/dl-load.c,
|     
|     * matching updates to elf/dl-support.c -- to complement the two fixes
|       above.

This is actually the same bug than #754813, as all NSS functions are
affected, including DNS resolver or getpwuid. I am therefore merging the
bugs.

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net


Reply to: