From: Ivan Maidanski Date: Thu, 22 Nov 2012 04:39:20 +0000 (+0400) Subject: Prevent POSIX fork if mprotect_thread is started (Darwin) X-Git-Tag: gc7_4_0~139 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=37d8fb73e7210509bdc5f3e69b1ec5f8dcc6bda0;p=gc Prevent POSIX fork if mprotect_thread is started (Darwin) * pthread_support.c (GC_atfork_prepare): Abort if GC_dirty_maintained is set for Darwin (only if MPROTECT_VDB) since graceful suspend/resume of mprotect_thread is unsupported at present. --- diff --git a/pthread_support.c b/pthread_support.c index f270b59e..c65ecfab 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -996,6 +996,12 @@ static void fork_child_proc(void) /* Routines for fork handling by client (no-op if pthread_atfork works). */ GC_API void GC_CALL GC_atfork_prepare(void) { +# if defined(GC_DARWIN_THREADS) && defined(MPROTECT_VDB) + if (GC_dirty_maintained) { + GC_ASSERT(0 == GC_handle_fork); + ABORT("Unable to fork while mprotect_thread is running"); + } +# endif if (GC_handle_fork <= 0) fork_prepare_proc(); }