Fix build with newer glibc

Resolves: rhbz#1983703
This commit is contained in:
Tomas Popela 2021-08-02 10:34:05 +02:00
parent 2203a1ae94
commit ecee0a624d
2 changed files with 65 additions and 0 deletions

View File

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

View File

@ -273,6 +273,7 @@ Patch233: firefox-rhel6-nss-tls1.3.patch
Patch234: rhbz-1821418.patch
Patch235: firefox-pipewire-0-3.patch
Patch236: firefox-nss-addon-hack.patch
Patch237: firefox-glibc-dynstack.patch
# Upstream patches
Patch402: mozilla-1196777.patch
@ -662,6 +663,7 @@ sed -ie 's|/usr/include|/app/include|' %_sourcedir/firefox-pipewire-0-3.patch
%endif
%endif
%patch236 -p1 -b .firefox-nss-addon-hack
%patch237 -p1 -b .firefox-glibc-dynstack
%patch234 -p1 -b .rhbz-1821418
@ -1653,6 +1655,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%changelog
* Fri Jul 30 2021 Tomas Popela <tpopela@redhat.com> - 78.12.0-2
- Add script to process the official tarball to comply with PELC review
- Fix build with newer glibc
* Wed Jul 07 2021 Eike Rathke <erack@redhat.com> - 78.12.0-1
- Update to 78.12.0 build1