cURL / Mailing Lists / curl-library / Single Mail

curl-library

segfault in libcurl using uclibc

From: James Story <james_at_monkeyroom.com>
Date: Tue, 13 Apr 2010 22:11:52 +1200

Hi there,

I'm developing an application for an AT91SAM9260 - its running an embedded
kernel based off 2.6.24 and is using uclibc version 0.9.29 and I'm trying to
cross compile libcurl so I get it's goodness. I've downloaded the curl 7.20
sources and have configured the build using the following options:

export PATH=$PATH:/opt/crosstools/usr/bin
#export CFLAGS='-Os'
export CFLAGS=
export CPPFLAGS="-I/opt/crosstools/usr/include
-I/opt/crosstools/telit/include"
export LDFLAGS="-L/opt/crosstools/telit/lib -L/opt/crosstools/lib"
export AR=arm-linux-ar
export AS=arm-linux-as
export LD=arm-linux-ld
export RANLIB=arm-linux-ranlib
export CC=arm-linux-gcc
export NM=arm-linux-nm

./configure --target=arm-linux --host=arm-linux \
    --prefix=/opt/crosstools/usr/lib --exec-prefix=/opt/crosstools/usr/lib \
    --disable-verbose \
    --disable-cookies \
    --disable-ftp \
    --disable-file \
    --disable-ldap \
    --disable-ldaps \
    --disable-rtsp \
    --disable-proxy \
    --disable-dict \
    --disable-telnet \
    --disable-tftp \
    --disable-pop3 \
    --disable-imap \
    --disable-smtp \
    --disable-manual \
    --disable-ipv6 \
    --disable-sspi \
    --without-ssl \
    --without-zlib \
    --without-gnutls \
    --without-nss \
    --without-libssh2 \
    --without-libidn \
    --enable-debug \
    --enable-curldebug \
    --disable-optimize

After I have built a library and coded up a quick "hello curl" type
application I get the following:

Program received signal SIGSEGV, Segmentation fault.
0x400de428 in ?? () from /opt/crosstools/lib/libc.so.0

#0 curl_dogetaddrinfo (hostname=0x4ae7c "www.google.co.nz",
service=0xbe9fc8c8 "80", hints=0xbe9fc8e8, result=0xbe9fc890, line=131,
source=0x39264 "curl_addrinfo.c") at curl_addrinfo.c:472
#1 0x00033348 in Curl_getaddrinfo_ex (nodename=0x4ae7c "www.google.co.nz",
servname=0xbe9fc8c8 "80", hints=0xbe9fc8e8, result=0xbe9fc90c) at
curl_addrinfo.c:131
#2 0x00031cc0 in Curl_ipv4_resolve_r (hostname=0x4ae7c "www.google.co.nz",
port=80) at hostip4.c:165
#3 0x00031bb8 in Curl_getaddrinfo (conn=0x4a994, hostname=0x4ae7c "
www.google.co.nz", port=80, waitp=0xbe9fc968) at hostip4.c:120
#4 0x0001406c in Curl_resolv (conn=0x4a994, hostname=0x4ae7c "
www.google.co.nz", port=80, entry=0xbe9fcb08) at hostip.c:454
#5 0x00014318 in Curl_resolv_timeout (conn=0x4a994, hostname=0x4ae7c "
www.google.co.nz", port=80, entry=0xbe9fcb08, timeoutms=0) at hostip.c:622
#6 0x00023fe8 in resolve_server (data=0x4200c, conn=0x4a994,
async=0xbe9fcd97) at url.c:4401
#7 0x00024ae4 in create_conn (data=0x4200c, in_connect=0xbe9fcdbc,
async=0xbe9fcd97) at url.c:4901
#8 0x00024db0 in Curl_connect (data=0x4200c, in_connect=0xbe9fcdbc,
asyncp=0xbe9fcd97, protocol_done=0xbe9fcd96) at url.c:5027
#9 0x0002cdc0 in connect_host (data=0x4200c, conn=0xbe9fcdbc) at
transfer.c:1814
#10 0x0002d170 in Curl_perform (data=0x4200c) at transfer.c:1953
#11 0x00009e84 in curl_easy_perform (curl=0x4200c) at easy.c:557
#12 0x00009820 in main (argc=1, argv=0xbe9fceb4) at main.cpp:36

When it calls this line: int res=(getaddrinfo)(hostname, service, hints,
result); it blows up (segfault generated)... This only happens when my modem
is online (if the modem is offline then it turns an error and fails
gracefully) - I can "wget" a page over this connection and I coded up
another "hello world" type application to test the native function
"getaddrinfo" without the curl wrapper and that resolves the address
perfectly... When I run the same code (using a similar configuration as
detailed above i.e. stripping out all the extras) on my Ubuntu setup is
works fine - It's just my cross compiled version that fails with a segfault.
My noob look at the stack/stepping through the code looks like everything is
ok but obviously isn't.

If anyone can help me nut this out/point me in the right direction it would
be much appreciated,

James

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-13