[packages/firefox] fix build with glibc 2.34; rel 2

atler atler at pld-linux.org
Wed Aug 18 21:53:35 CEST 2021


commit c71d7e8625ee3ed73b006fe59bc759970079e5f5
Author: Jan Palus <atler at pld-linux.org>
Date:   Wed Aug 18 21:52:48 2021 +0200

    fix build with glibc 2.34; rel 2
    
    see https://bugzilla.mozilla.org/show_bug.cgi?id=1721326

 firefox.spec    |   4 +-
 glibc2.34.patch | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 143 insertions(+), 1 deletion(-)
---
diff --git a/firefox.spec b/firefox.spec
index c567e00..a2b482f 100644
--- a/firefox.spec
+++ b/firefox.spec
@@ -49,7 +49,7 @@ Summary(hu.UTF-8):	Firefox web böngésző
 Summary(pl.UTF-8):	Firefox - przeglądarka WWW
 Name:		firefox
 Version:	91.0.1
-Release:	1
+Release:	2
 License:	MPL v2.0
 Group:		X11/Applications/Networking
 Source0:	https://releases.mozilla.org/pub/firefox/releases/%{version}/source/firefox-%{version}.source.tar.xz
@@ -250,6 +250,7 @@ Source194:	https://releases.mozilla.org/pub/firefox/releases/%{version}/linux-i6
 # Source194-md5:	d2a2d12f650d6b7186b31112e5e8db07
 Source195:	https://releases.mozilla.org/pub/firefox/releases/%{version}/linux-i686/xpi/zh-TW.xpi
 # Source195-md5:	854e566bf0239dcd14a75a309379f715
+Patch0:		glibc2.34.patch
 Patch4:		%{name}-prefs.patch
 Patch5:		%{name}-pld-bookmarks.patch
 Patch6:		%{name}-no-subshell.patch
@@ -2072,6 +2073,7 @@ unpack() {
 %define __unzip unpack
 %setup -q %(seq -f '-a %g' 100 195 | xargs)
 
+%patch0 -p1
 %patch4 -p1
 %patch5 -p1
 %patch6 -p2
diff --git a/glibc2.34.patch b/glibc2.34.patch
new file mode 100644
index 0000000..516bf77
--- /dev/null
+++ b/glibc2.34.patch
@@ -0,0 +1,140 @@
+
+# HG changeset patch
+# User Gian-Carlo Pascutto <gcp at mozilla.com>
+# Date 1628058287 0
+# Node ID 7f9b9624c400dc847dc0053ebe35fbe63353a3d2
+# Parent  958aef401f3c27231c426fc6e00024b0741470a6
+Bug 1721326 - Allow dynamic PTHREAD_STACK_MIN. r=glandium, a=RyanVM
+
+https://phabricator.services.mozilla.com/D120708
+
+Differential Revision: https://phabricator.services.mozilla.com/D120972
+
+diff --git a/js/xpconnect/src/XPCJSContext.cpp b/js/xpconnect/src/XPCJSContext.cpp
+--- a/js/xpconnect/src/XPCJSContext.cpp
++++ b/js/xpconnect/src/XPCJSContext.cpp
+@@ -81,23 +81,20 @@
+ #  include <algorithm>
+ #  include <windows.h>
+ #endif
+ 
+ using namespace mozilla;
+ 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.
++// We will clamp to reasonable values if this isn't set.
+ #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;
+ class MOZ_RAII AutoLockWatchdog final {
+   Watchdog* const mWatchdog;
+ 
+  public:
+@@ -154,22 +151,29 @@ class Watchdog {
+       // extra pages if we can avoid it.
+       nsCOMPtr<nsIDebug2> dbg = do_GetService("@mozilla.org/xpcom/debug;1");
+       Unused << dbg;
+     }
+ 
+     {
+       AutoLockWatchdog lock(this);
+ 
++      // 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. On modern Linux libc this might resolve to
++      // a runtime call.
++      size_t watchdogStackSize = PTHREAD_STACK_MIN;
++      watchdogStackSize = std::max<size_t>(32 * 1024, watchdogStackSize);
++
+       // Gecko uses thread private for accounting and has to clean up at thread
+       // exit. Therefore, even though we don't have a return value from the
+       // 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, watchdogStackSize);
+       if (!mThread) {
+         MOZ_CRASH("PR_CreateThread failed!");
+       }
+ 
+       // WatchdogMain acquires the lock and then asserts mInitialized. So
+       // make sure to set mInitialized before releasing the lock here so
+       // that it's atomic with the creation of the thread.
+       mInitialized = true;
+
+
+# HG changeset patch
+# User stransky <stransky at redhat.com>
+# Date 1628058287 0
+# Node ID 600365d8b24068e8105773830270cf86478aa487
+# Parent  7f9b9624c400dc847dc0053ebe35fbe63353a3d2
+Bug 1721326 - Use small stack for DoClone(). r=jld, a=RyanVM
+
+Patch author is Florian Weimer <fweimer 'at' redhat.com>
+
+Differential Revision: https://phabricator.services.mozilla.com/D120709
+
+diff --git a/security/sandbox/linux/launch/SandboxLaunch.cpp b/security/sandbox/linux/launch/SandboxLaunch.cpp
+--- a/security/sandbox/linux/launch/SandboxLaunch.cpp
++++ b/security/sandbox/linux/launch/SandboxLaunch.cpp
+@@ -504,18 +504,17 @@ static int CloneCallee(void* aPtr) {
+ // stack, not switch stacks.
+ //
+ // Valgrind would disapprove of using clone() without CLONE_VM;
+ // Chromium uses the raw syscall as a workaround in that case, but
+ // we don't currently support sandboxing under valgrind.
+ 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
+   void* stackPtr = ArrayEnd(miniStack);
+ #endif
+   return clone(CloneCallee, stackPtr, aFlags, aCtx);
+ }
+ 
+@@ -526,23 +525,29 @@ MOZ_NEVER_INLINE MOZ_ASAN_BLACKLIST stat
+ static pid_t ForkWithFlags(int aFlags) {
+   // Don't allow flags that would share the address space, or
+   // require clone() arguments we're not passing:
+   static const int kBadFlags = CLONE_VM | CLONE_VFORK | CLONE_SETTLS |
+                                CLONE_PARENT_SETTID | CLONE_CHILD_SETTID |
+                                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,
+                               const size_t aLen) {
+   int fd = open(aPath, O_WRONLY);
+   if (fd < 0) {
+     return false;
+   }
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/firefox.git/commitdiff/c71d7e8625ee3ed73b006fe59bc759970079e5f5



More information about the pld-cvs-commit mailing list