Fix for dynstack: PTHREAD_STACK_MIN < 32 * 1024 ? 32 * 1024 : PTHREAD_STACK_MIN;

This commit is contained in:
Jan Horak 2021-08-23 17:27:35 +02:00
parent be7a69c6ca
commit e7989bff2d
2 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,64 @@
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~

View File

@ -119,6 +119,7 @@ Patch417: build-aarch64-user_vfp.patch
Patch418: mozilla-1512162.patch Patch418: mozilla-1512162.patch
Patch419: bindgen-d0dfc52706f23db9dc9d74642eeebd89d73cb8d0.patch Patch419: bindgen-d0dfc52706f23db9dc9d74642eeebd89d73cb8d0.patch
Patch103: rhbz-1219542-s390-build.patch Patch103: rhbz-1219542-s390-build.patch
Patch104: firefox-glibc-dynstack.patch
# PPC fix # PPC fix
Patch304: mozilla-1245783.patch Patch304: mozilla-1245783.patch
@ -261,6 +262,7 @@ debug %{name}, you want to install %{name}-debuginfo instead.
%ifarch s390 %ifarch s390
%patch103 -p1 -b .rhbz-1219542-s390-build %patch103 -p1 -b .rhbz-1219542-s390-build
%endif %endif
%patch104 -p1 -b .dynstack
%if 0%{?fedora} >= 35 %if 0%{?fedora} >= 35
# since python3.10 we need to use `from collections.abc` instead of `from collections`. # since python3.10 we need to use `from collections.abc` instead of `from collections`.