diff options
author | dbuckley3d <44624196+dbuckley3d@users.noreply.github.com> | 2019-02-19 20:54:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-19 20:54:24 +0300 |
commit | 7046e7032c3252c55c9c8b76d9fad22cf62e5837 (patch) | |
tree | 673fcb84cf7c366896574e731555dbd01a0367ef | |
parent | b658586ef8b1a39eab642e6642876befdac0eb96 (diff) | |
parent | c24b653df547643928e5e6d9d4502ca5897d9979 (diff) |
Merge pull request #29 from Unity-Technologies/revert-26-handle-suspend-on-altstack
Revert "use SP saved in context, avoids problems when on alternate signal stack"
-rw-r--r-- | pthread_stop_world.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/pthread_stop_world.c b/pthread_stop_world.c index 6b991a4d..3349b2e5 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -262,7 +262,7 @@ STATIC void GC_suspend_handler_inner(ptr_t dummy, void *context); # define GC_lookup_thread_async GC_lookup_thread #endif -GC_INLINE void GC_store_stack_ptr(GC_thread me, void * context GC_ATTR_UNUSED) +GC_INLINE void GC_store_stack_ptr(GC_thread me) { /* There is no data race between the suspend handler (storing */ /* stack_ptr) and GC_push_all_stacks (fetching stack_ptr) because */ @@ -277,20 +277,8 @@ GC_INLINE void GC_store_stack_ptr(GC_thread me, void * context GC_ATTR_UNUSED) # else # ifdef IA64 me -> backing_store_ptr = GC_save_regs_in_stack(); - /* For known architectures we support, use SP stored in context. */ - /* This prevents disaster if we are running an alternate stack. */ -# elif defined(LINUX) && (defined(X86_64) || defined(I386)) - ucontext_t* uc = (ucontext_t*)context; - AO_store((volatile AO_t *)&me->stop_info.stack_ptr, -# ifdef X86_64 - (AO_t)uc->uc_mcontext.gregs[REG_RSP] -# else - (AO_t)uc->uc_mcontext.gregs[REG_ESP] -# endif - ); -# else - AO_store((volatile AO_t *)&me->stop_info.stack_ptr, (AO_t)GC_approx_sp()); # endif + AO_store((volatile AO_t *)&me->stop_info.stack_ptr, (AO_t)GC_approx_sp()); # endif } @@ -322,7 +310,7 @@ STATIC void GC_suspend_handler_inner(ptr_t dummy GC_ATTR_UNUSED, # ifdef GC_ENABLE_SUSPEND_THREAD if (AO_load(&me->suspended_ext)) { - GC_store_stack_ptr(me, context); + GC_store_stack_ptr(me); sem_post(&GC_suspend_ack_sem); suspend_self_inner(me); # ifdef DEBUG_THREADS @@ -342,7 +330,7 @@ STATIC void GC_suspend_handler_inner(ptr_t dummy GC_ATTR_UNUSED, RESTORE_CANCEL(cancel_state); return; } - GC_store_stack_ptr(me, context); + GC_store_stack_ptr(me); # ifdef THREAD_SANITIZER /* TSan disables signals around signal handlers. Without */ |