aboutsummaryrefslogtreecommitdiffstats
path: root/community/chromium/default-pthread-stacksize.patch
blob: 5cffaa223ce2ea1776b670fed1afaa4adb16c20f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
--- base/threading/platform_thread_linux.cc
+++ base/threading/platform_thread_linux.cc
@@ -186,7 +186,8 @@
 
 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
 #if !defined(THREAD_SANITIZER)
-  return 0;
+  // use 8mb like glibc to avoid running out of space
+  return (1 << 23);
 #else
   // ThreadSanitizer bloats the stack heavily. Evidence has been that the
   // default stack size isn't enough for some browser tests.
--- ./base/threading/platform_thread_unittest.cc.orig
+++ ./base/threading/platform_thread_unittest.cc
@@ -411,7 +411,7 @@
     ((defined(OS_LINUX) || defined(OS_CHROMEOS)) &&              \
      !defined(THREAD_SANITIZER)) ||                              \
     (defined(OS_ANDROID) && !defined(ADDRESS_SANITIZER))
-  EXPECT_EQ(0u, stack_size);
+  EXPECT_EQ(1u << 23, stack_size);
 #else
   EXPECT_GT(stack_size, 0u);
   EXPECT_LT(stack_size, 20u * (1 << 20));
--- chrome/app/shutdown_signal_handlers_posix.cc
+++ chrome/app/shutdown_signal_handlers_posix.cc
@@ -187,11 +187,19 @@
   g_shutdown_pipe_read_fd = pipefd[0];
   g_shutdown_pipe_write_fd = pipefd[1];
 #if !defined(ADDRESS_SANITIZER)
+# if defined(__GLIBC__)
   const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
+# else
+  const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 * 8; // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
+# endif
 #else
+# if defined(__GLIBC__)
   // ASan instrumentation bloats the stack frames, so we need to increase the
   // stack size to avoid hitting the guard page.
   const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
+# else
+  const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 * 8; // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
+# endif
 #endif
   ShutdownDetector* detector = new ShutdownDetector(
       g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);