[stunnel-users] connect error 0 running on ARM platform

FX35 fx35 at free.fr
Mon Jan 13 14:40:28 CET 2014


> Message: 3
> Date: Fri, 10 Jan 2014 15:27:10 +0100
> From: Michal Trojnara <Michal.Trojnara at mirt.net>
> To: stunnel-users at stunnel.org
> Subject: Re: [stunnel-users] connect error 0 running on ARM platform
> Message-ID: <52D0033E.1060109 at mirt.net>
> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>
> On 01/09/2014 06:02 PM, FX35 wrote:
>>   Running stunnel 4.56 or 5.00 on an ARM platform (ARM926EJ) with Linux
>> 2.6.36.4, I encounter the following error : the call to connect()
>> return -1, but errno is set to 0 !
>>
>>   If stunnel is configured to use fork mode instead of pthread mode,
>> the problem disapear.
>>
>>   So it seems there is a problem, cross-compiling the program, with
>> errno or __errno_location() in the program generated with pthread.
>>
>>   I add the definition of _REENTRANT, without success ...
>>
>> (See $H1 at http://pauillac.inria.fr/~xleroy/linuxthreads/faq.html)
>>
>>   Is somebody meet the same error ?
>
> The errno definition in the Android framework (as an example of
> Linux/ARM platform) is:
>
>      /* internal function returning the address of the thread-specific
>      errno */
>      extern volatile int*   __errno(void);
>
>      /* a macro expanding to the errno l-value */
>      #define  errno   (*__errno())
>
>
> It seems okay.
>
> How do you reproduce this problem?  What are the stunnel debug logs when
> it happens?
>
> Mike

  Hello Mike,

  It seems that the errno variable is not correcly set/updated in C 
library, using pthread mode.

  Sample:

    errno = -1;
    ret = connect(...);
    if( ret == -1 )
    {
       printf("errno=%d\n",errno);
    }

    will displays value -1 for errno, not EINPROGRESS or EWOULDBLOCK !

  errno is not updated ...

  So errno doen't reflect the real value.

  Map file of stunnel programm shows _errno_localion(), as you wrote.

  Perhaps is there a bug in uClib ?

  Here is the result of ldd command:

  # ldd stunnel
         libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x400f3000)
         libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x4013d000)
         libz.so.1 => /usr/lib/libz.so.1 (0x4027c000)
         libdl.so.0 => /lib/libdl.so.0 (0x4029b000)
         libutil.so.0 => /lib/libutil.so.0 (0x4009e000)
         libpthread.so.0 => /lib/libpthread.so.0 (0x400a7000)
         libc.so.0 => /lib/libc.so.0 (0x402a6000)
         libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x400c6000)
         ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x4008f000)

  Thanks for help.

  Regards,

            FWX.



More information about the stunnel-users mailing list