This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


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

Re: SIGFPE -> ArithmeticException ?


I've found the bug.  Here's the routine in libpthread which gets
called when a signal gets sent to a process:

   /* The wrapper around user-provided signal handlers */
   static void pthread_sighandler(int signo)
   {
     pthread_descr self = thread_self();
     char * in_sighandler;
     /* If we're in a sigwait operation, just record the signal received
        and return without calling the user's handler */
     if (THREAD_GETMEM(self, p_sigwaiting)) {
       THREAD_SETMEM(self, p_sigwaiting, 0);
       THREAD_SETMEM(self, p_signal, signo);
       return;
     }
     /* Record that we're in a signal handler and call the user's
        handler function */
     in_sighandler = THREAD_GETMEM(self, p_in_sighandler);
     if (in_sighandler == NULL)
       THREAD_SETMEM(self, p_in_sighandler, CURRENT_STACK_FRAME);
     sighandler[signo](signo);
     if (in_sighandler == NULL)
       THREAD_SETMEM(self, p_in_sighandler, NULL);
   }
   
[ This is from the glibc sources which I unpacked from the Linux 6.0 CD ]

Note that only one parameter, the signo, is passed on to the user's
handler.

As far as I can see, this bug is still in the current pthreads
sources.

I don't think that there's any reason why the pthread library needs to
be called when a SIGFPE occurs (as far as I know SIGFPE is
synchronous) so try replacing calls to sigaction() in i386-signal.h
with __sigaction().  This isn't an ideal solution, but it should work
until pthreads is fixed.

Here's hoping!

Andrew.

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