pthread_sighander() of glibc-2.2 breaks stack
Hello Andreas,
I had a experience that pthread_sighander() of current glibc-2.2 breaks stack. I tracked down the problem, and finally found the mismatch between kenrel and glibc-2.2.
Current kernel pass following args to the signal handler for the case of not SA_SIGINFO specified.
a0 signal number
a1 0 (cause code?)
a2 pointer to sigcontext struct
But, the pthread_sighander() of glibc-2.2 expects;
1st arg. signal number
2nd arg. sigcontext struct itself (not pointer)
Patches attached below. Please apply.
Thanks.
---
Hiroyuki Machida
Creative Station SCE Inc.
=== ChangeLog entry.
* sysdeps/unix/sysv/linux/mips/register-dump.h (REGISTER_DUMP):
Change type of CTX to (struct sigcontext *).
* sysdeps/unix/sysv/linux/mips/sigcontextinfo.h (GET_PC): Likewise. (GET_FRAME): Likewise (GET_STACK): Likewise. (SIGCONTEXT): Likewise. Add 2nd arg _CODE. (SIGCONTEXT_EXTRA_ARGS): Add 2nd arg _CODE.
===================================================================
unix/sysv/linux/mips/register-dump.h renamed from unix/sysv/linux/mips/register-dump.h.ORG +1 -1
@@ -105,4 +105,4 @@ register_dump (int fd, struct sigcontext } -#define REGISTER_DUMP register_dump (fd, &ctx) +#define REGISTER_DUMP register_dump (fd, ctx)
===================================================================
unix/sysv/linux/mips/sigcontextinfo.h renamed from unix/sysv/linux/mips/sigcontextinfo.h.ORG +5 -5
@@ -18,8 +18,8 @@Boston, MA 02111-1307, USA. */ -#define SIGCONTEXT struct sigcontext -#define SIGCONTEXT_EXTRA_ARGS -#define GET_PC (ctx) ((void *) ctx.sc_pc) -#define GET_FRAME (ctx) ((void *) ctx.sc_regs[30]) -#define GET_STACK (ctx) ((void *) ctx.sc_regs[29]) +#define SIGCONTEXT unsigned long _code, struct sigcontext * +#define SIGCONTEXT_EXTRA_ARGS _code, +#define GET_PC (ctx) ((void *) ctx->sc_pc) +#define GET_FRAME (ctx) ((void *) ctx->sc_regs[30]) +#define GET_STACK (ctx) ((void *) ctx->sc_regs[29])
Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Hiroyuki Machida writes:
Hello Andreas,
I had a experience that
pthread_sighander()of current glibc-2.2 breaks stack. I tracked down the problem, and finally found the mismatch between kenrel and glibc-2.2.Current kernel pass following args to the signal handler for the case of not
SA_SIGINFOspecified.
a0 signal number
a1 0 (cause code?)
a2 pointer to sigcontext struct
Quoted 5 lines
But, the
pthread_sighander()of glibc-2.2 expects;
1st arg. signal number
2nd arg. sigcontext struct itself (not pointer)Patches attached below. Please apply.
Thanks, I've committed them,
Andreas
Signature · 4 lines
Andreas Jaeger SuSE Labs [email protected] private [email protected] http://www.suse.de/~aj