--with-threads=ucontext portability (was Re: [stunnel-users] stunnel 4.x.x and IRIX)

Miloslav Trmac mitr at redhat.com
Tue Jan 31 01:08:54 CET 2006

Eric Haddix wrote:
> #0  0x1002a780 in client (arg=0x7) at client.c:106
> 106         s_log(LOG_DEBUG, "%s started", c->opt->servname);
I have just seen a crash at a similar place on x86_64.  The apparent
cause is sthreads.c:116:
    makecontext(&ctx->ctx, (void(*)(void))cli, 1, arg);
arg is a void *, but:
- the size is given as 1; it should be
  (sizeof (arg) + sizeof (int) - 1) / sizeof (int)
  because the "size" is defined as a number of int arguments
- it won't work anyway; makecontext () is defined to work only for
  integer parameters.  It is not possible to pass a pointer as
  integers on x86_64, which uses registers to pass the first 6
  integer or pointer parameters.

--with-threads=pthread seems to work fine in my test case.

More information about the stunnel-users mailing list