firefox/firefox-glibc-dynstack.patch

65 lines
2.7 KiB
Diff
Raw Normal View History

2021-07-21 10:16:23 +00:00
diff -ur firefox-90.0.orig/js/xpconnect/src/XPCJSContext.cpp firefox-90.0/js/xpconnect/src/XPCJSContext.cpp
--- firefox-90.0.orig/js/xpconnect/src/XPCJSContext.cpp 2021-07-05 21:16:02.000000000 +0200
+++ firefox-90.0/js/xpconnect/src/XPCJSContext.cpp 2021-07-19 15:01:24.083460460 +0200
@@ -85,14 +85,6 @@
using namespace xpc;
using namespace JS;
-// 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;
@@ -163,7 +155,7 @@
// 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!");
}
Only in firefox-90.0/js/xpconnect/src: XPCJSContext.cpp.firefox-glibc-dynstack
diff -ur firefox-90.0.orig/security/sandbox/linux/launch/SandboxLaunch.cpp firefox-90.0/security/sandbox/linux/launch/SandboxLaunch.cpp
--- firefox-90.0.orig/security/sandbox/linux/launch/SandboxLaunch.cpp 2021-07-05 18:20:36.000000000 +0200
+++ firefox-90.0/security/sandbox/linux/launch/SandboxLaunch.cpp 2021-07-20 08:39:17.272136982 +0200
@@ -501,8 +501,7 @@
MOZ_NEVER_INLINE MOZ_ASAN_BLACKLIST static pid_t DoClone(int aFlags,
jmp_buf* aCtx) {
static constexpr size_t kStackAlignment = 16;
- uint8_t miniStack[PTHREAD_STACK_MIN]
- __attribute__((aligned(kStackAlignment)));
+ uint8_t miniStack[4096] __attribute__((aligned(kStackAlignment)));
#ifdef __hppa__
void* stackPtr = miniStack;
#else
@@ -523,13 +522,19 @@
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,
Only in firefox-90.0/security/sandbox/linux/launch: SandboxLaunch.cpp~