]> git.armaanb.net Git - asd-repo.git/blob - extra/chromium/patches/musl-default-pthread-stacksize.patch
Switch browser to Chromium
[asd-repo.git] / extra / chromium / patches / musl-default-pthread-stacksize.patch
1 diff --git a/base/threading/platform_thread_linux.cc b/base/threading/platform_thread_linux.cc
2 index de2e0c1..53cb90d 100644
3 --- a/base/threading/platform_thread_linux.cc
4 +++ b/base/threading/platform_thread_linux.cc
5 @@ -437,7 +437,8 @@ void TerminateOnThread() {}
6  
7  size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
8  #if !defined(THREAD_SANITIZER)
9 -  return 0;
10 +  // use 8mb like glibc to avoid running out of space
11 +  return (1 << 23);
12  #else
13    // ThreadSanitizer bloats the stack heavily. Evidence has been that the
14    // default stack size isn't enough for some browser tests.
15 diff --git a/chrome/app/shutdown_signal_handlers_posix.cc b/chrome/app/shutdown_signal_handlers_posix.cc
16 index 621d441..472a3a8 100644
17 --- a/chrome/app/shutdown_signal_handlers_posix.cc
18 +++ b/chrome/app/shutdown_signal_handlers_posix.cc
19 @@ -187,11 +187,19 @@ void InstallShutdownSignalHandlers(
20    g_shutdown_pipe_read_fd = pipefd[0];
21    g_shutdown_pipe_write_fd = pipefd[1];
22  #if !defined(ADDRESS_SANITIZER)
23 +# if defined(__GLIBC__)
24    const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
25 +# else
26 +  const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 * 8; // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
27 +# endif
28  #else
29 +# if defined(__GLIBC__)
30    // ASan instrumentation bloats the stack frames, so we need to increase the
31    // stack size to avoid hitting the guard page.
32    const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
33 +# else
34 +  const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 * 8; // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
35 +# endif
36  #endif
37    ShutdownDetector* detector = new ShutdownDetector(
38        g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);