[sgen] Initialize stack_start to 0 when a thread is signaled for stw
authorVlad Brezae <brezaevlad@gmail.com>
Tue, 12 Jul 2016 16:30:01 +0000 (19:30 +0300)
committerVlad Brezae <brezaevlad@gmail.com>
Wed, 13 Jul 2016 17:04:51 +0000 (20:04 +0300)
If we have an invalid SP in the suspended thread, we don't set stack_start in the thread info, expecting it to be 0 in order to signal a resume and suspend retry to the suspender thread. If the thread was already restarted before (from a different reason like IP in critical section), it would have a nonzero stack_start from the previous suspend, leading to an assertion in the previously described case.

This is also what we do on mach.

mono/metadata/sgen-os-posix.c

index 5a9bae85b6db35d7c95d81b19ad82a6c2e921a65..1016841f535149e796fa8ea8f8afe89e868d633c 100644 (file)
@@ -46,6 +46,7 @@ suspend_thread (SgenThreadInfo *info, void *context)
        gpointer stack_start;
 
        info->client_info.stopped_domain = mono_domain_get ();
+       info->client_info.stack_start = NULL;
        info->client_info.signal = 0;
        stop_count = sgen_global_stop_count;
        /* duplicate signal */