git: c0f77d931c52 - main - www/firefox{,-esr} mail/thunderbird{-esr}: fix runtime on arm64
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 27 Jul 2025 21:36:10 UTC
The branch main has been updated by cmt:
URL: https://cgit.FreeBSD.org/ports/commit/?id=c0f77d931c522aac38cef997652826967e451bea
commit c0f77d931c522aac38cef997652826967e451bea
Author: Christoph Moench-Tegeder <cmt@FreeBSD.org>
AuthorDate: 2025-07-27 21:31:05 +0000
Commit: Christoph Moench-Tegeder <cmt@FreeBSD.org>
CommitDate: 2025-07-27 21:31:05 +0000
www/firefox{,-esr} mail/thunderbird{-esr}: fix runtime on arm64
reports of crashes on arm64 with aslr enabled.
PR: 271081
Reported by: markj@
---
mail/thunderbird-esr/Makefile | 1 +
mail/thunderbird-esr/files/patch-bug1876632 | 35 +++++++++++++++++++++++++++++
mail/thunderbird/Makefile | 2 +-
mail/thunderbird/files/patch-bug1876632 | 35 +++++++++++++++++++++++++++++
www/firefox-esr/Makefile | 1 +
www/firefox-esr/files/patch-bug1876632 | 35 +++++++++++++++++++++++++++++
www/firefox/Makefile | 2 +-
www/firefox/files/patch-bug1876632 | 35 +++++++++++++++++++++++++++++
8 files changed, 144 insertions(+), 2 deletions(-)
diff --git a/mail/thunderbird-esr/Makefile b/mail/thunderbird-esr/Makefile
index fc29b8434d09..063b69fbbaa0 100644
--- a/mail/thunderbird-esr/Makefile
+++ b/mail/thunderbird-esr/Makefile
@@ -1,5 +1,6 @@
PORTNAME= thunderbird
DISTVERSION= 140.1.0
+PORTREVISION= 1
CATEGORIES= mail news net-im wayland
MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}esr/source \
MOZILLA/${PORTNAME}/candidates/${DISTVERSION}esr-candidates/build1/source
diff --git a/mail/thunderbird-esr/files/patch-bug1876632 b/mail/thunderbird-esr/files/patch-bug1876632
new file mode 100644
index 000000000000..3932b1deccc9
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-bug1876632
@@ -0,0 +1,35 @@
+commit 4f531ca86d24be5d4de673f6e652ed899151d20c
+Author: Jesper Schmitz Mouridsen <jesper@schmitz.computer>
+Date: Wed Jul 23 22:01:31 2025 +0000
+
+ Bug 1876632 Fix aslr allocations on FreeBSD r=spidermonkey-reviewers,sfink
+
+ Without the alignment flag the desired address
+ gets randomized by aslr in a way which causes it to not
+ be aligned. Furthermore the TryToAlignChunk almost always
+ fails. With this fix it never gets to TryToAlignChunk
+ because the flag guarantees upfront alignment.
+
+ Differential Revision: https://phabricator.services.mozilla.com/D257824
+
+diff --git js/src/gc/Memory.cpp js/src/gc/Memory.cpp
+index e790f1784ede..13639c9a6eb4 100644
+--- js/src/gc/Memory.cpp
++++ js/src/gc/Memory.cpp
+@@ -608,7 +608,16 @@ static void* MapAlignedPagesRandom(size_t length, size_t alignment) {
+ for (size_t i = 1; i <= 1024; ++i) {
+ if (i & 0xf) {
+ uint64_t desired = alignment * GetNumberInRange(minNum, maxNum);
++# if defined(__FreeBSD__) && defined(__aarch64__)
++ int flags = MAP_PRIVATE | MAP_ANON |
++ MAP_ALIGNED(mozilla::CeilingLog2Size(alignment));
++ region = MozTaggedAnonymousMmap((void*)(uintptr_t)desired, length,
++ int(PageAccess::ReadWrite), flags, -1, 0,
++ "js-gc-heap");
++# else
+ region = MapMemoryAtFuzzy(reinterpret_cast<void*>(desired), length);
++
++# endif
+ if (!region) {
+ continue;
+ }
diff --git a/mail/thunderbird/Makefile b/mail/thunderbird/Makefile
index db910ff21632..2ebe069477a3 100644
--- a/mail/thunderbird/Makefile
+++ b/mail/thunderbird/Makefile
@@ -1,6 +1,6 @@
PORTNAME= thunderbird
DISTVERSION= 141.0
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= mail news net-im wayland
MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}${DISTVERSIONSUFFIX}/source \
MOZILLA/${PORTNAME}/candidates/${DISTVERSION}${DISTVERSIONSUFFIX}-candidates/build3/source
diff --git a/mail/thunderbird/files/patch-bug1876632 b/mail/thunderbird/files/patch-bug1876632
new file mode 100644
index 000000000000..3932b1deccc9
--- /dev/null
+++ b/mail/thunderbird/files/patch-bug1876632
@@ -0,0 +1,35 @@
+commit 4f531ca86d24be5d4de673f6e652ed899151d20c
+Author: Jesper Schmitz Mouridsen <jesper@schmitz.computer>
+Date: Wed Jul 23 22:01:31 2025 +0000
+
+ Bug 1876632 Fix aslr allocations on FreeBSD r=spidermonkey-reviewers,sfink
+
+ Without the alignment flag the desired address
+ gets randomized by aslr in a way which causes it to not
+ be aligned. Furthermore the TryToAlignChunk almost always
+ fails. With this fix it never gets to TryToAlignChunk
+ because the flag guarantees upfront alignment.
+
+ Differential Revision: https://phabricator.services.mozilla.com/D257824
+
+diff --git js/src/gc/Memory.cpp js/src/gc/Memory.cpp
+index e790f1784ede..13639c9a6eb4 100644
+--- js/src/gc/Memory.cpp
++++ js/src/gc/Memory.cpp
+@@ -608,7 +608,16 @@ static void* MapAlignedPagesRandom(size_t length, size_t alignment) {
+ for (size_t i = 1; i <= 1024; ++i) {
+ if (i & 0xf) {
+ uint64_t desired = alignment * GetNumberInRange(minNum, maxNum);
++# if defined(__FreeBSD__) && defined(__aarch64__)
++ int flags = MAP_PRIVATE | MAP_ANON |
++ MAP_ALIGNED(mozilla::CeilingLog2Size(alignment));
++ region = MozTaggedAnonymousMmap((void*)(uintptr_t)desired, length,
++ int(PageAccess::ReadWrite), flags, -1, 0,
++ "js-gc-heap");
++# else
+ region = MapMemoryAtFuzzy(reinterpret_cast<void*>(desired), length);
++
++# endif
+ if (!region) {
+ continue;
+ }
diff --git a/www/firefox-esr/Makefile b/www/firefox-esr/Makefile
index 644906398ba9..342503a40bbe 100644
--- a/www/firefox-esr/Makefile
+++ b/www/firefox-esr/Makefile
@@ -1,5 +1,6 @@
PORTNAME= firefox
DISTVERSION= 140.1.0
+PORTREVISION= 1
PORTEPOCH= 1
CATEGORIES= www wayland
MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}esr/source \
diff --git a/www/firefox-esr/files/patch-bug1876632 b/www/firefox-esr/files/patch-bug1876632
new file mode 100644
index 000000000000..3932b1deccc9
--- /dev/null
+++ b/www/firefox-esr/files/patch-bug1876632
@@ -0,0 +1,35 @@
+commit 4f531ca86d24be5d4de673f6e652ed899151d20c
+Author: Jesper Schmitz Mouridsen <jesper@schmitz.computer>
+Date: Wed Jul 23 22:01:31 2025 +0000
+
+ Bug 1876632 Fix aslr allocations on FreeBSD r=spidermonkey-reviewers,sfink
+
+ Without the alignment flag the desired address
+ gets randomized by aslr in a way which causes it to not
+ be aligned. Furthermore the TryToAlignChunk almost always
+ fails. With this fix it never gets to TryToAlignChunk
+ because the flag guarantees upfront alignment.
+
+ Differential Revision: https://phabricator.services.mozilla.com/D257824
+
+diff --git js/src/gc/Memory.cpp js/src/gc/Memory.cpp
+index e790f1784ede..13639c9a6eb4 100644
+--- js/src/gc/Memory.cpp
++++ js/src/gc/Memory.cpp
+@@ -608,7 +608,16 @@ static void* MapAlignedPagesRandom(size_t length, size_t alignment) {
+ for (size_t i = 1; i <= 1024; ++i) {
+ if (i & 0xf) {
+ uint64_t desired = alignment * GetNumberInRange(minNum, maxNum);
++# if defined(__FreeBSD__) && defined(__aarch64__)
++ int flags = MAP_PRIVATE | MAP_ANON |
++ MAP_ALIGNED(mozilla::CeilingLog2Size(alignment));
++ region = MozTaggedAnonymousMmap((void*)(uintptr_t)desired, length,
++ int(PageAccess::ReadWrite), flags, -1, 0,
++ "js-gc-heap");
++# else
+ region = MapMemoryAtFuzzy(reinterpret_cast<void*>(desired), length);
++
++# endif
+ if (!region) {
+ continue;
+ }
diff --git a/www/firefox/Makefile b/www/firefox/Makefile
index eafa58cd90d3..7705943ea874 100644
--- a/www/firefox/Makefile
+++ b/www/firefox/Makefile
@@ -1,6 +1,6 @@
PORTNAME= firefox
DISTVERSION= 141.0
-PORTREVISION= 1
+PORTREVISION= 2
PORTEPOCH= 2
CATEGORIES= www wayland
MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}${DISTVERSIONSUFFIX}/source \
diff --git a/www/firefox/files/patch-bug1876632 b/www/firefox/files/patch-bug1876632
new file mode 100644
index 000000000000..3932b1deccc9
--- /dev/null
+++ b/www/firefox/files/patch-bug1876632
@@ -0,0 +1,35 @@
+commit 4f531ca86d24be5d4de673f6e652ed899151d20c
+Author: Jesper Schmitz Mouridsen <jesper@schmitz.computer>
+Date: Wed Jul 23 22:01:31 2025 +0000
+
+ Bug 1876632 Fix aslr allocations on FreeBSD r=spidermonkey-reviewers,sfink
+
+ Without the alignment flag the desired address
+ gets randomized by aslr in a way which causes it to not
+ be aligned. Furthermore the TryToAlignChunk almost always
+ fails. With this fix it never gets to TryToAlignChunk
+ because the flag guarantees upfront alignment.
+
+ Differential Revision: https://phabricator.services.mozilla.com/D257824
+
+diff --git js/src/gc/Memory.cpp js/src/gc/Memory.cpp
+index e790f1784ede..13639c9a6eb4 100644
+--- js/src/gc/Memory.cpp
++++ js/src/gc/Memory.cpp
+@@ -608,7 +608,16 @@ static void* MapAlignedPagesRandom(size_t length, size_t alignment) {
+ for (size_t i = 1; i <= 1024; ++i) {
+ if (i & 0xf) {
+ uint64_t desired = alignment * GetNumberInRange(minNum, maxNum);
++# if defined(__FreeBSD__) && defined(__aarch64__)
++ int flags = MAP_PRIVATE | MAP_ANON |
++ MAP_ALIGNED(mozilla::CeilingLog2Size(alignment));
++ region = MozTaggedAnonymousMmap((void*)(uintptr_t)desired, length,
++ int(PageAccess::ReadWrite), flags, -1, 0,
++ "js-gc-heap");
++# else
+ region = MapMemoryAtFuzzy(reinterpret_cast<void*>(desired), length);
++
++# endif
+ if (!region) {
+ continue;
+ }