Bug 597578

Summary: static binaries using gethostbyname segfault (nss_files)
Product: [Fedora] Fedora Reporter: Kris Rusocki <kszysiu>
Component: glibcAssignee: Andreas Schwab <schwab>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 13CC: fweimer, jakub, schwab, yyetim
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: 2.12.90-3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-10-05 13:20:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Kris Rusocki 2010-05-29 17:08:51 UTC
Description of problem:
Per summary. I wouldn't be surprised if root cause
of this issue was outside glibc though. I thought
I'd report it before taking a closer look. Let know
if you need anything else. Thanks.

Version-Release number of selected component (if applicable):
2.12-1

How reproducible:
Always

Steps to Reproduce:
1. Build following code with gcc -static

#include <netdb.h>

int main(int ac, char **av)
{
	gethostbyname("fedoraproject.org");
	return 0;
}


2. Run resulting binary

  
Actual results:
Segfault.

Expected results:
No segfault (to begin with).

Additional info:
Loaded symbols for /lib64/ld-2.12.so
Core was generated by `./demo'.
Program terminated with signal 11, Segmentation fault.
#0  new_heap (size=<value optimized out>, top_pad=<value optimized out>)
    at arena.c:759
759	  h->size = size;
(gdb) bt
#0  new_heap (size=<value optimized out>, top_pad=<value optimized out>)
    at arena.c:759
#1  0x00000036bf477243 in _int_new_arena (a_tsd=<value optimized out>, 
    size=568) at arena.c:907
#2  arena_get2 (a_tsd=<value optimized out>, size=568) at arena.c:1054
#3  0x00000036bf479c17 in __libc_malloc (bytes=568) at malloc.c:3672
#4  0x00000036bf46690b in __fopen_internal (
    filename=0x7ffff7deb2a6 "/etc/hosts", mode=0x7ffff7deb286 "re", is32=1)
    at ../libio/iofopen.c:76
#5  0x00007ffff7de46e3 in internal_setent (stayopen=0)
    at nss_files/files-XXX.c:80
#6  0x00007ffff7de5e12 in _nss_files_gethostbyname_r (
    name=0x4828d0 "fedoraproject.org", result=0x6ad2c0, buffer=0x6b07e0 "", 
    buflen=1024, errnop=0x6af828, herrnop=0x7fffffffe22c)
    at nss_files/files-hosts.c:290
#7  0x000000000040e901 in gethostbyname_r ()
#8  0x000000000040e671 in gethostbyname ()
#9  0x000000000040042d in main ()
(gdb)

Comment 1 Andreas Schwab 2010-10-20 08:25:02 UTC
*** Bug 644673 has been marked as a duplicate of this bug. ***