Package: libc6-dev
Version: 2.24-11+deb9u1
Severity: normal
Dear Maintainer,
with glibc 2.24 (reproducible on 64-bit Debian 9 or Ubuntu 17.04), gethostbyname() always segfaults if the binary was linked statically:
$ echo -e "#include <netdb.h>\nint main(void){gethostbyname(\"foo\");}" >foo.c && \
gcc -g -static foo.c && ./a.out
/tmp/ccp8JNGC.o: In function `main':
/tmp/foo.c:2: warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
Segmentation fault
$ gdb a.out
GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
[...]
Reading symbols from a.out...done.
(gdb) run
Starting program: /tmp/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00007ffff72ac040 in __pthread_initialize_minimal_internal () at nptl-init.c:460
#2 0x00007ffff72ab5e1 in _init () at ../sysdeps/x86_64/crti.S:72
#3 0x00007ffff76cc830 in ?? () from /lib/x86_64-linux-gnu/libnss_myhostname.so.2
#4 0x0000000000478a7a in call_init.part ()
#5 0x0000000000478c35 in _dl_init ()
#6 0x000000000047089e in dl_open_worker ()
#7 0x000000000046e0f4 in _dl_catch_error ()
#8 0x000000000047024c in _dl_open ()
#9 0x0000000000439ba2 in do_dlopen ()
#10 0x000000000046e0f4 in _dl_catch_error ()
#11 0x0000000000439bd7 in dlerror_run ()
#12 0x0000000000439da3 in __libc_dlopen_mode ()
#13 0x0000000000436b3b in __nss_lookup_function ()
#14 0x0000000000436d45 in __nss_next2 ()
#15 0x000000000043504a in gethostbyname_r ()
#16 0x0000000000434d93 in gethostbyname ()
#17 0x0000000000400b2e in main () at foo.c:2
In my upstream bug report, a commenter noted that this weren't reproducible in
Fedora's glibc 2.24 or 2.25, suggesting this "could be a Debian or Ubuntu patch": https://sourceware.org/bugzilla/show_bug.cgi?id=21975
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 293 |
Nodes: | 16 (2 / 14) |
Uptime: | 241:23:16 |
Calls: | 6,624 |
Files: | 12,173 |
Messages: | 5,320,139 |