public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...)
@ 2014-08-10 12:35 vapier at gentoo dot org
2014-08-10 12:35 ` [Bug libc/17250] " vapier at gentoo dot org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: vapier at gentoo dot org @ 2014-08-10 12:35 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17250
Bug ID: 17250
Summary: static linking breaks nss loading
(getaddrinfo/getpwnam/etc...)
Product: glibc
Version: 2.19
Status: NEW
Severity: normal
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: vapier at gentoo dot org
CC: drepper.fsp at gmail dot com, macro@linux-mips.org
it looks like the change landed for bug 16046 broke static dlopening of nss
modules. if you try to use getaddrinfo/getpwnam/etc..., they just return
errors immediately.
example tests:
$ cat test.c
#include <sys/types.h>
#include <pwd.h>
#include <stdio.h>
int main() {
void *p = getpwnam("root");
printf("%p\n", p);
return p == NULL ? 1 : 0;
}
$ gcc test.c && ./a.out
0x7f6aec59a0e0
$ gcc -static test.c && ./a.out
(nil)
$ cat test.c
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <net/if.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
#include <string.h>
int main(int argc, char *argv[])
{
const char *host = argv[1];
int rc;
struct addrinfo *result = NULL;
struct addrinfo hint;
memset(&hint, 0 , sizeof(hint));
hint.ai_family = AF_INET;
hint.ai_socktype = SOCK_STREAM;
hint.ai_flags = AF_UNSPEC;
rc = getaddrinfo(host, NULL, &hint, &result);
if (rc || !result) {
printf("bad address '%s'\n", host);
return 1;
} else
return 0;
}
$ gcc test.c && ./a.out localhost
$ gcc -static test.c && ./a.out localhost
bad address 'localhost'
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libc/17250] static linking breaks nss loading (getaddrinfo/getpwnam/etc...)
2014-08-10 12:35 [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...) vapier at gentoo dot org
@ 2014-08-10 12:35 ` vapier at gentoo dot org
2014-08-10 13:13 ` vapier at gentoo dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: vapier at gentoo dot org @ 2014-08-10 12:35 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17250
Mike Frysinger <vapier at gentoo dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://sourceware.org/bugz
| |illa/show_bug.cgi?id=16046,
| |https://bugs.gentoo.org/sho
| |w_bug.cgi?id=518650,
| |https://bugs.gentoo.org/sho
| |w_bug.cgi?id=509748
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libc/17250] static linking breaks nss loading (getaddrinfo/getpwnam/etc...)
2014-08-10 12:35 [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...) vapier at gentoo dot org
2014-08-10 12:35 ` [Bug libc/17250] " vapier at gentoo dot org
@ 2014-08-10 13:13 ` vapier at gentoo dot org
2014-10-21 8:50 ` aurelien at aurel32 dot net
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: vapier at gentoo dot org @ 2014-08-10 13:13 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17250
--- Comment #1 from Mike Frysinger <vapier at gentoo dot org> ---
bisecting more, it looks like it's specifically the change to
elf/dl-iteratephdr.c that breaks things (where it changes from a custom
dl_iterate_phdr to a weak alias of __dl_iterate_phdr). if i revert that change
alone, the tests start working again.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libc/17250] static linking breaks nss loading (getaddrinfo/getpwnam/etc...)
2014-08-10 12:35 [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...) vapier at gentoo dot org
2014-08-10 12:35 ` [Bug libc/17250] " vapier at gentoo dot org
2014-08-10 13:13 ` vapier at gentoo dot org
@ 2014-10-21 8:50 ` aurelien at aurel32 dot net
2014-10-21 8:51 ` aurelien at aurel32 dot net
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: aurelien at aurel32 dot net @ 2014-10-21 8:50 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17250
Aurelien Jarno <aurelien at aurel32 dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aurelien at aurel32 dot net
See Also| |http://bugs.debian.org/7595
| |30
--- Comment #2 from Aurelien Jarno <aurelien at aurel32 dot net> ---
I confirm that the breakage has been introduced 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.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libc/17250] static linking breaks nss loading (getaddrinfo/getpwnam/etc...)
2014-08-10 12:35 [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...) vapier at gentoo dot org
` (2 preceding siblings ...)
2014-10-21 8:50 ` aurelien at aurel32 dot net
@ 2014-10-21 8:51 ` aurelien at aurel32 dot net
2014-10-21 8:57 ` aurelien at aurel32 dot net
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: aurelien at aurel32 dot net @ 2014-10-21 8:51 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17250
Aurelien Jarno <aurelien at aurel32 dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |http://bugs.debian.org/7646
| |92
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libc/17250] static linking breaks nss loading (getaddrinfo/getpwnam/etc...)
2014-08-10 12:35 [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...) vapier at gentoo dot org
` (3 preceding siblings ...)
2014-10-21 8:51 ` aurelien at aurel32 dot net
@ 2014-10-21 8:57 ` aurelien at aurel32 dot net
2014-10-22 10:58 ` aurelien at aurel32 dot net
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: aurelien at aurel32 dot net @ 2014-10-21 8:57 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17250
--- Comment #3 from Aurelien Jarno <aurelien at aurel32 dot net> ---
The problem seems to be related to the trusted directories. As long as the
generated file elf/trusted-dirs.h contains a path matching the NSS modules
location, they are not even load. Changing these paths to not match the NSS
modules location make the NSS modules to work again.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libc/17250] static linking breaks nss loading (getaddrinfo/getpwnam/etc...)
2014-08-10 12:35 [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...) vapier at gentoo dot org
` (4 preceding siblings ...)
2014-10-21 8:57 ` aurelien at aurel32 dot net
@ 2014-10-22 10:58 ` aurelien at aurel32 dot net
2015-08-27 21:54 ` [Bug nss/17250] " jsm28 at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: aurelien at aurel32 dot net @ 2014-10-22 10:58 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17250
--- Comment #4 from Aurelien Jarno <aurelien at aurel32 dot net> ---
Looking more at the code the new behaviour is actually wanted. Statically
linked binaries do not lookup in the default lib search patch by default
(DF_1_NODEFLIB is defined as "Ignore default lib search path."):
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -91,6 +91,7 @@ static struct link_map _dl_main_map =
.l_scope = _dl_main_map.l_scope_mem,
.l_local_scope = { &_dl_main_map.l_searchlist },
.l_used = 1,
+ .l_flags_1 = DF_1_NODEFLIB,
.l_tls_offset = NO_TLS_OFFSET,
.l_serial = 1,
};
This means that the dlopen calls from nss/nsswitch.c do not look for the
default search path. In addition to that it means that the dlopen behavior for
static binaries also has changed and doesn't support loading objects without an
absolute path. This is conform to the POSIX specification ("Otherwise, file is
used in an implementation-defined manner to yield a pathname."), but do we
really want such a behavior change?
Concerning the NSS support we should probably switch it to an absolute path. In
the meantime this can be workarounded by using LD_LIBRARY_PATH
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug nss/17250] static linking breaks nss loading (getaddrinfo/getpwnam/etc...)
2014-08-10 12:35 [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...) vapier at gentoo dot org
` (5 preceding siblings ...)
2014-10-22 10:58 ` aurelien at aurel32 dot net
@ 2015-08-27 21:54 ` jsm28 at gcc dot gnu.org
2015-09-25 9:15 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2015-08-27 21:54 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17250
Joseph Myers <jsm28 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|libc |nss
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug nss/17250] static linking breaks nss loading (getaddrinfo/getpwnam/etc...)
2014-08-10 12:35 [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...) vapier at gentoo dot org
` (6 preceding siblings ...)
2015-08-27 21:54 ` [Bug nss/17250] " jsm28 at gcc dot gnu.org
@ 2015-09-25 9:15 ` cvs-commit at gcc dot gnu.org
2015-09-25 9:21 ` [Bug dynamic-link/17250] " macro@linux-mips.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-09-25 9:15 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17250
--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 93bad7c97c7047ecaf7664859e2b49c0fe995443 (commit)
from f6987f5aa4c2ef7270bcb0a828808bd3db53520b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=93bad7c97c7047ecaf7664859e2b49c0fe995443
commit 93bad7c97c7047ecaf7664859e2b49c0fe995443
Author: Maciej W. Rozycki <macro@imgtec.com>
Date: Fri Sep 25 09:37:12 2015 +0100
[BZ #17250] Fix static dlopen default library search path
Fix a regression introduced with commit 0d23a5c1 [Static dlopen
correction fallout fixes] that caused the default library search path to
be ignored for modules loaded with dlopen from static executables.
[BZ #17250]
* elf/dl-support.c (_dl_main_map): Don't initialize l_flags_1
member.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 6 ++++++
NEWS | 12 ++++++------
elf/dl-support.c | 1 -
3 files changed, 12 insertions(+), 7 deletions(-)
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug dynamic-link/17250] static linking breaks nss loading (getaddrinfo/getpwnam/etc...)
2014-08-10 12:35 [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...) vapier at gentoo dot org
` (7 preceding siblings ...)
2015-09-25 9:15 ` cvs-commit at gcc dot gnu.org
@ 2015-09-25 9:21 ` macro@linux-mips.org
2015-09-25 14:04 ` vapier at gentoo dot org
2015-09-26 18:42 ` cvs-commit at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: macro@linux-mips.org @ 2015-09-25 9:21 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17250
Maciej W. Rozycki <macro@linux-mips.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Component|nss |dynamic-link
Resolution|--- |FIXED
Assignee|unassigned at sourceware dot org |macro@linux-mips.org
--- Comment #6 from Maciej W. Rozycki <macro@linux-mips.org> ---
Fixed on trunk as per the commit message.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug dynamic-link/17250] static linking breaks nss loading (getaddrinfo/getpwnam/etc...)
2014-08-10 12:35 [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...) vapier at gentoo dot org
` (8 preceding siblings ...)
2015-09-25 9:21 ` [Bug dynamic-link/17250] " macro@linux-mips.org
@ 2015-09-25 14:04 ` vapier at gentoo dot org
2015-09-26 18:42 ` cvs-commit at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: vapier at gentoo dot org @ 2015-09-25 14:04 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17250
Mike Frysinger <vapier at gentoo dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |2.23
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug dynamic-link/17250] static linking breaks nss loading (getaddrinfo/getpwnam/etc...)
2014-08-10 12:35 [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...) vapier at gentoo dot org
` (9 preceding siblings ...)
2015-09-25 14:04 ` vapier at gentoo dot org
@ 2015-09-26 18:42 ` cvs-commit at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-09-26 18:42 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17250
--- Comment #7 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, gentoo/2.22 has been updated
via adf228f91c11a1bcdf7563d104a2a370d054e482 (commit)
from ca6a9ce6151759981cc2efd58e053148c7db2fea (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=adf228f91c11a1bcdf7563d104a2a370d054e482
commit adf228f91c11a1bcdf7563d104a2a370d054e482
Author: Maciej W. Rozycki <macro@imgtec.com>
Date: Fri Sep 25 09:37:12 2015 +0100
[BZ #17250] Fix static dlopen default library search path
Fix a regression introduced with commit 0d23a5c1 [Static dlopen
correction fallout fixes] that caused the default library search path to
be ignored for modules loaded with dlopen from static executables.
[BZ #17250]
* elf/dl-support.c (_dl_main_map): Don't initialize l_flags_1
member.
(cherry picked from commit 93bad7c97c7047ecaf7664859e2b49c0fe995443)
-----------------------------------------------------------------------
Summary of changes:
elf/dl-support.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-09-26 18:42 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-10 12:35 [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...) vapier at gentoo dot org
2014-08-10 12:35 ` [Bug libc/17250] " vapier at gentoo dot org
2014-08-10 13:13 ` vapier at gentoo dot org
2014-10-21 8:50 ` aurelien at aurel32 dot net
2014-10-21 8:51 ` aurelien at aurel32 dot net
2014-10-21 8:57 ` aurelien at aurel32 dot net
2014-10-22 10:58 ` aurelien at aurel32 dot net
2015-08-27 21:54 ` [Bug nss/17250] " jsm28 at gcc dot gnu.org
2015-09-25 9:15 ` cvs-commit at gcc dot gnu.org
2015-09-25 9:21 ` [Bug dynamic-link/17250] " macro@linux-mips.org
2015-09-25 14:04 ` vapier at gentoo dot org
2015-09-26 18:42 ` cvs-commit at gcc dot gnu.org
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).