cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Segmentation Fault while doing curl_easy_perform...

From: Jeffrey Walton <noloader_at_gmail.com>
Date: Tue, 15 Oct 2013 16:31:45 -0400

On Tue, Oct 15, 2013 at 11:14 AM, Chiaramello Daniel
<Daniel.Chiaramello_at_gemalto.com> wrote:
> ...
> [New process 13954]
>
> #0 0x0945fb80 in ?? ()
>
> (gdb) where
>
> #0 0x0945fb80 in ?? ()
>
> #1 0x010cf808 in EVP_CIPHER_CTX_cleanup () from /lib/libcrypto.so.6
>
> #2 0x010cfa48 in EVP_CipherInit_ex () from /lib/libcrypto.so.6
>
> #3 0x004716b4 in tls1_change_cipher_state () from /lib/libssl.so.6
>
> #4 0x00468662 in ssl3_connect () from /lib/libssl.so.6
>
> #5 0x0047acba in SSL_connect () from /lib/libssl.so.6
>
> #6 0x0046f4e1 in ssl23_connect () from /lib/libssl.so.6
>
> #7 0x0047acba in SSL_connect () from /lib/libssl.so.6
>
> #8 0x00293dc2 in ?? () from /usr/lib/libcurl.so.3
>
> #9 0x0029485d in Curl_ossl_connect () from /usr/lib/libcurl.so.3
>
> #10 0x002a433f in Curl_ssl_connect () from /usr/lib/libcurl.so.3
>
> #11 0x00283af2 in Curl_http_connect () from /usr/lib/libcurl.so.3
>
> #12 0x0028c181 in Curl_protocol_connect () from /usr/lib/libcurl.so.3
>
> #13 0x0028e940 in Curl_connect () from /usr/lib/libcurl.so.3
>
> #14 0x0029944b in ?? () from /usr/lib/libcurl.so.3
>
> #15 0x0029ba40 in Curl_perform () from /usr/lib/libcurl.so.3
>
> #16 0x0029bfc9 in curl_easy_perform () from /usr/lib/libcurl.so.3
>
> #17 0x0027296c in FB_call_webservice (AA_param=0x9aa5554 "234010000000000")
> at send_webservice.cpp:388
>
> #18 0x00b1a9f9 in FB_handle_trigger (APS_msg=0x9aa5550) at
> send_trigger_queue.cpp:55
>
> #19 0x00b1ac43 in FV_handle_queue_thread (AP_data=0x1) at
> send_trigger_queue.cpp:112
>
> #20 0x007da49b in start_thread () from /lib/libpthread.so.0
>
> #21 0x005c942e in clone () from /lib/libc.so.6
Its kind of odd EVP_CipherInit_ex is calling EVP_CIPHER_CTX_cleanup.
But it is in the OpenSSL source code (evp_enc.c, line 130):

/* Line 103 below */
int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
ENGINE *impl,
         const unsigned char *key, const unsigned char *iv, int enc) {
     ...

     /* Ensure a context left lying around from last time is cleared
      * (the previous check attempted to avoid this if the same
      * ENGINE and EVP_CIPHER could be used). */
     if (ctx->cipher)
     {
        /* Line 130 below */
        unsigned long flags = ctx->flags;
        EVP_CIPHER_CTX_cleanup(ctx);
        /* Restore encrypt and flags */
        ctx->encrypt = enc;
        ctx->flags = flags;
     }
     ...

Can you do a `bt full` to get the full backtrace? Specifically, what's
the first argument to EVP_CipherInit_ex?

Can you do a `info sharedlibrary` to see what's mapped aroud
0x0945fb80? Based on Frame 17 (AA_param=0x9aa5554), this looks like it
could be application space. Are you trying to execute data? If so, are
-z,noexecstack and -z,noexecheap in effect?

What version of OpenSSL are you using?

Was OpenSSL built with threading support (cat <openssl/opensslconf.h>
and grep for OPENSSL_THREADS)?

Presuming everything in OpenSSL and Curl is OK, you probably have a
memory problem above frame 16. Run Valgrind or Claing with Asan
(address sanitizer) over the binary. I find Asan easier because its
less noisy and does not require a supression file.

Jeff
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-10-15