2
0
mirror of https://codeberg.org/kiss-community/repo synced 2024-08-22 22:16:19 +00:00
repo/testing/chromium/patches/musl-stacksize-r3.patch
2019-07-28 18:49:11 +03:00

47 lines
2.0 KiB
Diff

diff --git chromium-75.0.3770.100/base/threading/platform_thread_linux.cc chromium-75.0.3770.100/base/threading/platform_thread_linux.cc
index 095c49b..b81b050 100644
--- chromium-75.0.3770.100/base/threading/platform_thread_linux.cc
+++ chromium-75.0.3770.100/base/threading/platform_thread_linux.cc
@@ -185,12 +185,14 @@ void InitThreading() {}
void TerminateOnThread() {}
size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
-#if !defined(THREAD_SANITIZER)
- return 0;
-#else
+#if defined(THREAD_SANITIZER)
// ThreadSanitizer bloats the stack heavily. Evidence has been that the
// default stack size isn't enough for some browser tests.
return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux).
+#elif defined(__GLIBC__)
+ return 0;
+#else
+ return 1 * (1 << 23); // 8192K (the default stack size on glibc)
#endif
}
diff --git chromium-75.0.3770.100/chrome/app/shutdown_signal_handlers_posix.cc chromium-75.0.3770.100/chrome/app/shutdown_signal_handlers_posix.cc
index 621d441..132e0f2 100644
--- chromium-75.0.3770.100/chrome/app/shutdown_signal_handlers_posix.cc
+++ chromium-75.0.3770.100/chrome/app/shutdown_signal_handlers_posix.cc
@@ -186,12 +186,19 @@ void InstallShutdownSignalHandlers(
g_pipe_pid = getpid();
g_shutdown_pipe_read_fd = pipefd[0];
g_shutdown_pipe_write_fd = pipefd[1];
+#ifdef __GLIBC__
#if !defined(ADDRESS_SANITIZER)
const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
#else
// 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;
+#endif
+#else
+ // PTHREAD_STACK_MIN is much smaller on musl. ConstructTlsVector uses
+ // 6616 bytes of stack by itself. This matches the value of the GLIBC
+ // minumum * 2.
+ const size_t kShutdownDetectorThreadStackSize = 32768;
#endif
ShutdownDetector* detector = new ShutdownDetector(
g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);