I'm not creating any MFC applications on linux. the client is for Windows 
platform, but as I said I don't think the client matters. I also wrote some 
client emulation on linux that emulates the behavior of the MFC clients  and 
the server still crashes.


----- Original Message ----
From: Kyle Hamilton <[EMAIL PROTECTED]>
To: openssl-users@openssl.org
Sent: Friday, April 18, 2008 2:33:03 PM
Subject: Re: Segmentation fault in SSL_read() (Re-post)

How are you creating an MFC executable on Linux?

-Kyle H

On Fri, Apr 18, 2008 at 4:29 AM, Ion Scerbatiuc <[EMAIL PROTECTED]> wrote:
>
> Thanks for your reply.
>
> I use OpenSSL 0.9.8g 19 Oct 2007.
> I compiled the library from source on a Redhat Linux Enterprise. The output
> of `uname -a`:
> Linux www.mysite.com 2.6.9-55.0.2.ELsmp #1 SMP Tue Jun 12 17:59:08 EDT 2007
> i686 i686 i386 GNU/Linux
> The compiler used was the gnu c compiler, I think (I used the default steps
> in compiling)...
> The same compiler was used with my project...
> The linker I used with my main executable is g++.
>
> I provided the following locking functions:
> ------------------------------------------------------------------------------------
> static void locking_function(int mode, int n, const char *file, int line)
> static unsigned long id_function(void)
> ------------------------------------------------------------------------------------
>
> Before calling SSL_read I assured that the buffer (used as the second
> parameter) was allocated.
>
> Any other suggestions or questions?
>
> Thanks for your time!
> Regards,
> Scerbatiuc Ion
>
>
> ----- Original Message ----
> From: Kyle Hamilton <[EMAIL PROTECTED]>
> To: openssl-users@openssl.org
>
> Sent: Friday, April 18, 2008 2:14:03 PM
> Subject: Re: Segmentation fault in SSL_read() (Re-post)
>
> My initial idea would be that you're passing in an invalid pointer to
> SSL_read.  Does this happen with, say, openssl s_client?
>
> Remember a couple of things:
>
> 1) You MUST use the proper version of the library (debug or release)
> with the appropriate build setting in your project (debug or release).
> 2) You MUST provide the appropriate locking functions.
> 3) You MUST provide the appropriate malloc that your main binary is using.
>
> (This is all stuff documented in the FAQ.)
>
> How did you obtain this version of the library?  What version of the
> library code is it?  What compiler are you using for your main
> executable?  What compiler was used to create the library?  What
> linker was used for all of it?
>
> -Kyle H
>
> On Fri, Apr 18, 2008 at 3:15 AM, Ion Scerbatiuc <[EMAIL PROTECTED]>
> wrote:
> >
> > Sorry for the fist post. It seems like I have some problems with the other
> > email client. A new try :)
> > I have wrote a multi-threaded server (UNIX) and I use OpenSSL for
> encrypting
> > communication between
> > the server and the client (the client is an MFC application, but I think
> > this
> > doesn't matter...).
> > Server is running fine but randomly it crashes and every time in
> SSL_read()
> > method.
> > Here is a snippet from one of the core dumps:
> > ------------------------------------------------------------------------
> > Core was generated by `/opt/whozin/wnsd_test -l'.
> > Program terminated with signal 11, Segmentation fault.
> > Reading symbols from /usr/lib/libccext2-1.5.so.0...done.
> > Loaded symbols for /usr/lib/libccext2-1.5.so.0
> > Reading symbols from /usr/lib/libccgnu2-1.5.so.0...done.
> > Loaded symbols for /usr/lib/libccgnu2-1.5.so.0
> > Reading symbols from /usr/lib/libboost_regex.so.1...done.
> > Loaded symbols for /usr/lib/libboost_regex.so.1
> > Reading symbols from /lib/tls/libpthread.so.0...done.
> > Loaded symbols for /lib/tls/libpthread.so.0
> > Reading symbols from /usr/lib/libdaemon.so.0...done.
> > Loaded symbols for /usr/lib/libdaemon.so.0
> > Reading symbols from /lib/libssl.so.4...done.
> > Loaded symbols for /lib/libssl.so.4
> > Reading symbols from /lib/libcrypto.so.4...done.
> > Loaded symbols for /lib/libcrypto.so.4
> > Reading symbols from /usr/lib/liblog4cxx.so.9...done.
> > Loaded symbols for /usr/lib/liblog4cxx.so.9
> > Reading symbols from /usr/lib/libstdc++.so.6...done.
> > Loaded symbols for /usr/lib/libstdc++.so.6
> > Reading symbols from /lib/tls/libm.so.6...done.
> > Loaded symbols for /lib/tls/libm.so.6
> > Reading symbols from /lib/libgcc_s.so.1...done.
> > Loaded symbols for /lib/libgcc_s.so.1
> > Reading symbols from /lib/tls/libc.so.6...done.
> > Loaded symbols for /lib/tls/libc.so.6
> > Reading symbols from /lib/tls/librt.so.1...done.
> > Loaded symbols for /lib/tls/librt.so.1
> > Reading symbols from /usr/lib/libz.so.1...done.
> > Loaded symbols for /usr/lib/libz.so.1
> > Reading symbols from /lib/ld-linux.so.2...done.
> > Loaded symbols for /lib/ld-linux.so.2
> > Reading symbols from /usr/lib/libgssapi_krb5.so.2...done.
> > Loaded symbols for /usr/lib/libgssapi_krb5.so.2
> > Reading symbols from /usr/lib/libkrb5.so.3...done.
> > Loaded symbols for /usr/lib/libkrb5.so.3
> > Reading symbols from /lib/libcom_err.so.2...done.
> > Loaded symbols for /lib/libcom_err.so.2
> > Reading symbols from /usr/lib/libk5crypto.so.3...done.
> > Loaded symbols for /usr/lib/libk5crypto.so.3
> > Reading symbols from /lib/libresolv.so.2...done.
> > Loaded symbols for /lib/libresolv.so.2
> > Reading symbols from /lib/libdl.so.2...done.
> > Loaded symbols for /lib/libdl.so.2
> > Reading symbols from /usr/lib/libxml2.so.2...done.
> > Loaded symbols for /usr/lib/libxml2.so.2
> > Reading symbols from /lib/libnss_files.so.2...done.
> > Loaded symbols for /lib/libnss_files.so.2
> > Reading symbols from /lib/libnss_dns.so.2...done.
> > Loaded symbols for /lib/libnss_dns.so.2
> > #0  0x00c9b7a0 in SSL_read () from /lib/libssl.so.4
> > (gdb) bt
> > #0  0x00c9b7a0 in SSL_read () from /lib/libssl.so.4
> > #1  0x0805b27b in wns::ServerPort::pending (this=0xb6014d38) at
> > serverport.cpp:85
> > #2  0x00d2f241 in ost::SocketService::run (this=0x9fb1c78) at
> > socketport.cpp:748
> > #3  0x002c713d in ccxx_exec_handler (th=0x9fb1c78) at thread.cpp:1097
> > #4  0x00a813cc in start_thread () from /lib/tls/libpthread.so.0
> > #5  0x009d9c3e in clone () from /lib/tls/libc.so.6
> > ------------------------------------------------------------------------
> >
> > I also made a disassembly:
> >
> > ------------------------------------------------------------------------
> > (gdb) disass
> > Dump of assembler code for function SSL_read:
> > 0x00c9b75b <SSL_read+0>:        push  %ebp
> > 0x00c9b75c <SSL_read+1>:        mov    %esp,%ebp
> > 0x00c9b75e <SSL_read+3>:        push  %ebx
> > 0x00c9b75f <SSL_read+4>:        call  0xc867ce <SSLv2_method+258>
> > 0x00c9b764 <SSL_read+9>:        add    $0x130f4,%ebx
> > 0x00c9b76a <SSL_read+15>:      sub    $0x14,%esp
> > 0x00c9b76d <SSL_read+18>:      mov    0x8(%ebp),%ecx
> > 0x00c9b770 <SSL_read+21>:      mov    0x20(%ecx),%eax
> > 0x00c9b773 <SSL_read+24>:      test  %eax,%eax
> > 0x00c9b775 <SSL_read+26>:      je    0xc9b7a9 <SSL_read+78>
> > 0x00c9b777 <SSL_read+28>:      testb  $0x2,0x30(%ecx)
> > 0x00c9b77b <SSL_read+32>:      je    0xc9b78c <SSL_read+49>
> > 0x00c9b77d <SSL_read+34>:      movl  $0x1,0x18(%ecx)
> > 0x00c9b784 <SSL_read+41>:      xor    %eax,%eax
> > 0x00c9b786 <SSL_read+43>:      add    $0x14,%esp
> > 0x00c9b789 <SSL_read+46>:      pop    %ebx
> > 0x00c9b78a <SSL_read+47>:      pop    %ebp
> > 0x00c9b78b <SSL_read+48>:      ret
> > 0x00c9b78c <SSL_read+49>:      mov    0x10(%ebp),%edx
> > 0x00c9b78f <SSL_read+52>:      mov    0x8(%ecx),%eax
> > 0x00c9b792 <SSL_read+55>:      mov    %edx,0x8(%esp)
> > 0x00c9b796 <SSL_read+59>:      mov    0xc(%ebp),%edx
> > 0x00c9b799 <SSL_read+62>:      mov    %ecx,(%esp)
> > 0x00c9b79c <SSL_read+65>:      mov    %edx,0x4(%esp)
> > 0x00c9b7a0 <SSL_read+69>:      call  *0x18(%eax)
> > 0x00c9b7a3 <SSL_read+72>:      add    $0x14,%esp
> > 0x00c9b7a6 <SSL_read+75>:      pop    %ebx
> > 0x00c9b7a7 <SSL_read+76>:      pop    %ebp
> > 0x00c9b7a8 <SSL_read+77>:      ret
> > 0x00c9b7a9 <SSL_read+78>:      lea    0xffffad32(%ebx),%eax
> > 0x00c9b7af <SSL_read+84>:      movl  $0x345,0x10(%esp)
> > 0x00c9b7b7 <SSL_read+92>:      movl  $0x114,0x8(%esp)
> > 0x00c9b7bf <SSL_read+100>:      mov    %eax,0xc(%esp)
> > 0x00c9b7c3 <SSL_read+104>:      movl  $0xdf,0x4(%esp)
> > 0x00c9b7cb <SSL_read+112>:      movl  $0x14,(%esp)
> > 0x00c9b7d2 <SSL_read+119>:      call  0xc85c68
> > 0x00c9b7d7 <SSL_read+124>:      mov    $0xffffffff,%eax
> > 0x00c9b7dc <SSL_read+129>:      jmp    0xc9b786 <SSL_read+43>
> > End of assembler dump.
> > --------------------------------------------------------------------------
> >
> > The crash is always in the line 0x00c9b770 <SSL_read+21>:      mov
> > 0x20(%ecx),%eax
> > Can anyone suggest me what to do?
> >
> > Thanks for your
> >  time!
> > Regards,
> > Scerbatiuc Ion
> >
> >  ________________________________
> > Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
> > now.
> ______________________________________________________________________
> OpenSSL Project                                http://www.openssl.org
> User Support Mailing List                    openssl-users@openssl.org
> Automated List Manager                          [EMAIL PROTECTED]
>
>  ________________________________
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
> now.
______________________________________________________________________
OpenSSL Project                                http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                          [EMAIL PROTECTED]



      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

Reply via email to