diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-05-21 09:02:43 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-05-21 09:06:32 +0200 |
commit | 85dc388993beca806b5a7ec91c9c49172b3a781b (patch) | |
tree | bb83ad4ab6f23475c3302624252083638a2aea26 /sal | |
parent | 00468b48e8678d819a8e34be8c1e256ce36c1396 (diff) |
Default OS X thread stack size too small for -fsanitize=address
...witnessed stack overflow in huge function
FunctionMapFactory::createFunctionMap__library_effects__allChildren in
workdir/UnpackedTarball/opencollada/COLLADASaxFrameworkLoader/src/generated14/
COLLADASaxFWLColladaParserAutoGen14PrivateFunctionMapFactory.cpp
Change-Id: I9451912043e282c8e06aff446cf3d1190f1de9cf
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/thread.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.c index 0140936999e0..5335dd6bf3b8 100644 --- a/sal/osl/unx/thread.c +++ b/sal/osl/unx/thread.c @@ -22,6 +22,7 @@ #if defined(OPENBSD) #include <sched.h> #endif +#include <config_options.h> #include <osl/diagnose.h> #include <osl/thread.h> #include <osl/nlsupport.h> @@ -251,8 +252,9 @@ static oslThread osl_thread_create_Impl ( short nFlags) { Thread_Impl* pImpl; -#if defined(OPENBSD) +#if defined OPENBSD || (defined MACOSX && !ENABLE_RUNTIME_OPTIMIZATIONS) pthread_attr_t attr; + size_t stacksize; #endif int nRet=0; @@ -266,11 +268,16 @@ static oslThread osl_thread_create_Impl ( pthread_mutex_lock (&(pImpl->m_Lock)); -#if defined(OPENBSD) +#if defined OPENBSD || (defined MACOSX && !ENABLE_RUNTIME_OPTIMIZATIONS) if (pthread_attr_init(&attr) != 0) return (0); - if (pthread_attr_setstacksize(&attr, 262144) != 0) { +#if defined OPENBSD + stacksize = 262144; +#else + stacksize = 100 * PTHREAD_STACK_MIN; +#endif + if (pthread_attr_setstacksize(&attr, stacksize) != 0) { pthread_attr_destroy(&attr); return (0); } @@ -278,7 +285,7 @@ static oslThread osl_thread_create_Impl ( if ((nRet = pthread_create ( &(pImpl->m_hThread), -#if defined(OPENBSD) +#if defined OPENBSD || (defined MACOSX && !ENABLE_RUNTIME_OPTIMIZATIONS) &attr, #else PTHREAD_ATTR_DEFAULT, @@ -295,7 +302,7 @@ static oslThread osl_thread_create_Impl ( return (0); } -#if defined(OPENBSD) +#if defined OPENBSD || (defined MACOSX && !ENABLE_RUNTIME_OPTIMIZATIONS) pthread_attr_destroy(&attr); #endif |