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