This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

pthread_sighandler


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]