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