[stunnel-users] Fix unexpected stunnel-4.10 exits on FreeBSD
Michal Trojnara
Michal.Trojnara at mirt.net
Wed Jun 15 15:59:55 CEST 2005
On 2005-06-14, at 14:08, Vasil Dimov wrote:
>> + makecontext(&ctx_cleanup, ctx_cleanup_func, 0);
> Changing the currently executing context (with makecontext) does not
> seem very robust to me, but, however, I am not an ucontext expert
> (in fact I have not heard about it before beginning to experience
> problems with stunnel-4.10).
makecontext(3) only prepares the structure.
setcontext(2) modifies the context.
> Hmm, what is this version of stunnel?
4.10 + some diagnostic code.
> 4.10 does not print "Switching from context M to context N",
> "Context switched", etc.
>
> Is the number after the pid showing the thread id? How is it possible
> that context2 prints "Switching from context 1 to context 2", shouldnt
> this be printed by context 1?
Context 2 is already in the ready queue.
The code is:
/* switch the context */
if(fds) { /* swap the context */
s_log(LOG_DEBUG, "Switching from context %ld to context %ld",
ctx->id, ready_head->id);
swapcontext(&ctx->ctx, &ready_head->ctx);
s_log(LOG_DEBUG, "Context switched");
return ready_head->ready;
} else { /* drop the context */
setcontext(&ready_head->ctx);
ioerror("setcontext"); /* should not ever happen */
return 0;
}
> Do you confirm that stunnel begins to crash after applying bsd.patch on
> your User-Mode Linux?
No. It has nothing to do with bsd.patch
> Does the Context 2 function start execution at all, or the program
> crashes before that?
The crash is on swapcontext().
> I noticed that backtraces of ucontexting programs are not very useful,
> but can you retrieve a backtrace from the core file? What does it show?
It seems smashed.
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 704)]
0x40020bae in _pthread_cleanup_push_defer () from /lib/libpthread.so.0
(gdb) bt
#0 0x40020bae in _pthread_cleanup_push_defer () from
/lib/libpthread.so.0
#1 0x401f702c in vfprintf () from /lib/libc.so.6
#2 0x401f2ec0 in vfprintf () from /lib/libc.so.6
#3 0x401fb94f in fprintf () from /lib/libc.so.6
#4 0x0804df97 in s_log (level=134571040,
format=0x402d5440
"\207(??\207T-@\207T-@\207T-@\207T-@\207T-@\207T-@\207T-@\210T-@") at
log.c:152
#5 0x0804b514 in client (arg=0x807d960) at client.c:106
#6 0x401f0674 in makecontext () from /lib/libc.so.6
#7 0x0807d960 in ?? ()
#8 0x0805eca0 in next_id ()
#9 0x00000002 in ?? ()
#10 0x00000000 in ?? ()
#11 0x0805eca0 in next_id ()
#12 0x08085ed0 in ?? ()
#13 0x00000000 in ?? ()
#14 0x00010000 in ?? ()
#15 0x00000000 in ?? ()
#16 0x00000000 in ?? ()
#17 0x00000000 in ?? ()
#18 0x00000000 in ?? ()
#19 0xbffff99c in ?? ()
#20 0x00000009 in ?? ()
Best regards,
Mike
More information about the stunnel-users
mailing list