Kaydet (Commit) 85dc3889 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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
üst 00468b48
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#if defined(OPENBSD) #if defined(OPENBSD)
#include <sched.h> #include <sched.h>
#endif #endif
#include <config_options.h>
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <osl/thread.h> #include <osl/thread.h>
#include <osl/nlsupport.h> #include <osl/nlsupport.h>
...@@ -251,8 +252,9 @@ static oslThread osl_thread_create_Impl ( ...@@ -251,8 +252,9 @@ static oslThread osl_thread_create_Impl (
short nFlags) short nFlags)
{ {
Thread_Impl* pImpl; Thread_Impl* pImpl;
#if defined(OPENBSD) #if defined OPENBSD || (defined MACOSX && !ENABLE_RUNTIME_OPTIMIZATIONS)
pthread_attr_t attr; pthread_attr_t attr;
size_t stacksize;
#endif #endif
int nRet=0; int nRet=0;
...@@ -266,11 +268,16 @@ static oslThread osl_thread_create_Impl ( ...@@ -266,11 +268,16 @@ static oslThread osl_thread_create_Impl (
pthread_mutex_lock (&(pImpl->m_Lock)); pthread_mutex_lock (&(pImpl->m_Lock));
#if defined(OPENBSD) #if defined OPENBSD || (defined MACOSX && !ENABLE_RUNTIME_OPTIMIZATIONS)
if (pthread_attr_init(&attr) != 0) if (pthread_attr_init(&attr) != 0)
return (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); pthread_attr_destroy(&attr);
return (0); return (0);
} }
...@@ -278,7 +285,7 @@ static oslThread osl_thread_create_Impl ( ...@@ -278,7 +285,7 @@ static oslThread osl_thread_create_Impl (
if ((nRet = pthread_create ( if ((nRet = pthread_create (
&(pImpl->m_hThread), &(pImpl->m_hThread),
#if defined(OPENBSD) #if defined OPENBSD || (defined MACOSX && !ENABLE_RUNTIME_OPTIMIZATIONS)
&attr, &attr,
#else #else
PTHREAD_ATTR_DEFAULT, PTHREAD_ATTR_DEFAULT,
...@@ -295,7 +302,7 @@ static oslThread osl_thread_create_Impl ( ...@@ -295,7 +302,7 @@ static oslThread osl_thread_create_Impl (
return (0); return (0);
} }
#if defined(OPENBSD) #if defined OPENBSD || (defined MACOSX && !ENABLE_RUNTIME_OPTIMIZATIONS)
pthread_attr_destroy(&attr); pthread_attr_destroy(&attr);
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment