From 16e8cfc7eec8d270e328f4162accb23def2e25a5 Mon Sep 17 00:00:00 2001 From: Andrew Morrow Date: Mon, 22 Feb 2021 16:37:22 -0500 Subject: SERVER-54684 Apply upstream fix for MozJS bug 1442583 Please see https://bugzilla.mozilla.org/show_bug.cgi?id=1442583 for the upstream bug. The patch applied here was derived from the following commit: https://github.com/mozilla/gecko-dev/commit/7371a080accd8dfcaf0d24072b787e143846973a (cherry picked from commit 25d0ab84369a09112978d399ccc09b55b7009023) (cherry picked from commit 775f2dfe30552cb2b808bcc320021c01eb5bb518) --- src/third_party/mozjs-60/extract.sh | 1 + .../extract/js/src/jit/ProcessExecutableMemory.cpp | 7 ++++++ .../mozjs-60/patches/moz-bug-1442583.patch | 29 ++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 src/third_party/mozjs-60/patches/moz-bug-1442583.patch diff --git a/src/third_party/mozjs-60/extract.sh b/src/third_party/mozjs-60/extract.sh index 348a8182aa7..b8363d48cdc 100755 --- a/src/third_party/mozjs-60/extract.sh +++ b/src/third_party/mozjs-60/extract.sh @@ -219,3 +219,4 @@ __XARGS_RM__ patch -p4 < patches/big-endian-fixes.patch patch -p4 < patches/windows-Time.cpp-GetModuleHandle.patch patch -p4 < patches/JSGCConfig.patch +patch -p4 < patches/moz-bug-1442583.patch diff --git a/src/third_party/mozjs-60/extract/js/src/jit/ProcessExecutableMemory.cpp b/src/third_party/mozjs-60/extract/js/src/jit/ProcessExecutableMemory.cpp index e763a9d68dc..8a6d50b6a78 100644 --- a/src/third_party/mozjs-60/extract/js/src/jit/ProcessExecutableMemory.cpp +++ b/src/third_party/mozjs-60/extract/js/src/jit/ProcessExecutableMemory.cpp @@ -20,6 +20,9 @@ #include "jsutil.h" #include "gc/Memory.h" +#ifdef JS_CODEGEN_ARM64 +# include "jit/arm64/vixl/Cpu-vixl.h" +#endif #include "threading/LockGuard.h" #include "threading/Mutex.h" #include "util/Windows.h" @@ -621,6 +624,10 @@ js::jit::DeallocateExecutableMemory(void* addr, size_t bytes) bool js::jit::InitProcessExecutableMemory() { +#ifdef JS_CODEGEN_ARM64 + // Initialize instruction cache flushing. + vixl::CPU::SetUp(); +#endif return execMemory.init(); } diff --git a/src/third_party/mozjs-60/patches/moz-bug-1442583.patch b/src/third_party/mozjs-60/patches/moz-bug-1442583.patch new file mode 100644 index 00000000000..93852c0b29a --- /dev/null +++ b/src/third_party/mozjs-60/patches/moz-bug-1442583.patch @@ -0,0 +1,29 @@ +# Fix https://jira.mongodb.org/browse/SERVER-54684 by applying upstream changes from ESR 69 +# - https://bugzilla.mozilla.org/show_bug.cgi?id=1442583 +# - https://github.com/mozilla/gecko-dev/commit/7371a080accd8dfcaf0d24072b787e143846973a + +diff --git a/src/third_party/mozjs-60/extract/js/src/jit/ProcessExecutableMemory.cpp b/src/third_party/mozjs-60/extract/js/src/jit/ProcessExecutableMemory.cpp +index e763a9d68d..8a6d50b6a7 100644 +--- a/src/third_party/mozjs-60/extract/js/src/jit/ProcessExecutableMemory.cpp ++++ b/src/third_party/mozjs-60/extract/js/src/jit/ProcessExecutableMemory.cpp +@@ -20,6 +20,9 @@ + #include "jsutil.h" + + #include "gc/Memory.h" ++#ifdef JS_CODEGEN_ARM64 ++# include "jit/arm64/vixl/Cpu-vixl.h" ++#endif + #include "threading/LockGuard.h" + #include "threading/Mutex.h" + #include "util/Windows.h" +@@ -621,6 +624,10 @@ js::jit::DeallocateExecutableMemory(void* addr, size_t bytes) + bool + js::jit::InitProcessExecutableMemory() + { ++#ifdef JS_CODEGEN_ARM64 ++ // Initialize instruction cache flushing. ++ vixl::CPU::SetUp(); ++#endif + return execMemory.init(); + } + -- cgit v1.2.1