[stunnel-users] Fix unexpected stunnel-4.10 exits on FreeBSD

Michal Trojnara Michal.Trojnara at mirt.net
Mon Jun 13 22:53:00 CEST 2005


On 2005-06-13, at 19:53, Vasil Dimov wrote:
> Patch that fixes this problem can be found here:
> http://www.FreeBSD.org/cgi/query-pr.cgi?pr=82202

Here is my patch:

*** sthreads.c.old      Mon Jun 13 21:34:53 2005
--- sthreads.c  Mon Jun 13 22:15:01 2005
***************
*** 63,68 ****
--- 63,69 ----

   static void ctx_cleanup_func(void) { /* cleanup the active thread */
       s_log(LOG_DEBUG, "Context %ld closed", ready_head->id);
+     makecontext(&ctx_cleanup, ctx_cleanup_func, 0);
       s_poll_wait(NULL, 0); /* wait on poll() */
   }

It's quite simple and it works.  8-)  It's on my FTP site, now.

Special thanks to Paul Dekkers for providing me with a testing FreeBSD 
5.4 environment.

BTW: It still doesn't work on my UML (User-Mode Linux) host:
2005.06.13 22:43:23 LOG7[30415:0]: CONTEXT 1, FD=3, (IN)->()
2005.06.13 22:43:23 LOG7[30415:0]: CONTEXT 1, FD=5, (IN)->(IN)
2005.06.13 22:43:23 LOG7[30415:1]: Switching from context 1 to context 1
2005.06.13 22:43:23 LOG7[30415:1]: Context switched
2005.06.13 22:43:23 LOG7[30415:1]: TST_SVC accepted FD=6 from 
127.0.0.1:3411
2005.06.13 22:43:23 LOG7[30415:1]: Creating a new context
2005.06.13 22:43:23 LOG7[30415:1]: Context 2 created
2005.06.13 22:43:23 LOG7[30415:2]: Switching from context 1 to context 2
Segmentation fault      ./stunnel stunnel.conf

It fails on a first non-trivial context switch.  Any idea?

Best regards,
     Mike




More information about the stunnel-users mailing list