Make crash reports reliable in multithreaded case

This commit is contained in:
Justine Tunney 2024-05-23 19:23:42 -07:00
parent 3b0ea2db4d
commit bf3531de81
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
3 changed files with 10 additions and 6 deletions

View file

@ -192,6 +192,8 @@ void ShowCrashReportHook(int, int, int, struct siginfo *, ucontext_t *);
static relegated void ShowCrashReport(int err, int sig, struct siginfo *si,
ucontext_t *ctx) {
if (sig != SIGTRAP && sig != SIGQUIT)
sigaddset(&ctx->uc_sigmask, sig);
#pragma GCC push_options
#pragma GCC diagnostic ignored "-Walloca-larger-than="
long size = __get_safe_size(8192, 4096);

View file

@ -191,6 +191,8 @@ static relegated char *GetSymbolName(struct SymbolTable *st, int symbol) {
static relegated void __oncrash_impl(int sig, struct siginfo *si,
ucontext_t *ctx) {
if (sig != SIGTRAP && sig != SIGQUIT)
sigaddset(&ctx->uc_sigmask, sig);
#pragma GCC push_options
#pragma GCC diagnostic ignored "-Walloca-larger-than="
long size = __get_safe_size(10000, 4096);

View file

@ -85,13 +85,13 @@ void ShowCrashReports(void) {
#ifdef __x86_64__
InstallCrashHandler(SIGTRAP, 0);
#else
InstallCrashHandler(SIGTRAP, SA_RESETHAND);
InstallCrashHandler(SIGTRAP, 0);
#endif
InstallCrashHandler(SIGFPE, SA_RESETHAND);
InstallCrashHandler(SIGILL, SA_RESETHAND);
InstallCrashHandler(SIGBUS, SA_RESETHAND);
InstallCrashHandler(SIGABRT, SA_RESETHAND);
InstallCrashHandler(SIGSEGV, SA_RESETHAND | SA_ONSTACK);
InstallCrashHandler(SIGFPE, 0);
InstallCrashHandler(SIGILL, 0);
InstallCrashHandler(SIGBUS, 0);
InstallCrashHandler(SIGABRT, 0);
InstallCrashHandler(SIGSEGV, SA_ONSTACK);
}
IGNORE_LEAKS(ShowCrashReports)