[threading] Don't suspend a thread running out of its thread bounds.
authorRodrigo Kumpera <kumpera@gmail.com>
Mon, 2 Feb 2015 16:04:37 +0000 (11:04 -0500)
committerRodrigo Kumpera <kumpera@gmail.com>
Mon, 23 Feb 2015 22:41:28 +0000 (17:41 -0500)
mono/utils/mono-threads.c

index 1b6cee39bba32898440ff7af802d0f774be0cce2..db060efe0e93f4da4d7edcbcb9367f8be1993ffc 100644 (file)
@@ -617,6 +617,7 @@ is_thread_in_critical_region (MonoThreadInfo *info)
 {
        MonoMethod *method;
        MonoJitInfo *ji;
+       gpointer stack_start;
 
        /* Are we inside a system critical region? */
        if (info->inside_critical_region)
@@ -631,6 +632,11 @@ is_thread_in_critical_region (MonoThreadInfo *info)
        if (!info->suspend_state.unwind_data [MONO_UNWIND_DATA_DOMAIN])
                return FALSE;
 
+       stack_start = MONO_CONTEXT_GET_SP (&info->suspend_state.ctx);
+       /* altstack signal handler, sgen can't handle them, so we treat them as critical */
+       if (stack_start < info->stack_start_limit || stack_start >= info->stack_end)
+               return TRUE;
+
        ji = mono_jit_info_table_find (
                info->suspend_state.unwind_data [MONO_UNWIND_DATA_DOMAIN],
                MONO_CONTEXT_GET_IP (&info->suspend_state.ctx));