Changeset 215638 in webkit for trunk/Source/JavaScriptCore/tools


Ignore:
Timestamp:
Apr 21, 2017, 2:28:17 PM (8 years ago)
Author:
[email protected]
Message:

Unreviewed, rolling out r215634.

underlying build issues should have been fixed

Reverted changeset:

"Unreviewed, rolling out r215620 and r215623."
https://bugs.webkit.org/show_bug.cgi?id=171139
http://trac.webkit.org/changeset/215634

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/tools/SigillCrashAnalyzer.cpp

    r215634 r215638  
    3838#endif
    3939
    40 #if HAVE(SIGNAL_H)
    41 #include <signal.h>
    42 #endif
     40#include <wtf/threads/Signals.h>
    4341
    4442namespace JSC {
     
    142140};
    143141
    144 struct sigaction originalSigIllAction;
    145 
    146 static void handleCrash(int signalNumber, siginfo_t* info, void* uap)
    147 {
    148     SignalContext context(static_cast<ucontext_t*>(uap)->uc_mcontext);
    149     SigillCrashAnalyzer& analyzer = SigillCrashAnalyzer::instance();
    150     auto crashSource = analyzer.analyze(context);
    151 
    152     auto originalAction = originalSigIllAction.sa_sigaction;
    153     if (originalAction) {
    154         // It is always safe to just invoke the original handler using the sa_sigaction form
    155         // without checking for the SA_SIGINFO flag. If the original handler is of the
    156         // sa_handler form, it will just ignore the 2nd and 3rd arguments since sa_handler is a
    157         // subset of sa_sigaction. This is what the man pages says the OS does anyway.
    158         originalAction(signalNumber, info, uap);
    159     }
    160 
    161     if (crashSource == SigillCrashAnalyzer::CrashSource::JavaScriptCore) {
    162         // Restore the default handler so that we can get a core dump.
    163         struct sigaction defaultAction;
    164         defaultAction.sa_handler = SIG_DFL;
    165         sigfillset(&defaultAction.sa_mask);
    166         defaultAction.sa_flags = 0;
    167         sigaction(SIGILL, &defaultAction, nullptr);
    168     } else if (!originalAction) {
    169         // Pre-emptively restore the default handler but we may roll it back below.
    170         struct sigaction currentAction;
    171         struct sigaction defaultAction;
    172         defaultAction.sa_handler = SIG_DFL;
    173         sigfillset(&defaultAction.sa_mask);
    174         defaultAction.sa_flags = 0;
    175         sigaction(SIGILL, &defaultAction, &currentAction);
    176 
    177         if (currentAction.sa_sigaction != handleCrash) {
    178             // This means that there's a client handler installed after us. This also means
    179             // that the client handler thinks it was able to recover from the SIGILL, and
    180             // did not uninstall itself. We can't argue with this because the crash isn't
    181             // known to be from a JavaScriptCore source. Hence, restore the client handler
    182             // and keep going.
    183             sigaction(SIGILL, &currentAction, nullptr);
    184         }
    185     }
    186 }
    187 
    188142static void installCrashHandler()
    189143{
    190144#if CPU(X86_64) || CPU(ARM64)
    191     struct sigaction action;
    192     action.sa_sigaction = reinterpret_cast<void (*)(int, siginfo_t *, void *)>(handleCrash);
    193     sigfillset(&action.sa_mask);
    194     action.sa_flags = SA_SIGINFO;
    195     sigaction(SIGILL, &action, &originalSigIllAction);
    196 #else
    197     UNUSED_PARAM(handleCrash);
     145    installSignalHandler(Signal::Ill, [] (int, siginfo_t*, void* uap) {
     146        SignalContext context(static_cast<ucontext_t*>(uap)->uc_mcontext);
     147
     148        if (!isJITPC(context.machinePC))
     149            return SignalAction::NotHandled;
     150
     151        SigillCrashAnalyzer& analyzer = SigillCrashAnalyzer::instance();
     152        analyzer.analyze(context);
     153        return SignalAction::NotHandled;
     154    });
    198155#endif
    199156}
Note: See TracChangeset for help on using the changeset viewer.