On Mon, May 23, 2005 at 07:18:45PM +0000, Gerrit Pape wrote: > Hi, now you make me curious. I played a bit with /etc/resolv.conf and > DEB_BUILD_OPTIONS=debug, but cannot make the test program segfault. > Could you please post an strace of ./test.static segfaulting? And if it > crashes with -g, can you try to use gdb to see were, or at least get a > backtrace?
Using -g I can't reproduce it. It's also only the shared version that fails, the static version doesn't have the problem. I've attached a strace of the run causing the segfault. The backtrace of it looks like: Starting program: /usr/src/libdjbdns-1.05/src/test.shared Program received signal SIGSEGV, Segmentation fault. 0x5556f3ce in dns_domain_length () from ./libdjbdns.so.1 (gdb) bt #0 0x5556f3ce in dns_domain_length () from ./libdjbdns.so.1 #1 0x08048771 in main () at test.c:17 (gdb) frame 1 #1 0x08048771 in main () at test.c:17 17 dns_domain_length(sa.s); Kurt
execve("./test.shared", ["./test.shared"], [/* 14 vars */]) = 0 uname({sys="Linux", node="intrepid", ...}) = 0 brk(0) = 0x804a000 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x5556c000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory) open("./tls/i686/mmx/cmov/libdjbdns.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("./tls/i686/mmx/libdjbdns.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("./tls/i686/cmov/libdjbdns.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("./tls/i686/libdjbdns.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("./tls/mmx/cmov/libdjbdns.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("./tls/mmx/libdjbdns.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("./tls/cmov/libdjbdns.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("./tls/libdjbdns.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("./i686/mmx/cmov/libdjbdns.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("./i686/mmx/libdjbdns.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("./i686/cmov/libdjbdns.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("./i686/libdjbdns.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("./mmx/cmov/libdjbdns.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("./mmx/libdjbdns.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("./cmov/libdjbdns.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("./libdjbdns.so.1", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\220 [EMAIL PROTECTED] \0\4\0([EMAIL PROTECTED],\0\0\0\0\0\0\0;\0\0\0<\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0r\0\0\0J\0\0\0x\0\0\0E\0\0\0\0\0\0\0&\0\0\0h\0\0\0\0\0\0\0$\0\0\0\0\0\0\0\0\0\0\0\207\0\0\0C\0\0\0\233\0\0\0]\0\0\0*\0\0\0\0\0\0\0\32\0\0\0p\0\0\0\0\0\0\0\0\0\0\0008\0\0\0\235\0\0\0W\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0f\0\0\0}\0\0\0O\0\0\0\'\0\0\0(\0\0\0\212\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\215\0\0\0d\0\0\0\0\0\0\0\0\0\0\0b\0\0\0~\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\236\0\0\0\0\0\0\0\0\0\0\0c\0\0\0F\0\0\0o\0\0\0\234\0\0\0\0\0\0\0\0\0\0\0\177\0\0\0\232\0\0\0009\0\0\0\221\0\0\0^\0\0\0\214\0\0\0#\0\0\0\0\0\0\0[\0\0\0\0\0\0\0\223\0\0\0X\0\0\0\200\0\0\0\220\0\0\0m\0\0\0\224\0\0\0g\0\0\0w\0\0\0\0\0\0\0{\0\0\0", 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=42596, ...}) = 0 getcwd("/usr/src/libdjbdns-1.05/src", 128) = 28 old_mmap(NULL, 32064, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x5556d000 old_mmap(0x55574000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x7000) = 0x55574000 close(3) = 0 open("./tls/i686/mmx/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("./tls/i686/mmx/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("./tls/i686/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("./tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("./tls/mmx/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("./tls/mmx/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("./tls/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("./tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("./i686/mmx/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("./i686/mmx/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("./i686/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("./i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("./mmx/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("./mmx/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("./cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("./libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/i686/mmx/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/i686/mmx/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/i686/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/mmx/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/mmx/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("i686/mmx/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("i686/mmx/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("i686/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("mmx/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("mmx/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=6736, ...}) = 0 old_mmap(NULL, 6736, PROT_READ, MAP_PRIVATE, 3, 0) = 0x55575000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/tls/libc.so.6", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`Z\1\0004\0\0\0004\33\23\0\0\0\0\0004\0 \0\t\0(\0:\0009\0\6\0\0\0004\0\0\0004\0\0\0004\0\0\0 \1\0\0 \1\0\0\5\0\0\0\4\0\0\0\3\0\0\0\350~\22\0\350~\22\0\350~\22\0\23\0\0\0\23\0\0\0\4\0\0\0\1\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\222\22\0\20\222\22\0\5\0\0\0\0\20\0\0\1\0\0\0 \222\22\0 \242\22\0 \242\22\0\350~\0\0l\252\0\0\6\0\0\0\0\20\0\0\2\0\0\0\210\r\23\0\210\35\23\0\210\35\23\0\340\0\0\0\340\0\0\0\6\0\0\0\4\0\0\0\4\0\0\0T\1\0\0T\1\0\0T\1\0\0 \0\0\0 \0\0\0\4\0\0\0\4\0\0\0\7\0\0\0\374\270\22\0\374\310\22\0\374\310\22\0\10\0\0\0(\0\0\0\4\0\0\0\4\0\0\0P\345td\374~\22\0\374~\22\0\374~\22\0\24\23\0\0\24\23\0\0\4\0\0\0\4\0\0\0Q\345td\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0\0\0\4\0\0\0\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\0\0\0\0\377\3\0\0\260\10\0\0006\1\0\0\316\6\0\0\207\2\0\0\376\0\0\0007\7\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\275\6\0\0\32\6\0\0\0\0\0\0h\10\0\0\307\6\0\0E\2\0\0\335\2\0\0}\10\0\0[\4\0\0r\10\0\0j\3\0\0\375\6\0\0\257\2\0\0>\10\0\0i\6\0\0\10\5\0\0\17\10\0\0\330\7\0\0\0\0\0\0\344\4\0\0\374\5\0\0v\10\0\0\204\7\0\0\0\0\0\0", 512) = 512 fstat64(3, {st_mode=S_IFREG|0644, st_size=1254468, ...}) = 0 old_mmap(NULL, 1264780, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x55577000 old_mmap(0x556a1000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x129000) = 0x556a1000 old_mmap(0x556aa000, 7308, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x556aa000 close(3) = 0 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x556ac000 set_thread_area({entry_number:-1 -> 11, base_addr:0x556ac520, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0 munmap(0x55575000, 6736) = 0 gettimeofday({1116887261, 709643}, NULL) = 0 open("/etc/resolv.conf", O_RDONLY|O_NONBLOCK) = 3 read(3, "nameserver 10.0.0.1\n\n", 64) = 21 read(3, "", 64) = 0 close(3) = 0 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3 fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR) fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 bind(3, {sa_family=AF_INET, sin_port=htons(64715), sin_addr=inet_addr("0.0.0.0")}, 16) = 0 connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.0.0.1")}, 16) = 0 send(3, "\356\274\1\0\0\1\0\0\0\0\0\0\7abcdefg\0\0\1\0\1", 25, 0) = 25 gettimeofday({1116887261, 710053}, NULL) = 0 gettimeofday({1116887261, 710075}, NULL) = 0 poll([{fd=3, events=POLLIN, revents=POLLIN}], 1, 3019) = 1 recv(3, "\356\274\201\203\0\1\0\0\0\1\0\0\7abcdefg\0\0\1\0\1\0\0\6\0\1\0\0)[EMAIL PROTECTED]:\200\0\1Q\200", 513, 0) = 100 close(3) = 0 gettimeofday({1116887261, 710964}, NULL) = 0 open("/etc/dnsrewrite", O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory) open("/etc/resolv.conf", O_RDONLY|O_NONBLOCK) = 3 read(3, "nameserver 10.0.0.1\n\n", 64) = 21 read(3, "", 64) = 0 close(3) = 0 uname({sys="Linux", node="intrepid", ...}) = 0 gettimeofday({1116887261, 711223}, NULL) = 0 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3 fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR) fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 bind(3, {sa_family=AF_INET, sin_port=htons(59258), sin_addr=inet_addr("0.0.0.0")}, 16) = 0 connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.0.0.1")}, 16) = 0 send(3, "p\35\1\0\0\1\0\0\0\0\0\0\7abcdefg\0\0\1\0\1", 25, 0) = 25 gettimeofday({1116887261, 711429}, NULL) = 0 gettimeofday({1116887261, 711451}, NULL) = 0 poll([{fd=3, events=POLLIN, revents=POLLIN}], 1, 3019) = 1 recv(3, "p\35\201\203\0\1\0\0\0\1\0\0\7abcdefg\0\0\1\0\1\0\0\6\0\1\0\0)[EMAIL PROTECTED]:\200\0\1Q\200", 513, 0) = 100 close(3) = 0 gettimeofday({1116887261, 712102}, NULL) = 0 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3 fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR) fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 bind(3, {sa_family=AF_INET, sin_port=htons(58547), sin_addr=inet_addr("0.0.0.0")}, 16) = 0 connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.0.0.1")}, 16) = 0 send(3, "\374\322\1\0\0\1\0\0\0\0\0\0\00285\003106\003161\003148\7in-addr\4arpa\0\0\f\0\1", 45, 0) = 45 gettimeofday({1116887261, 712311}, NULL) = 0 gettimeofday({1116887261, 712334}, NULL) = 0 poll([{fd=3, events=POLLIN, revents=POLLIN}], 1, 3019) = 1 recv(3, "\374\322\201\203\0\1\0\0\0\1\0\0\00285\003106\003161\003148\7in-addr\4arpa\0\0\f\0\1\300\27\0\6\0\1\0\0)\322\0*\4chia\4arin\3net\0\4bind\300>w\202\253\236\0\0\7\10\0\0\3\204\0\n\214\0\0\0*0", 513, 0) = 99 close(3) = 0 gettimeofday({1116887261, 713014}, NULL) = 0 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3 fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR) fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 bind(3, {sa_family=AF_INET, sin_port=htons(10118), sin_addr=inet_addr("0.0.0.0")}, 16) = 0 connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.0.0.1")}, 16) = 0 send(3, "z\270\1\0\0\1\0\0\0\0\0\0\7abcdefg\0\0\17\0\1", 25, 0) = 25 gettimeofday({1116887261, 713210}, NULL) = 0 gettimeofday({1116887261, 713232}, NULL) = 0 poll([{fd=3, events=POLLIN, revents=POLLIN}], 1, 3019) = 1 recv(3, "z\270\201\203\0\1\0\0\0\1\0\0\7abcdefg\0\0\17\0\1\0\0\6\0\1\0\0)[EMAIL PROTECTED]:\200\0\1Q\200", 513, 0) = 100 close(3) = 0 gettimeofday({1116887261, 713880}, NULL) = 0 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3 fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR) fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 bind(3, {sa_family=AF_INET, sin_port=htons(54330), sin_addr=inet_addr("0.0.0.0")}, 16) = 0 connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.0.0.1")}, 16) = 0 send(3, "\306\261\1\0\0\1\0\0\0\0\0\0\7abcdefg\0\0\20\0\1", 25, 0) = 25 gettimeofday({1116887261, 714076}, NULL) = 0 gettimeofday({1116887261, 714118}, NULL) = 0 poll([{fd=3, events=POLLIN, revents=POLLIN}], 1, 3019) = 1 recv(3, "\306\261\201\203\0\1\0\0\0\1\0\0\7abcdefg\0\0\20\0\1\0\0\6\0\1\0\0)[EMAIL PROTECTED]:\200\0\1Q\200", 513, 0) = 100 close(3) = 0 --- SIGSEGV (Segmentation fault) @ 0 (0) --- +++ killed by SIGSEGV +++