pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/mozjs68 mozjs68: Make PaX-MPROTECT safe on NetBSD.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/30244b2db5cd
branches:  trunk
changeset: 441531:30244b2db5cd
user:      nia <nia%pkgsrc.org@localhost>
date:      Thu Nov 05 16:35:24 2020 +0000

description:
mozjs68: Make PaX-MPROTECT safe on NetBSD.

diffstat:

 lang/mozjs68/Makefile                                      |   6 +-
 lang/mozjs68/distinfo                                      |   3 +-
 lang/mozjs68/patches/patch-jit_ProcessExecutableMemory.cpp |  38 ++++++++++++++
 3 files changed, 42 insertions(+), 5 deletions(-)

diffs (81 lines):

diff -r f5db207603e8 -r 30244b2db5cd lang/mozjs68/Makefile
--- a/lang/mozjs68/Makefile     Thu Nov 05 16:31:45 2020 +0000
+++ b/lang/mozjs68/Makefile     Thu Nov 05 16:35:24 2020 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.9 2020/11/05 09:06:57 ryoon Exp $
+# $NetBSD: Makefile,v 1.10 2020/11/05 16:35:24 nia Exp $
 
 DISTNAME=      mozjs68_68.6.0.orig
 PKGNAME=       ${DISTNAME:S/_/-/:S/.orig//}
-PKGREVISION=   5
+PKGREVISION=   6
 CATEGORIES=    lang
 MASTER_SITES=  http://deb.debian.org/debian/pool/main/m/mozjs68/
 EXTRACT_SUFX=  .tar.xz
@@ -39,8 +39,6 @@
 PKGCONFIG_OVERRIDE+=   build/js.pc.in
 PKGCONFIG_OVERRIDE+=   ctypes/libffi/libffi.pc.in
 
-NOT_PAX_MPROTECT_SAFE+=        bin/js68
-
 # Python 2.7 and Python 3.6 or later are required simultaneously.
 PYTHON_VERSIONS_ACCEPTED=      27
 PYTHON_FOR_BUILD_ONLY=         tool
diff -r f5db207603e8 -r 30244b2db5cd lang/mozjs68/distinfo
--- a/lang/mozjs68/distinfo     Thu Nov 05 16:31:45 2020 +0000
+++ b/lang/mozjs68/distinfo     Thu Nov 05 16:35:24 2020 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.2 2020/05/14 08:44:48 rin Exp $
+$NetBSD: distinfo,v 1.3 2020/11/05 16:35:24 nia Exp $
 
 SHA1 (mozjs68_68.6.0.orig.tar.xz) = 98eb63629e8889caa738fa15591fe8eeba73b227
 RMD160 (mozjs68_68.6.0.orig.tar.xz) = 7b00f416e1e767b0595fbd7e4c26c42c83ccd7a1
@@ -6,5 +6,6 @@
 Size (mozjs68_68.6.0.orig.tar.xz) = 75303520 bytes
 SHA1 (patch-.._.._config_rules.mk) = cf3421d991e1cbfab4c0cdcb7b648b1388fa32d5
 SHA1 (patch-.._.._python_mozbuild_mozbuild_backend_recursivemake.py) = dda670432e5673c5d28dcf6c4902d4a724e71170
+SHA1 (patch-jit_ProcessExecutableMemory.cpp) = 575c1ab68e6558344c09481927c40f0b4308319a
 SHA1 (patch-vm_JSONPrinter.cpp) = 384f26d9602844a3a586184c8971d48a07453645
 SHA1 (patch-vm_JSONPrinter.h) = b92c335185886f79d15f2d9d348bf10e4a714c6e
diff -r f5db207603e8 -r 30244b2db5cd lang/mozjs68/patches/patch-jit_ProcessExecutableMemory.cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/mozjs68/patches/patch-jit_ProcessExecutableMemory.cpp        Thu Nov 05 16:35:24 2020 +0000
@@ -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-03-05 20:56:58.000000000 +0000
++++ jit/ProcessExecutableMemory.cpp
+@@ -343,9 +343,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 PROT_MPROTECT
++  void* p = MozTaggedAnonymousMmap(randomAddr, bytes,
++                                   PROT_MPROTECT(PROT_EXEC | PROT_WRITE | PROT_READ),
++                                   MAP_PRIVATE | MAP_ANON, -1, 0,
++                                   "js-executable-memory");
++#else
+   void* p = MozTaggedAnonymousMmap(randomAddr, bytes, PROT_NONE,
+                                    MAP_PRIVATE | MAP_ANON, -1, 0,
+                                    "js-executable-memory");
++#endif
+   if (p == MAP_FAILED) {
+     return nullptr;
+   }
+@@ -390,8 +397,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