From 149206a5eed02784f04e1c4d8e470f0d8eedc767 Mon Sep 17 00:00:00 2001 From: Alexander Kyte Date: Tue, 30 Oct 2018 14:23:53 -0400 Subject: [PATCH] [crash] Fix merp invocation (#11436) The change which made the handler return (rather than crashing the runtime) did not consider this control flow path that causes the sigterm signal handler to trigger the merp dumper if we return. We now always return. This was previously so that a random sigterm could be used to trigger a dump. This isn't really used, and won't work right now anyways (we don't register it until right before we dump). My fix is to remove it, and to make the signal handler only work as part of the dumper machinery. --- mono/mini/mini-posix.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/mono/mini/mini-posix.c b/mono/mini/mini-posix.c index 91ac6ae67dd..f524188f99b 100644 --- a/mono/mini/mini-posix.c +++ b/mono/mini/mini-posix.c @@ -222,18 +222,11 @@ MONO_SIG_HANDLER_FUNC (static, sigterm_signal_handler) gchar *output = NULL; MonoStackHash hashes; mono_sigctx_to_monoctx (ctx, &mctx); + // Will return when the dumping is done, so this thread can continue + // running. Returns FALSE on unrecoverable error. if (!mono_threads_summarize_execute (&mctx, &output, &hashes, FALSE, NULL, 0)) g_assert_not_reached (); - if (mono_merp_enabled ()) { - pid_t crashed_pid = getpid (); - mono_merp_invoke (crashed_pid, "SIGTERM", output, &hashes); - } else { - // Controlling thread gets the dump - if (output) - MOSTLY_ASYNC_SAFE_PRINTF("Unhandled exception dump: \n######\n%s\n######\n", output); - } - mono_chain_signal (MONO_SIG_HANDLER_PARAMS); } #endif -- 2.11.4.GIT