pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
mozjs78: Add MPROTECT patch
Module Name: pkgsrc-wip
Committed By: Dan Cîrnaț <dan%alt.md@localhost>
Pushed By: cirnatdan
Date: Mon Nov 9 17:29:04 2020 +0100
Changeset: 1b42af0057f39dd577c59d35be84721dc50a949c
Modified Files:
mozjs78/distinfo
Added Files:
mozjs78/patches/patch-jit_ProcessExecutableMemory.cpp
Log Message:
mozjs78: Add MPROTECT patch
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=1b42af0057f39dd577c59d35be84721dc50a949c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
mozjs78/distinfo | 1 +
.../patches/patch-jit_ProcessExecutableMemory.cpp | 38 ++++++++++++++++++++++
2 files changed, 39 insertions(+)
diffs:
diff --git a/mozjs78/distinfo b/mozjs78/distinfo
index 5bd6b5e387..d8967d5d33 100644
--- a/mozjs78/distinfo
+++ b/mozjs78/distinfo
@@ -7,6 +7,7 @@ Size (mozjs78_78.3.0.orig.tar.xz) = 58324248 bytes
SHA1 (patch-.._.._build_moz.configure_rust.configure) = a40ef515b34781d703e9222e4c88746544556287
SHA1 (patch-.._.._build_moz.configure_toolchain.configure) = 055312319a6a4e2916263baf318585b943c1ca20
SHA1 (patch-configure.in) = e8dab4a549e5cdf2e97d65b258970f9f6cc9c72c
+SHA1 (patch-jit_ProcessExecutableMemory.cpp) = d65001c07cc9393db2dce6ff291e94d5dd76b86e
SHA1 (patch-jsfriendapi.h) = c6eea8b37d44a4b0f9ca0a325e482d01ef2c6e0f
SHA1 (patch-vm_ArrayBufferObject.cpp) = 931695e3e02ec1d6ed0f722be1059c48878cd117
SHA1 (patch-vm_JSONPrinter.cpp) = c2483309516249d23d448e48bc91e20a0b150fba
diff --git a/mozjs78/patches/patch-jit_ProcessExecutableMemory.cpp b/mozjs78/patches/patch-jit_ProcessExecutableMemory.cpp
new file mode 100644
index 0000000000..69a0da84ae
--- /dev/null
+++ b/mozjs78/patches/patch-jit_ProcessExecutableMemory.cpp
@@ -0,0 +1,38 @@
+$NetBSD: patch-jit_ProcessExecutableMemory.cpp,v 1.1 2020/11/05 16:35:25 nia Exp $
+
+PaX MPROTECT safety for NetBSD.
+
+--- jit/ProcessExecutableMemory.cpp.orig 2020-09-25 09:22:55.000000000 +0000
++++ jit/ProcessExecutableMemory.cpp
+@@ -362,9 +362,16 @@ static void* ReserveProcessExecutableMem
+ // Note that randomAddr is just a hint: if the address is not available
+ // mmap will pick a different address.
+ void* randomAddr = ComputeRandomAllocationAddress();
++#ifdef MPROTECT
++ void* p = MozTaggedAnonymousMmap(randomAddr, bytes,
++ PROT_MPROTECT(PROT_EXEC | PROT_WRITE | PROT_READ),
++ MAP_NORESERVE | MAP_PRIVATE | MAP_ANON, -1,
++ 0, "js-executable-memory");
++#else
+ void* p = MozTaggedAnonymousMmap(randomAddr, bytes, PROT_NONE,
+ MAP_NORESERVE | MAP_PRIVATE | MAP_ANON, -1,
+ 0, "js-executable-memory");
++#endif
+ if (p == MAP_FAILED) {
+ return nullptr;
+ }
+@@ -409,8 +416,12 @@ static unsigned ProtectionSettingToFlags
+
+ static MOZ_MUST_USE bool CommitPages(void* addr, size_t bytes,
+ ProtectionSetting protection) {
+- void* p = MozTaggedAnonymousMmap(
+- addr, bytes, ProtectionSettingToFlags(protection),
++ void* p = MozTaggedAnonymousMmap(addr, bytes,
++#ifdef PROT_MPROTECT
++ ProtectionSettingToFlags(protection) | PROT_MPROTECT(PROT_EXEC | PROT_WRITE | PROT_READ),
++#else
++ ProtectionSettingToFlags(protection),
++#endif
+ MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0, "js-executable-memory");
+ if (p == MAP_FAILED) {
+ return false;
Home |
Main Index |
Thread Index |
Old Index