From: Ivan Maidanski Date: Fri, 20 Jul 2012 11:27:54 +0000 (+0400) Subject: Test SP obtained from OpenBSD-specific pthread context in GC_suspend_all X-Git-Tag: gc7_4_0~251 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f8d4f156d219cbddc7c7bfe7f9c2b6f5967bbab1;p=gc Test SP obtained from OpenBSD-specific pthread context in GC_suspend_all * pthread_stop_world.c (GC_suspend_all): Abort if stop_info.stack_ptr obtained from OpenBSD-specific pthread context is NULL; add FIXME for GC_OPENBSD_THREADS case (the implementation should probably use pthread_sp_np). --- diff --git a/pthread_stop_world.c b/pthread_stop_world.c index 72218352..52573dbd 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -477,13 +477,15 @@ STATIC int GC_suspend_all(void) # ifdef GC_OPENBSD_THREADS if (pthread_suspend_np(p -> id) != 0) ABORT("pthread_suspend_np failed"); - /* This will only work for userland pthreads. It will */ - /* fail badly on rthreads. Perhaps we should consider */ - /* a pthread_sp_np() function that returns the stack */ + /* FIXME: This will only work for userland pthreads. */ + /* It will fail badly on rthreads. Perhaps we should */ + /* consider pthread_sp_np() that returns the stack */ /* pointer for a suspended thread and implement in both */ /* pthreads and rthreads. */ p -> stop_info.stack_ptr = *(ptr_t *)((char *)p -> id + UTHREAD_SP_OFFSET); + if (p -> stop_info.stack_ptr == NULL) + ABORT("NULL pointer at pthread_context UTHREAD_SP_OFFSET"); # else # ifndef PLATFORM_ANDROID result = pthread_kill(p -> id, GC_sig_suspend);