hi,
we've got the following problem:
- compiled stunnel 4.10 with openssl-0.9.7g - stunnel receives a SIGSEGV when connecting
i am really not a C or gdb guru, but running stunnel 4.10 under gdb shows this:
# gdb src/stunnel GNU gdb 6.0 Copyright 2003 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "sparc-sun-solaris2.8"... (gdb) set args /usr/local/stunnel-4.10/etc/stunnel/stunnel.conf (gdb) run Starting program: /usr/local/src/stunnel-4.10/src/stunnel /usr/local/stunnel-4.10/etc/stunnel/stunnel.conf [New LWP 1] [New LWP 2] [New LWP 3] [New LWP 4]
Program received signal SIGSEGV, Segmentation fault. 0x0002a32c in init_ssl (c=0x11e008) at client.c:298 298 s_poll_add(&c->fds, c->ssl_rfd->fd, (gdb) bt #0 0x0002a32c in init_ssl (c=0x11e008) at client.c:298 #1 0x00029f30 in do_client (c=0x11e008) at client.c:147 #2 0x00029dd8 in client (arg=0x126270) at client.c:120 (gdb) p c->ssl_rfd $1 = (FD *) 0x1 (gdb)
so it seems c->ssl_rfd points to nowhere. further investigation reveals that c->ssl_rfd gets overwritten after the call to SSL_accept.
stunnel 4.09 works. is this a problem with UCONTEXT?
************************************************************************ information as request on the support page:
openssl version: OpenSSL 0.9.7g 11 Apr 2005
uname -a: SunOS coti 5.8 Generic_117350-05 sun4u sparc SUNW,UltraAX-i2
gcc -v: Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/specs Configured with: ../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --disable-nls --disable-libgcj --enable-languages=c,c++ Thread model: posix gcc version 3.3.2
stunnel log with debug=7:
2005.04.27 08:41:33 LOG5[24386:1]: stunnel 4.10 on sparc-sun-solaris2.8 UCONTEXT+POLL+IPv4 with OpenSSL 0.9.7g 11 Apr 2005 2005.04.27 08:41:33 LOG7[24386:1]: RAND_status claims sufficient entropy for the PRNG 2005.04.27 08:41:33 LOG6[24386:1]: PRNG seeded successfully 2005.04.27 08:41:33 LOG7[24386:1]: Configuration SSL options: 0x00000FFF 2005.04.27 08:41:33 LOG7[24386:1]: SSL options set: 0x00000FFF 2005.04.27 08:41:33 LOG7[24386:1]: Certificate: /usr/local/stunnel-4.10/etc/stunnel/stunnel.pem 2005.04.27 08:41:33 LOG7[24386:1]: Key file: /usr/local/stunnel-4.10/etc/stunnel/stunnel.pem 2005.04.27 08:41:33 LOG6[24386:1]: file ulimit = 256 (can be changed with 'ulimit -n') 2005.04.27 08:41:33 LOG6[24386:1]: poll() used - no FD_SETSIZE limit for file descriptors 2005.04.27 08:41:33 LOG5[24386:1]: 125 clients allowed 2005.04.27 08:41:33 LOG7[24386:1]: FD 5 in non-blocking mode 2005.04.27 08:41:33 LOG7[24386:1]: FD 6 in non-blocking mode 2005.04.27 08:41:33 LOG7[24386:1]: FD 7 in non-blocking mode 2005.04.27 08:41:33 LOG7[24386:1]: SO_REUSEADDR option set on accept socket 2005.04.27 08:41:33 LOG7[24386:1]: https bound to 0.0.0.0:443 2005.04.27 08:41:33 LOG7[24386:1]: Created pid file /usr/local/stunnel-4.10/var/stunnel/stunnel.pid 2005.04.27 08:41:33 LOG7[24386:0]: Waiting -1 second(s) for 2 file descriptor(s) 2005.04.27 08:41:35 LOG7[24386:0]: CONTEXT 1, FD=5, (IN)->() 2005.04.27 08:41:35 LOG7[24386:0]: CONTEXT 1, FD=7, (IN)->(IN) 2005.04.27 08:41:35 LOG7[24386:1]: https accepted FD=9 from 162.25.222.252:35728 2005.04.27 08:41:35 LOG7[24386:1]: Creating a new context 2005.04.27 08:41:35 LOG7[24386:1]: Context 2 created 2005.04.27 08:41:35 LOG7[24386:2]: https started 2005.04.27 08:41:35 LOG7[24386:2]: FD 9 in non-blocking mode 2005.04.27 08:41:35 LOG5[24386:2]: https connected from 162.25.222.252:35728 2005.04.27 08:43:08 LOG7[24386:2]: SSL state (accept): before/accept initialization 2005.04.27 08:43:08 LOG7[24386:2]: SSL state (accept): SSLv3 read client hello A 2005.04.27 08:43:08 LOG7[24386:2]: SSL state (accept): SSLv3 write server hello A 2005.04.27 08:43:08 LOG7[24386:2]: SSL state (accept): SSLv3 write certificate A 2005.04.27 08:43:08 LOG7[24386:2]: SSL state (accept): SSLv3 write server done A 2005.04.27 08:43:08 LOG7[24386:2]: SSL state (accept): SSLv3 flush data ************************************************************************
thanks for your time and help
regards toni
On Wed, Apr 27, 2005 at 10:38:25AM +0200, Toni Schmidbauer wrote:
stunnel 4.09 works. is this a problem with UCONTEXT?
compiling 4.10 without -DHAVE_UCONTEXT_H=1 fixes the problem.
forgot to mention the we are running stunnel in standalone mode in my previous post, sorry.
cheers toni