[exception] do not wrap SIGILL into a managed exception
authorBernhard Urban <bernhard.urban@xamarin.com>
Mon, 12 Dec 2016 14:25:59 +0000 (15:25 +0100)
committerBernhard Urban <bernhard.urban@xamarin.com>
Wed, 14 Dec 2016 11:43:51 +0000 (12:43 +0100)
there is not much point in trying to recover from it and even worse,
wrapping it into a managed exception might hide it if the application is
sloppy with exception handling (cf. Pokémon Exception Handling).

mono/mini/mini-runtime.c

index 0ac217fe0a1024118b17ec539c097f507f2e299d..1c9868b482a7d5d9762bf4738868e9fd9d5f5aaa 100644 (file)
@@ -2862,19 +2862,20 @@ MONO_SIG_HANDLER_FUNC (, mono_sigfpe_signal_handler)
 
 MONO_SIG_HANDLER_FUNC (, mono_sigill_signal_handler)
 {
-       MonoException *exc;
+       MONO_SIG_HANDLER_INFO_TYPE *info = MONO_SIG_HANDLER_GET_INFO ();
        MONO_SIG_HANDLER_GET_CONTEXT;
 
        if (mono_runtime_get_no_exec ())
                exit (1);
 
-       MONO_ENTER_GC_UNSAFE_UNBALANCED;
 
-       exc = mono_get_exception_execution_engine ("SIGILL");
-
-       mono_arch_handle_exception (ctx, exc);
+       mono_handle_native_crash ("SIGILL", ctx, info);
+       if (mono_do_crash_chaining) {
+               mono_chain_signal (MONO_SIG_HANDLER_PARAMS);
+               return;
+       }
 
-       MONO_EXIT_GC_UNSAFE_UNBALANCED;
+       g_assert_not_reached ();
 }
 
 #if defined(MONO_ARCH_USE_SIGACTION) || defined(HOST_WIN32)