summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-09-10 22:07:23 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-09-11 08:32:52 +0200
commitf49abb2ab3349d4c9956142e835b7f8bb5734692 (patch)
treec951296414afdc956ffb10c9ccc4b4f843342de7 /sal
parentdac678d44ed64da97a6874380bdba5a6f4b4eb9b (diff)
sal: create threads on Linux with a larger stack for ASAN
The default on Fedora 20 is 8MB, which causes stack overflows from CPython code in some of the JunitTests when built with clang 3.4 -fsanitize=address. Change-Id: I3de9975564aad668e746cea74ae10931ef36a608 Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/thread.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.c
index 17b4d6cf7946..1c703ca1cf42 100644
--- a/sal/osl/unx/thread.c
+++ b/sal/osl/unx/thread.c
@@ -252,7 +252,7 @@ static oslThread osl_thread_create_Impl (
short nFlags)
{
Thread_Impl* pImpl;
-#if defined OPENBSD || (defined MACOSX && !ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || ((defined MACOSX || defined LINUX) && !ENABLE_RUNTIME_OPTIMIZATIONS)
pthread_attr_t attr;
size_t stacksize;
#endif
@@ -268,12 +268,14 @@ static oslThread osl_thread_create_Impl (
pthread_mutex_lock (&(pImpl->m_Lock));
-#if defined OPENBSD || (defined MACOSX && !ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || ((defined MACOSX || defined LINUX) && !ENABLE_RUNTIME_OPTIMIZATIONS)
if (pthread_attr_init(&attr) != 0)
return (0);
#if defined OPENBSD
stacksize = 262144;
+#elif defined LINUX
+ stacksize = 12 * 1024 * 1024; // 8MB is not enough for ASAN on x86-64
#else
stacksize = 100 * PTHREAD_STACK_MIN;
#endif
@@ -285,7 +287,7 @@ static oslThread osl_thread_create_Impl (
if ((nRet = pthread_create (
&(pImpl->m_hThread),
-#if defined OPENBSD || (defined MACOSX && !ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || ((defined MACOSX || defined LINUX) && !ENABLE_RUNTIME_OPTIMIZATIONS)
&attr,
#else
PTHREAD_ATTR_DEFAULT,
@@ -302,7 +304,7 @@ static oslThread osl_thread_create_Impl (
return (0);
}
-#if defined OPENBSD || (defined MACOSX && !ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || ((defined MACOSX || defined LINUX) && !ENABLE_RUNTIME_OPTIMIZATIONS)
pthread_attr_destroy(&attr);
#endif