Skip to content

Commit 4c21cb3

Browse files
authored
[mono] Exit early to prevent endless loop when crashing (#105249)
We hit an issue where we got into an endless loop of crashes while trying to dump the stack trace. Move the existing code to protect against this up to make sure we abort early enough.
1 parent 2c70e36 commit 4c21cb3

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/mono/mono/mini/mini-posix.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,8 @@ dump_native_stacktrace (const char *signal, MonoContext *mctx)
788788
g_assertion_disable_global (assert_printer_callback);
789789
} else {
790790
g_async_safe_printf ("\nAn error has occurred in the native fault reporting. Some diagnostic information will be unavailable.\n");
791-
791+
g_async_safe_printf ("\nExiting early due to double fault.\n");
792+
_exit (-1);
792793
}
793794

794795
#ifdef HAVE_BACKTRACE_SYMBOLS
@@ -847,11 +848,6 @@ dump_native_stacktrace (const char *signal, MonoContext *mctx)
847848
// If we can't fork, do as little as possible before exiting
848849
}
849850

850-
if (double_faulted) {
851-
g_async_safe_printf("\nExiting early due to double fault.\n");
852-
_exit (-1);
853-
}
854-
855851
#endif
856852
#else
857853
#ifdef HOST_ANDROID

0 commit comments

Comments
 (0)