Re: [stunnel-users] stunnel-4.15 segfaulting and looping under

This is a discussion on Re: [stunnel-users] stunnel-4.15 segfaulting and looping under within the Stunnel Users forums, part of the Networking and Network Related category; --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, May 17, 2006 at 06:01:37PM +...


Go Back   Usenet Forums > Networking and Network Related > Stunnel Users

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-26-2006
Michael Weiser
 
Posts: n/a
Default Re: [stunnel-users] stunnel-4.15 segfaulting and looping under


--bg08WKrSYDhXBjb5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, May 17, 2006 at 06:01:37PM +0200, Michael Weiser wrote:

> > I'm now retrying with a freshly compiled openssl-0.9.8b to see if that has
> > anything to do with anything.

> The problem persists with openssl-0.9.8b:


> # gdb src/stunnel --core stunnel.core --batch -ex "thread apply all bt
> full" -ex "quit"
> Core was generated by `stunnel'.
> Program terminated with signal 11, Segmentation fault.
> #0 0x280d07b5 in SSL_get_peer_certificate () from
> ../bin/openssl-0.9.8b/lib/libssl.so.0.9.8
> [New LWP 100077]


The problem is triggered by a change to src/client.c in stunnel-4.15.
client() now loops over calls to run_client() instead of doing it just
once. The first, successful (!) call to run_client() seems to leave the
ssl context in an undefined state which makes the following calls to
run_client() segfault in the forked child which in turn produces the
core file. My guess is, that it's not actually supposed to loop if the
call to run_client() is successful.

Reverting client.c to roughly 4.14 fixes the problem for me. A patch is
attached. Any insights and a more permanent fix would be highly
appreciated.

BTW: I configured stunnel with --with-threads=pthread. By default,
ucontext is detected, which is broken in stunnel-4.14 as well. After
finishing, 4.14 hangs in s_poll_wait waiting for -1 seconds on 0 fds
(!?). I can provide debugging log and gdb output if needed.
--
bye, Michael

--bg08WKrSYDhXBjb5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="stunnel-4.15.diff"

--- src/client.c~ Thu May 25 12:09:43 2006
+++ src/client.c Thu May 25 12:49:15 2006
@@ -106,10 +106,8 @@
if(c->opt->option.remote && c->opt->option.program) {
/* connect and exec options specified together */
/* -> spawn a local program instead of stdio */
- while((c->local_rfd.fd=c->local_wfd.fd=connect_local(c))>=0) {
- run_client(c);
- sleep(1); /* FIXME: not a good idea in ucontext threading */
- }
+ c->local_rfd.fd=c->local_wfd.fd=connect_local(c);
+ run_client(c);
} else
#endif
{

--bg08WKrSYDhXBjb5
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
stunnel-users mailing list
stunnel-users@mirt.net
http://stunnel.mirt.net/mailman/listinfo/stunnel-users

--bg08WKrSYDhXBjb5--
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:35 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0