[stunnel-users] Solaris: new_context, makecontext

Hans Werner Strube strube at physik3.gwdg.de
Mon Nov 7 12:46:18 CET 2005


Concerns all versions of sthreads.c using ucontext:
As far as I know from the Solaris documentation and some experiments,
the context treatment in new_context() is not universally correct.

#if defined(__sgi) || (defined(__sparc) && !defined(HAVE___MAKECONTEXT_V2))
    ctx->ctx.uc_stack.ss_sp=ctx->stack+STACK_SIZE-8;
#else /* not an IRIX or old and buggy Solaris on Sparc */
    ctx->ctx.uc_stack.ss_sp=ctx->stack;
#endif

The first case is wrong for Solaris 10, since HAVE___MAKECONTEXT_V2 is
not defined there but the behavior is _always_ as with HAVE___MAKECONTEXT_V2
in Solaris 9 SPARC. (Solaris 9 SPARC behaves like Solaris 7 and 8 SPARC
["old and buggy"] if HAVE___MAKECONTEXT_V2 is not set, and like Solaris 10
if it is set.)

In the "old and buggy" case, the third argument of makecontext() should
be 2 instead of 1 (although the latter _may_ work).

I do not know how this is in Solaris x86. At least, HAVE___MAKECONTEXT_V2
has no meaning there.



More information about the stunnel-users mailing list