linux-mips
[Top] [All Lists]

pthread_sighander() of glibc-2.2 breaks stack

To: aj@suse.de
Subject: pthread_sighander() of glibc-2.2 breaks stack
From: Hiroyuki Machida <machida@sm.sony.co.jp>
Date: Mon, 15 Jan 2001 15:20:11 +0900
Cc: linux-mips@oss.sgi.com
Sender: owner-linux-mips@oss.sgi.com
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.


===================================================================
--- sysdeps/unix/sysv/linux/mips/register-dump.h.ORG    2000/10/25 05:00:53     
1.1
+++ sysdeps/unix/sysv/linux/mips/register-dump.h        2001/01/12 13:03:30     
1.2
@@ -105,4 +105,4 @@ register_dump (int fd, struct sigcontext
 }
 
 
-#define REGISTER_DUMP register_dump (fd, &ctx)
+#define REGISTER_DUMP register_dump (fd, ctx)
===================================================================
--- sysdeps/unix/sysv/linux/mips/sigcontextinfo.h.ORG   2000/10/25 05:00:53     
1.1
+++ sysdeps/unix/sysv/linux/mips/sigcontextinfo.h       2001/01/12 13:03:31     
1.2
@@ -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])


<Prev in Thread] Current Thread [Next in Thread>