Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove SIGSEGV, SIGABRT handlers

It's possible for backtrace() to itself invoke malloc() in at least
some versions of glibc.  Due to the fact that the malloc lock is not
recursive, this will in turn deadlock if we got SIGSEGV inside malloc().

Deadlocking is far worse than segfaulting, and most operating systems
nowadays have some sort of systemwide crash catching facility, so let's
just rely on that.
  • Loading branch information...
commit 0c6194014672135804e2e502fef721181278f9cb 1 parent ec81410
@cgwalters cgwalters authored
View
1  test/gjs-tests.c
@@ -39,7 +39,6 @@ main(int argc,
g_type_init ();
gjs_crash_after_timeout(60*7); /* give the unit tests 7 minutes to complete */
- gjs_init_sleep_on_crash();
g_test_init(&argc, &argv, NULL);
View
1  test/gjs-unit.c
@@ -248,7 +248,6 @@ main(int argc, char **argv)
gjs_crash_after_timeout(timeout);
}
}
- gjs_init_sleep_on_crash();
setlocale(LC_ALL, "");
g_test_init(&argc, &argv, NULL);
View
32 util/crash.c
@@ -96,38 +96,6 @@ gjs_print_backtrace(void)
#endif
}
-static void
-signal_handler(int num)
-{
- const char *sleep_on_crash;
-
- switch (num) {
- case SIGSEGV:
- case SIGABRT:
- gjs_print_backtrace();
-
- sleep_on_crash = g_getenv("GJS_SLEEP_ON_CRASH");
-
- if (sleep_on_crash && !strcmp(sleep_on_crash, "1")) {
- fprintf(stderr, "\n");
- fprintf(stderr, "=== sleeping; attach debugger to PID %u\n", getpid());
- fprintf(stderr, "\n");
-
- sleep(1000);
- }
-
- exit(1);
- break;
- }
-}
-
-void
-gjs_init_sleep_on_crash(void)
-{
- signal(SIGSEGV, signal_handler);
- signal(SIGABRT, signal_handler);
-}
-
/* Fork a process that waits the given time then
* sends us ABRT
*/
View
1  util/crash.h
@@ -27,7 +27,6 @@
G_BEGIN_DECLS
-void gjs_init_sleep_on_crash (void);
void gjs_print_backtrace (void);
void gjs_crash_after_timeout (int seconds);
Please sign in to comment.
Something went wrong with that request. Please try again.