cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: segfault in libcurl using uclibc

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 13 Apr 2010 13:49:03 +0200 (CEST)

On Tue, 13 Apr 2010, James Story wrote:

> 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:

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

You're not using threads, are you? (It doesn't sound like it but I thought I'd
ask anyway)

> #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

Just a clarification here on this particular function. You see this wrapper
function curl_dogetaddrinfo in use simply because you built with
--enable-curldebug, as then libcurl will use wrappers for all
resource-allocating functions to check for leakage etc.

It's really too bad there's no valgrind for ARM yet.

Can you use gdb on the target to break-point in that function and investigate
how the local variables etc look?

> 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)

Yes, it is quite clear that it blows up within the getaddrinfo() function
somehow, and it certainly isn't easy for me to spot why. Would it be possible
to build a debug version of the uclibc? It could help to track this problem
further down.

> - 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.

You could try to rebuild it with --disable-ipv6, as that will make the libcurl
code use gethostbyname_r() instead of getaddrinfo() for the name resolving, so
any difference in behavior then might say something.

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