New commits:
commit 73cc69683454fd6233a6ee1f8949d0a8c11af66e
Author: Pavel Vinogradov <public AT sourcemage.org>
Commit: Pavel Vinogradov <public AT sourcemage.org>
http/firefox: version 137.0.2
diff --git a/http/firefox/DETAILS b/http/firefox/DETAILS
index d499c32..2924bc4 100755
--- a/http/firefox/DETAILS
+++ b/http/firefox/DETAILS
@@ -1,5 +1,5 @@
SPELL=firefox
- VERSION=137.0
+ VERSION=137.0.2
SECURITY_PATCH=207
SOURCE="${SPELL}-${VERSION}.source.tar.xz"
# Watch: http://releases.mozilla.org/pub/firefox/releases/
/releases/([0-9.]+)/
diff --git a/http/firefox/HISTORY b/http/firefox/HISTORY
index e3ccffe..c13fdc5 100644
--- a/http/firefox/HISTORY
+++ b/http/firefox/HISTORY
@@ -1,3 +1,7 @@
+2025-04-14 Pavel Vinogradov <public AT sourcemage.org>
+ * DETAILS: version 137.0.2
+ * patches/*: updated
+
2025-04-01 Pavel Vinogradov <public AT sourcemage.org>
* DETAILS: version 137.0, SECURITY_PATCH++
* DEPENDS: nss >= 3.109
diff --git
a/http/firefox/patches/0022-bmo-1790526-check-for-propagated-BrowsingContext-in-SessionStoreParent.patch
b/http/firefox/patches/0024-bmo-1951697-add-missing-include-for-MOZ_RUNINIT.patch
new file mode 100644
index 0000000..4798be6
--- /dev/null
+++
b/http/firefox/patches/0024-bmo-1951697-add-missing-include-for-MOZ_RUNINIT.patch
@@ -0,0 +1,33 @@
+
+# HG changeset patch
+# User Sandi Vujaković <sandyvujakovicj AT outlook.com>
+# Date 1741336534 0
+# Node ID 6354ee4fbdc377561652a66da1b18d0c81294544
+# Parent 5134f15c4d3585d3c0f969eca0c086d4cd04f274
+Bug 1951697 - Add missing include for MOZ_RUNINIT r=gerard-majax
+
+Differential Revision: https://phabricator.services.mozilla.com/D240500
+
+diff --git a/build/unix/profiling/profiling.cpp
b/build/unix/profiling/profiling.cpp
+--- a/build/unix/profiling/profiling.cpp
++++ b/build/unix/profiling/profiling.cpp
+@@ -5,16 +5,18 @@
+ #if defined(MOZ_PROFILE_GENERATE) && defined(XP_LINUX) && !defined(ANDROID)
+
+ # include <pthread.h>
+ # include <stdio.h>
+ # include <stdlib.h>
+ # include <unistd.h>
+ # include <errno.h>
+
++# include "mozilla/Attributes.h"
++
+ # if defined(__cplusplus)
+ extern "C" {
+ # endif
+ void __llvm_profile_initialize(void);
+ void __llvm_profile_initialize_file(void);
+ void __llvm_profile_set_filename(const char*);
+
+ // Use the API to force a different filename, then set back the original
one.
+
diff --git
a/http/firefox/patches/0025-bmo-1790526-check-for-propagated-BrowsingContext-in-SessionStoreParent.patch
b/http/firefox/patches/0025-bmo-1790526-check-for-propagated-BrowsingContext-in-SessionStoreParent.patch
new file mode 100644
index 0000000..54a4c2b
--- /dev/null
+++
b/http/firefox/patches/0025-bmo-1790526-check-for-propagated-BrowsingContext-in-SessionStoreParent.patch
@@ -0,0 +1,82 @@
+
+# HG changeset patch
+# User Eden Chuang <echuang AT mozilla.com>
+# Date 1744130274 0
+# Node ID 4159736c2897215a6d22fc33272e05e370d50f5c
+# Parent 11dc373cc55d14b1ca924ae63703cab228e8b1e1
+Bug 1790526 - Handle the discarded BrowsingContext that propagated to
SessionStoreParent. r=smaug
+
+According to the Pernosco trace, https://static.pernos.co/server/7c640bc4ed587e824fab0ca8aa44f41d1b5595b5/rebuilding.html?redirect=https%3A%2F%2Fpernos.co%2Fdebug%2FAKTDVC62g_oHMo8GmtoA1g%2Findex.html,
this is a case that the propagated BrowingContext has been discarded
already, so it causes aBrowsingContext.GetMaybeDiscarded() get a nullptr.
+
+This patch just check if the propageted BrowsingContext is discarded.
+For the discarded BrowsingContext, try to use its BrowsingContextId to get
the corresponding CanonicalBrowsingContext instead of using the propagated
one.
+
+Differential Revision: https://phabricator.services.mozilla.com/D237702
+
+diff --git a/toolkit/components/sessionstore/SessionStoreParent.cpp
b/toolkit/components/sessionstore/SessionStoreParent.cpp
+--- a/toolkit/components/sessionstore/SessionStoreParent.cpp
++++ b/toolkit/components/sessionstore/SessionStoreParent.cpp
+@@ -194,36 +194,57 @@ mozilla::ipc::IPCResult SessionStorePare
+ return IPC_OK();
+ }
+
+ mozilla::ipc::IPCResult
SessionStoreParent::RecvIncrementalSessionStoreUpdate(
+ const MaybeDiscarded<BrowsingContext>& aBrowsingContext,
+ const Maybe<FormData>& aFormData, const Maybe<nsPoint>& aScrollPosition,
+ uint32_t aEpoch) {
+ if (!aBrowsingContext.IsNull()) {
++ // The passed in BrowsingContext maybe already discarded and its
mRawPtr is
++ // nullptr here. Let try to use the BrowsingContextId to get its
++ // Canonical one in the parent process for SessionStore update.
++ RefPtr<CanonicalBrowsingContext> bc;
++ if (aBrowsingContext.IsDiscarded()) {
++ bc = CanonicalBrowsingContext::Get(aBrowsingContext.ContextId());
++ } else {
++ bc = aBrowsingContext.GetMaybeDiscarded()->Canonical();
++ }
++ if (!bc) {
++ return IPC_OK();
++ }
+ if (aFormData.isSome()) {
+ mHasNewFormData = true;
+ }
+ if (aScrollPosition.isSome()) {
+ mHasNewScrollPosition = true;
+ }
+
+- mSessionStore->UpdateSessionStore(
+- aBrowsingContext.GetMaybeDiscarded()->Canonical(), aFormData,
+- aScrollPosition, aEpoch);
++ mSessionStore->UpdateSessionStore(bc, aFormData, aScrollPosition,
aEpoch);
+ }
+
+ return IPC_OK();
+ }
+
+ mozilla::ipc::IPCResult SessionStoreParent::RecvResetSessionStore(
+ const MaybeDiscarded<BrowsingContext>& aBrowsingContext, uint32_t
aEpoch) {
+ if (!aBrowsingContext.IsNull()) {
+- mSessionStore->RemoveSessionStore(
+- aBrowsingContext.GetMaybeDiscarded()->Canonical());
++ // The passed in BrowsingContext maybe already discarded and its
mRawPtr is
++ // nullptr here. Let try to use the BrowsingContextId to get its
++ // Canonical one in the parent process for SessionStore update.
++ RefPtr<CanonicalBrowsingContext> bc;
++ if (aBrowsingContext.IsDiscarded()) {
++ bc = CanonicalBrowsingContext::Get(aBrowsingContext.ContextId());
++ } else {
++ bc = aBrowsingContext.GetMaybeDiscarded()->Canonical();
++ }
++ if (!bc) {
++ return IPC_OK();
++ }
++ mSessionStore->RemoveSessionStore(bc);
+ }
+ return IPC_OK();
+ }
+
+ void SessionStoreParent::SessionStoreUpdate(
+ const Maybe<nsCString>& aDocShellCaps, const Maybe<bool>& aPrivatedMode,
+ const MaybeSessionStoreZoom& aZoom, const bool aNeedCollectSHistory,
+ const uint32_t& aEpoch) {
+
diff --git
a/http/firefox/patches/0025-bmo-1951697-add-missing-include-for-MOZ_RUNINIT.patch
b/http/firefox/patches/0025-bmo-1951697-add-missing-include-for-MOZ_RUNINIT.patch
deleted file mode 100644
index 4798be6..0000000
---
a/http/firefox/patches/0025-bmo-1951697-add-missing-include-for-MOZ_RUNINIT.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-
-# HG changeset patch
-# User Sandi Vujaković <sandyvujakovicj AT outlook.com>
-# Date 1741336534 0
-# Node ID 6354ee4fbdc377561652a66da1b18d0c81294544
-# Parent 5134f15c4d3585d3c0f969eca0c086d4cd04f274
-Bug 1951697 - Add missing include for MOZ_RUNINIT r=gerard-majax
-
-Differential Revision: https://phabricator.services.mozilla.com/D240500
-
-diff --git a/build/unix/profiling/profiling.cpp
b/build/unix/profiling/profiling.cpp
---- a/build/unix/profiling/profiling.cpp
-+++ b/build/unix/profiling/profiling.cpp
-@@ -5,16 +5,18 @@
- #if defined(MOZ_PROFILE_GENERATE) && defined(XP_LINUX) && !defined(ANDROID)
-
- # include <pthread.h>
- # include <stdio.h>
- # include <stdlib.h>
- # include <unistd.h>
- # include <errno.h>
-
-+# include "mozilla/Attributes.h"
-+
- # if defined(__cplusplus)
- extern "C" {
- # endif
- void __llvm_profile_initialize(void);
- void __llvm_profile_initialize_file(void);
- void __llvm_profile_set_filename(const char*);
-
- // Use the API to force a different filename, then set back the original
one.
-
diff --git
a/http/firefox/patches/0026-bmo-1957749-detach-linux-sandbox-broker-threads-if-needed.patch
b/http/firefox/patches/0026-bmo-1957749-detach-linux-sandbox-broker-threads-if-needed.patch
new file mode 100644
index 0000000..a62b702
--- /dev/null
+++
b/http/firefox/patches/0026-bmo-1957749-detach-linux-sandbox-broker-threads-if-needed.patch
@@ -0,0 +1,129 @@
+
+# HG changeset patch
+# User Jed Davis <jld AT mozilla.com>
+# Date 1744054912 0
+# Node ID 1c57033291daf61fa566e95fb6a29a4c48b100cb
+# Parent 7f93ad9d921857cd1da56df9a59f80e45c119b04
+Bug 1957749 - Detach Linux sandbox broker threads if needed to avoid memory
leak. r=gerard-majax
+
+Differential Revision: https://phabricator.services.mozilla.com/D244284
+
+diff --git a/security/sandbox/linux/broker/SandboxBroker.cpp
b/security/sandbox/linux/broker/SandboxBroker.cpp
+--- a/security/sandbox/linux/broker/SandboxBroker.cpp
++++ b/security/sandbox/linux/broker/SandboxBroker.cpp
+@@ -110,16 +110,21 @@ void SandboxBroker::Terminate() {
+
+ // Join() on the same thread while working with errno EDEADLK is
technically
+ // not POSIX compliant:
+ // https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_join.html#:~:text=refers%20to%20the%20calling%20thread
+ if (mThread != pthread_self()) {
+ shutdown(mFileDesc, SHUT_RD);
+ // The thread will now get EOF even if the client hasn't exited.
+ PlatformThread::Join(mThread);
++ } else {
++ // Nothing is waiting for this thread, so detach it to avoid
++ // memory leaks.
++ int rv = pthread_detach(pthread_self());
++ MOZ_ALWAYS_TRUE(rv == 0);
+ }
+
+ // Now that the thread has exited, the fd will no longer be accessed.
+ close(mFileDesc);
+ // Having ensured that this object outlives the thread, this
+ // destructor can now return.
+
+ mFileDesc = -1;
+diff --git a/security/sandbox/linux/gtest/TestBroker.cpp
b/security/sandbox/linux/gtest/TestBroker.cpp
+--- a/security/sandbox/linux/gtest/TestBroker.cpp
++++ b/security/sandbox/linux/gtest/TestBroker.cpp
+@@ -21,16 +21,17 @@
+ #include <sys/types.h>
+ #include <time.h>
+ #include <unistd.h>
+
+ #include "mozilla/Atomics.h"
+ #include "mozilla/PodOperations.h"
+ #include "mozilla/UniquePtr.h"
+ #include "mozilla/ipc/FileDescriptor.h"
++#include "nsIThreadManager.h"
+
+ namespace mozilla {
+
+ class SandboxBrokerTest : public ::testing::Test {
+ static const int MAY_ACCESS = SandboxBroker::MAY_ACCESS;
+ static const int MAY_READ = SandboxBroker::MAY_READ;
+ static const int MAY_WRITE = SandboxBroker::MAY_WRITE;
+ static const int MAY_CREATE = SandboxBroker::MAY_CREATE;
+@@ -641,20 +642,23 @@ SandboxBrokerSigStress::DoSomething()
+ #endif
+
+ // Check for fd leaks when creating/destroying a broker instance (bug
+ // 1719391).
+ //
+ // (This uses a different test group because it doesn't use the
+ // fixture class, and gtest doesn't allow mixing TEST and TEST_F in
+ // the same group.)
+-TEST(SandboxBrokerMisc, LeakCheck)
++TEST(SandboxBrokerMisc, FileDescLeak)
+ {
+ // If this value is increased in the future, check that it won't
+- // cause the test to take an excessive amount of time:
++ // cause the test to take an excessive amount of time.
++ // (Alternately, this test could be changed to run a smaller number
++ // of cycles and check for increased fd usage afterwards; some care
++ // would be needed to avoid false positives.)
+ static constexpr size_t kCycles = 4096;
+ struct rlimit oldLimit;
+ bool changedLimit = false;
+
+ // At the time of this writing, we raise the fd soft limit to 4096
+ // (or to the hard limit, if less than that), but we don't lower it
+ // if it was higher than 4096. To allow for that case, or if
+ // Gecko's preferred limit changes, the limit is reduced while this
+@@ -683,9 +687,45 @@ TEST(SandboxBrokerMisc, LeakCheck)
+ broker->Terminate();
+ }
+
+ if (changedLimit) {
+ ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &oldLimit), 0) << strerror(errno);
+ }
+ }
+
++// Bug 1958444: In theory this test could fail intermittently: it
++// creates a large number of threads which will do a small amount of
++// work and then exit, but intentionally doesn't join them, so there
++// could be a large number of threads actually live at once, even if
++// they would be cleaned up correctly when they exit.
++//
++// To test locally, delete the `DISABLED_` prefix and rebuild.
++TEST(SandboxBrokerMisc, DISABLED_StackLeak)
++{
++ // The idea is that kCycles * DEFAULT_STACK_SIZE is more than 4GiB
++ // so this fails on 32-bit if the thread stack is leaked. This
++ // isn't ideal; it would be better to either use resource limits
++ // (maybe RLIMIT_AS) or measure address space usage (getrusage or
++ // procfs), to detect such bugs with a smaller amount of leakage.
++ static constexpr size_t kCycles = 16384;
++
++ if (nsIThreadManager::DEFAULT_STACK_SIZE) {
++ EXPECT_GE(nsIThreadManager::DEFAULT_STACK_SIZE, size_t(256 * 1024));
++ }
++
++ pid_t pid = getpid();
++ for (size_t i = 0; i < kCycles; ++i) {
++ auto policy = MakeUnique<SandboxBroker::Policy>();
++ // Currently nothing in `Create` tries to check for or
++ // special-case an empty policy, but just in case:
++ policy->AddPath(SandboxBroker::MAY_READ, "/dev/null",
++ SandboxBroker::Policy::AddAlways);
++ ipc::FileDescriptor fd;
++ RefPtr<SandboxBroker> broker =
++ SandboxBroker::Create(std::move(policy), pid, fd);
++ ASSERT_TRUE(broker != nullptr) << "iter " << i;
++ ASSERT_TRUE(fd.IsValid()) << "iter " << i;
++ broker = nullptr;
++ }
++}
++
+ } // namespace mozilla
+
[[SM-Commit] ] GIT changes to master grimoire by Pavel Vinogradov (73cc69683454fd6233a6ee1f8949d0a8c11af66e),
Pavel Vinogradov, 04/14/2025