1From 194688cb3ddc3d331b3d254b41cb6ae55d55f0f8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 7 Jul 2017 16:41:23 -0700
4Subject: [PATCH] chromium: musl: Adjust default pthread stack size
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7Upstream-Status: Pending
8---
9 chromium/base/threading/platform_thread_linux.cc              | 3 ++-
10 .../third_party/blink/renderer/platform/wtf/stack_util.cc     | 4 ++--
11 2 files changed, 4 insertions(+), 3 deletions(-)
12
13diff --git a/chromium/base/threading/platform_thread_linux.cc b/chromium/base/threading/platform_thread_linux.cc
14index c1a705e2b89..f322fdb8352 100644
15--- a/chromium/base/threading/platform_thread_linux.cc
16+++ b/chromium/base/threading/platform_thread_linux.cc
17@@ -377,7 +377,8 @@ void TerminateOnThread() {}
18
19 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
20 #if !defined(THREAD_SANITIZER)
21-  return 0;
22+  // use 8mb like glibc to avoid running out of space
23+  return (1 << 23);
24 #else
25   // ThreadSanitizer bloats the stack heavily. Evidence has been that the
26   // default stack size isn't enough for some browser tests.
27diff --git a/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc b/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc
28index 71b901f4044..f33aba04bc3 100644
29--- a/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc
30+++ b/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc
31@@ -29,7 +29,7 @@ size_t GetUnderestimatedStackSize() {
32 // FIXME: On Mac OSX and Linux, this method cannot estimate stack size
33 // correctly for the main thread.
34
35-#elif defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
36+#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
37     defined(OS_FUCHSIA)
38   // pthread_getattr_np() can fail if the thread is not invoked by
39   // pthread_create() (e.g., the main thread of blink_unittests).
40@@ -97,7 +97,7 @@ return Threading::ThreadStackSize();
41 }
42
43 void* GetStackStart() {
44-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
45+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
46     defined(OS_FUCHSIA)
47   pthread_attr_t attr;
48   int error;
49