[LLVMbugs] [Bug 10413] New: Race condition in unix signal handling

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 19 15:44:53 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10413

           Summary: Race condition in unix signal handling
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: rolfbjarne at gmail.com
                CC: llvmbugs at cs.uiuc.edu


There is a race condition in the code that registers signal handlers and
handles signals here: llvm/lib/Support/Unix/Signals.inc

The problem is if two signals are raised in quick succession, you'll handle the
first one in your signal handler, and then restore the signal handler to the
previous one. If the second signal is raised before you've restored the
previous handler, the process will exit (since you specify SA_RESETHAND when
registering your signal handler, there is a small window of time where the
default signal handler is in effect).

This is a problem for mono, we already use a few of the signals you handle
(SIGFPE, SIGUSR1, SIGUSR2). It means that in a few rare cases an application
will randomly just exit without any diagnostic message at all (which is
somewhat ironic, given that you add signal handlers only to provide more/better
information when crashes occur).

I think the fix would be to just remove the SA_NODEFER|SA_RESETHAND flags you
use when registering the signal handler.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list