summaryrefslogtreecommitdiff
path: root/repo/apps/chromium/default-pthread-stacksize.patch
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-05-04 23:52:30 +0100
committerdavidovski <david@davidovski.xyz>2022-05-04 23:52:30 +0100
commit739c65c54cb0e957df5e9b76f93fb02554e5cac3 (patch)
tree09ddfa0a342f3ea9de136cb50abdd79821bf1b53 /repo/apps/chromium/default-pthread-stacksize.patch
parent4c585ad54388285500fd18a6aaa516894e0f2c16 (diff)
moved everything to new file formatting
Diffstat (limited to 'repo/apps/chromium/default-pthread-stacksize.patch')
-rw-r--r--repo/apps/chromium/default-pthread-stacksize.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/repo/apps/chromium/default-pthread-stacksize.patch b/repo/apps/chromium/default-pthread-stacksize.patch
new file mode 100644
index 0000000..74ebc76
--- /dev/null
+++ b/repo/apps/chromium/default-pthread-stacksize.patch
@@ -0,0 +1,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 2mb to avoid running out of space. This is what android uses
++ return 2 * (1 << 20);
+ #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
+@@ -420,7 +420,7 @@
+ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
+ !defined(THREAD_SANITIZER)) || \
+ (BUILDFLAG(IS_ANDROID) && !defined(ADDRESS_SANITIZER))
+- EXPECT_EQ(0u, stack_size);
++ EXPECT_EQ(2u << 20, stack_size);
+ #else
+ EXPECT_GT(stack_size, 0u);
+ EXPECT_LT(stack_size, 20u * (1 << 20));
+--- ./chrome/browser/shutdown_signal_handlers_posix.cc
++++ ./chrome/browser/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);