Blob Blame History Raw
diff -up firefox-78.12.0/js/xpconnect/src/XPCJSContext.cpp.firefox-glibc-dynstack firefox-78.12.0/js/xpconnect/src/XPCJSContext.cpp
--- firefox-78.12.0/js/xpconnect/src/XPCJSContext.cpp.firefox-glibc-dynstack	2021-07-06 21:50:42.000000000 +0200
+++ firefox-78.12.0/js/xpconnect/src/XPCJSContext.cpp	2021-08-02 10:26:47.996760110 +0200
@@ -81,14 +81,6 @@ using namespace xpc;
 using namespace JS;
 using mozilla::dom::AutoEntryScript;
 
-// The watchdog thread loop is pretty trivial, and should not require much stack
-// space to do its job. So only give it 32KiB or the platform minimum.
-#if !defined(PTHREAD_STACK_MIN)
-#  define PTHREAD_STACK_MIN 0
-#endif
-static constexpr size_t kWatchdogStackSize =
-    PTHREAD_STACK_MIN < 32 * 1024 ? 32 * 1024 : PTHREAD_STACK_MIN;
-
 static void WatchdogMain(void* arg);
 class Watchdog;
 class WatchdogManager;
@@ -161,7 +153,7 @@ class Watchdog {
       // watchdog, we need to join it on shutdown.
       mThread = PR_CreateThread(PR_USER_THREAD, WatchdogMain, this,
                                 PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
-                                PR_JOINABLE_THREAD, kWatchdogStackSize);
+                                PR_JOINABLE_THREAD, 0);
       if (!mThread) {
         MOZ_CRASH("PR_CreateThread failed!");
       }
diff -up firefox-78.12.0/security/sandbox/linux/launch/SandboxLaunch.cpp.firefox-glibc-dynstack firefox-78.12.0/security/sandbox/linux/launch/SandboxLaunch.cpp
--- firefox-78.12.0/security/sandbox/linux/launch/SandboxLaunch.cpp.firefox-glibc-dynstack	2021-07-06 21:50:46.000000000 +0200
+++ firefox-78.12.0/security/sandbox/linux/launch/SandboxLaunch.cpp	2021-08-02 10:28:48.832946590 +0200
@@ -489,7 +489,8 @@ static int CloneCallee(void* aPtr) {
 // we don't currently support sandboxing under valgrind.
 MOZ_NEVER_INLINE MOZ_ASAN_BLACKLIST static pid_t DoClone(int aFlags,
                                                          jmp_buf* aCtx) {
-  uint8_t miniStack[PTHREAD_STACK_MIN];
+  static constexpr size_t kStackAlignment = 16;
+  uint8_t miniStack[4096] __attribute__((aligned(kStackAlignment)));
 #ifdef __hppa__
   void* stackPtr = miniStack;
 #else
@@ -510,13 +511,19 @@ static pid_t ForkWithFlags(int aFlags) {
                                CLONE_CHILD_CLEARTID;
   MOZ_RELEASE_ASSERT((aFlags & kBadFlags) == 0);
 
+  // Block signals due to small stack in DoClone.
+  sigset_t oldSigs;
+  BlockAllSignals(&oldSigs);
+
+  int ret = 0;
   jmp_buf ctx;
   if (setjmp(ctx) == 0) {
     // In the parent and just called setjmp:
-    return DoClone(aFlags | SIGCHLD, &ctx);
+    ret = DoClone(aFlags | SIGCHLD, &ctx);
   }
+  RestoreSignals(&oldSigs);
   // In the child and have longjmp'ed:
-  return 0;
+  return ret;
 }
 
 static bool WriteStringToFile(const char* aPath, const char* aStr,