pthread_sighandler

Jakub Jelinek jakub@redhat.com
Fri Feb 23 14:14:00 GMT 2001


Hi!

On several architectures pthread_sighandler takes as last argument some
structure or union which it copies down to the actual signal handler it
calls. I got already second request (one from libjava folks, the other one
now in our bugzilla) that this ctx is copied back, because otherwise if
signal handler sets ctx.eip or some other register and returns instead of
longjmping, the result is different in threaded application (it has no
effect) and non-threaded application (it works as expected).
Unfortunately, there does not seem to be an easy way how to copy back the
structure argument after the call, basically the only solution I can think
about is a small assembly stub routine which would pthread_sighandler call
instead of sighandler[signo].old(signo, SIGCONTEXT_EXTRA_ARGS ctx);,
something like
CALL_SIGHANDLER(sighandler[signo].old, signo, SIGCONTEXT_EXTRA_ARGS ctx)
which could on some architectures be expanded to what this used to be (if
ctx is a pointer) or to some
call_sighandler(sighandler[signo].old, signo, &ctx);
call which would in assembly allocate stack for the signo and ctx arguments,
copy ctx in, call the handler and afterwards copy the structure back.
What do you think?

	Jakub



More information about the Libc-hacker mailing list