pkgsrc-Bugs archive

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

Re: pkg/57604: LuaJIT2 use rolling release, patch to update pkgsrc package



The following reply was made to PR pkg/57604; it has been noted by GNATS.

From: jonathan buschmann <jonthn++pkgsrc%pinacea.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: pkg-manager%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, pkgsrc-bugs%netbsd.org@localhost,
 jonthn+pkgsrc%pinacea.com@localhost
Subject: Re: pkg/57604: LuaJIT2 use rolling release, patch to update pkgsrc package
Date: Mon, 01 Jan 2024 18:31:40 +0100

 --=_MailMate_91265527-FE18-4CD4-8297-D5495A238284_=
 Content-Type: multipart/alternative;
  boundary="=_MailMate_1F03A892-24FA-4B52-B84D-58F7D63DCA60_="
 Content-Transfer-Encoding: 8bit
 
 
 --=_MailMate_1F03A892-24FA-4B52-B84D-58F7D63DCA60_=
 Content-Type: text/plain; charset=UTF-8; format=flowed
 Content-Transfer-Encoding: 8bit
 
 Hello,
 
 Attached is an update patch for LuaJIT2
 
 - It now follows the versioning of LuaJIT2 (using timestamp of commit 
 date) thatâ??s why you will see a _special_ target to retrieve this one 
 using a local git copy
 - Sadly I still only have a macOS system for the PLIST, I did not try to 
 use libtool as you suggested as I mostly donâ??t know this well enough.
 - When I tried to update this, if my memory serves me well I based this 
 on the tip/LuaJIT2 but still as of now the sources contains (upstream) 
 the modifications for MPROTECT so no need for the patches.
 
 Best regards,
 
 
 On 5 Sep 2023, at 18:14, jonathan buschmann wrote:
 
 > On 6 Sep 2023, at 0:00, nia wrote:
 >
 >> The following reply was made to PR pkg/57604; it has been noted by 
 >> GNATS.
 >>
 >> From: nia <nia%NetBSD.org@localhost>
 >> To: gnats-bugs%NetBSD.org@localhost
 >> Cc:
 >> Subject: Re: pkg/57604: LuaJIT2 use rolling release, patch to update 
 >> pkgsrc
 >>  package
 >> Date: Tue, 5 Sep 2023 15:58:06 +0000
 >>
 >>  A few comments:
 >>
 >>  - For rolling release packages, the version number should be
 >>    x.y.z.YYYYMMDD.
 >
 > OK
 >
 >>  - Your PLIST will result in the package being broken on
 >>    everything except macOS. Ideally, it should be fixed to
 >>    build with libtool, like the other Lua interpreters.
 >
 > Iâ??m sorry I only have a macOS system available.
 >
 >>  - Deleting the MPROTECT-safety patches is quite rude.
 >>    pkgsrc packages should not suddenly become less secure
 >>    by surprise.
 >
 > You are right.
 --=_MailMate_1F03A892-24FA-4B52-B84D-58F7D63DCA60_=
 Content-Type: text/html; charset=UTF-8
 Content-Transfer-Encoding: quoted-printable
 
 <!DOCTYPE html>
 <html>
 <head>
 <meta http-equiv=3D"Content-Type" content=3D"text/xhtml; charset=3Dutf-8"=
 >
 </head>
 <body><div style=3D"font-family: sans-serif;"><div class=3D"markdown" sty=
 le=3D"white-space: normal;">
 <p dir=3D"auto">Hello,</p>
 <p dir=3D"auto">Attached is an update patch for LuaJIT2</p>
 <ul>
 <li>It now follows the versioning of LuaJIT2 (using timestamp of commit d=
 ate) that=E2=80=99s why you will see a <em>special</em> target to retriev=
 e this one using a local git copy</li>
 <li>Sadly I still only have a macOS system for the PLIST, I did not try t=
 o use libtool as you suggested as I mostly don=E2=80=99t know this well e=
 nough.</li>
 <li>When I tried to update this, if my memory serves me well I based this=
  on the tip/LuaJIT2 but still as of now the sources contains (upstream) t=
 he modifications for MPROTECT so no need for the patches.</li>
 </ul>
 <p dir=3D"auto">Best regards,</p>
 <p dir=3D"auto">On 5 Sep 2023, at 18:14, jonathan buschmann wrote:</p>
 </div><div class=3D"plaintext" style=3D"white-space: normal;"><blockquote=
  style=3D"margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777=
 777; color: #777777;"><p dir=3D"auto">On 6 Sep 2023, at 0:00, nia wrote:<=
 /p>
 <blockquote style=3D"margin: 0 0 5px; padding-left: 5px; border-left: 2px=
  solid #777777; border-left-color: #999999; color: #999999;"><p dir=3D"au=
 to">The following reply was made to PR pkg/57604; it has been noted by GN=
 ATS.</p>
 <p dir=3D"auto">From: nia &lt;nia%NetBSD.org@localhost&gt;
 <br>
 To: gnats-bugs%NetBSD.org@localhost
 <br>
 Cc:
 <br>
 Subject: Re: pkg/57604: LuaJIT2 use rolling release, patch to update pkgs=
 rc
 <br>
  package
 <br>
 Date: Tue, 5 Sep 2023 15:58:06 +0000</p>
 <p dir=3D"auto"> A few comments:</p>
 <p dir=3D"auto"> - For rolling release packages, the version number shoul=
 d be
 <br>
    x.y.z.YYYYMMDD.</p>
 </blockquote><p dir=3D"auto">OK</p>
 <blockquote style=3D"margin: 0 0 5px; padding-left: 5px; border-left: 2px=
  solid #777777; border-left-color: #999999; color: #999999;"><p dir=3D"au=
 to"> - Your PLIST will result in the package being broken on
 <br>
    everything except macOS. Ideally, it should be fixed to
 <br>
    build with libtool, like the other Lua interpreters.</p>
 </blockquote><p dir=3D"auto">I=E2=80=99m sorry I only have a macOS system=
  available.</p>
 <blockquote style=3D"margin: 0 0 5px; padding-left: 5px; border-left: 2px=
  solid #777777; border-left-color: #999999; color: #999999;"><p dir=3D"au=
 to"> - Deleting the MPROTECT-safety patches is quite rude.
 <br>
    pkgsrc packages should not suddenly become less secure
 <br>
    by surprise.</p>
 </blockquote><br></blockquote></div>
 <div class=3D"markdown" style=3D"white-space: normal;">
 <blockquote style=3D"margin: 0 0 5px; padding-left: 5px; border-left: 2px=
  solid #777777; color: #777777;">
 <p dir=3D"auto">You are right.</p>
 </blockquote>
 
 </div></div></body>
 
 </html>
 
 --=_MailMate_1F03A892-24FA-4B52-B84D-58F7D63DCA60_=--
 
 --=_MailMate_91265527-FE18-4CD4-8297-D5495A238284_=
 Content-Disposition: attachment; filename="LuaJIT2.diff"
 Content-Type: text/plain
 Content-Transfer-Encoding: quoted-printable
 
 diff --git i/lang/LuaJIT2/Makefile w/lang/LuaJIT2/Makefile
 index 5a493451d75..8b7bd8df640 100644
 --- i/lang/LuaJIT2/Makefile
 +++ w/lang/LuaJIT2/Makefile
 @@ -1,11 +1,14 @@
  # $NetBSD: Makefile,v 1.16 2020/11/06 12:15:53 nia Exp $
  #
  =
 
 -DISTNAME=3D	LuaJIT-2.0.5
 -PKGNAME=3D	${DISTNAME:S/LuaJIT/LuaJIT2/}
 -PKGREVISION=3D	2
 +LUAJIT_TIMESTAMP=3D	1703358377
 +DISTNAME=3D	luajit-v2.1.${LUAJIT_TIMESTAMP}
 +PKGNAME=3D	${DISTNAME:C/luajit-v([.0-9]+)-(.*)/LuaJIT2-\1.0.\2/}
  CATEGORIES=3D	lang lua
 -MASTER_SITES=3D	http://luajit.org/download/
 +MASTER_SITES=3D	${MASTER_SITE_GITHUB:=3DLuaJIT/}
 +
 +GITHUB_PROJECT=3D	LuaJIT
 +GITHUB_TAG=3D	c525bcb9024510cad9e170e12b6209aedb330f83
  =
 
  MAINTAINER=3D	pkgsrc-users%NetBSD.org@localhost
  HOMEPAGE=3D	https://luajit.org/
 @@ -28,6 +31,20 @@ PTHREAD_AUTO_VARS=3D	yes
  =
 
  .include "../../mk/bsd.prefs.mk"
  =
 
 +post-extract:
 +	${ECHO} ${LUAJIT_TIMESTAMP} > ${WRKSRC}/.relver
 +
 +MAKE_ENV+=3D		PREREL=3D-${PKGVERSION}
 +BUILD_TARGET=3D		amalg
 +CFLAGS+=3D		-DLUAJIT_ENABLE_LUA52COMPAT
 +
 +.if ${OPSYS} =3D=3D "Darwin" && ${OS_VERSION:R} >=3D 19
 +CFLAGS.Darwin+=3D		-fno-stack-check
 +MAKE_ENV+=3D		MACOSX_DEPLOYMENT_TARGET=3D"${OSX_VERSION}"
 +.endif
 +
 +PLIST_SUBST=3D		LUAJIT_TIMESTAMP=3D${LUAJIT_TIMESTAMP}
 +
  # Upstream doesn't support building shared libs on SunOS
  # http://www.freelists.org/post/luajit/LuaJIT-on-solaris-64
  PLIST_VARS+=3D		shared
 @@ -38,3 +55,10 @@ PRINT_PLIST_AWK+=3D	{if ($$0 ~ /\.so/) {$$0 =3D "$${PL=
 IST.shared}" $$0;}}
  =
 
  .include "../../mk/pthread.buildlink3.mk"
  .include "../../mk/bsd.pkg.mk"
 +
 +timestamp:
 +	${RUN} git --version > /dev/null 2>&1
 +	${RUN} git clone https://github.com/LuaJIT/LuaJIT ${.TARGET}.tmp > /dev=
 /null 2>&1
 +	@${ECHO_MSG} "Please update timestamp in Makefile with : " \
 +		$$(cd ${.TARGET}.tmp && git show -s --format=3D%ct)
 +	${ECHO} ${RM} -rf ${.TARGET}.tmp
 diff --git i/lang/LuaJIT2/PLIST w/lang/LuaJIT2/PLIST
 index f02164a6134..817ff2d4fdc 100644
 --- i/lang/LuaJIT2/PLIST
 +++ w/lang/LuaJIT2/PLIST
 @@ -1,28 +1,36 @@
 -@comment $NetBSD: PLIST,v 1.3 2016/06/21 16:40:10 fhajny Exp $
 +@comment $NetBSD$
  bin/luajit
 -bin/luajit-${PKGVERSION}
 -include/luajit-2.0/lauxlib.h
 -include/luajit-2.0/lua.h
 -include/luajit-2.0/lua.hpp
 -include/luajit-2.0/luaconf.h
 -include/luajit-2.0/luajit.h
 -include/luajit-2.0/lualib.h
 +bin/luajit-2.1
 +include/luajit-2.1/lauxlib.h
 +include/luajit-2.1/lua.h
 +include/luajit-2.1/lua.hpp
 +include/luajit-2.1/luaconf.h
 +include/luajit-2.1/luajit.h
 +include/luajit-2.1/lualib.h
 +lib/libluajit-5.1.2.1.${LUAJIT_TIMESTAMP}.dylib
 +lib/libluajit-5.1.2.dylib
  lib/libluajit-5.1.a
 -${PLIST.shared}lib/libluajit-5.1.so
 -${PLIST.shared}lib/libluajit-5.1.so.2
 -${PLIST.shared}lib/libluajit-5.1.so.${PKGVERSION}
 +lib/libluajit-5.1.dylib
  lib/pkgconfig/luajit.pc
 -share/luajit-${PKGVERSION}/jit/bc.lua
 -share/luajit-${PKGVERSION}/jit/bcsave.lua
 -share/luajit-${PKGVERSION}/jit/dis_arm.lua
 -share/luajit-${PKGVERSION}/jit/dis_mips.lua
 -share/luajit-${PKGVERSION}/jit/dis_mipsel.lua
 -share/luajit-${PKGVERSION}/jit/dis_ppc.lua
 -share/luajit-${PKGVERSION}/jit/dis_x64.lua
 -share/luajit-${PKGVERSION}/jit/dis_x86.lua
 -share/luajit-${PKGVERSION}/jit/dump.lua
 -share/luajit-${PKGVERSION}/jit/v.lua
 -share/luajit-${PKGVERSION}/jit/vmdef.lua
  man/man1/luajit.1
 +share/luajit-2.1/jit/bc.lua
 +share/luajit-2.1/jit/bcsave.lua
 +share/luajit-2.1/jit/dis_arm.lua
 +share/luajit-2.1/jit/dis_arm64.lua
 +share/luajit-2.1/jit/dis_arm64be.lua
 +share/luajit-2.1/jit/dis_mips.lua
 +share/luajit-2.1/jit/dis_mips64.lua
 +share/luajit-2.1/jit/dis_mips64el.lua
 +share/luajit-2.1/jit/dis_mips64r6.lua
 +share/luajit-2.1/jit/dis_mips64r6el.lua
 +share/luajit-2.1/jit/dis_mipsel.lua
 +share/luajit-2.1/jit/dis_ppc.lua
 +share/luajit-2.1/jit/dis_x64.lua
 +share/luajit-2.1/jit/dis_x86.lua
 +share/luajit-2.1/jit/dump.lua
 +share/luajit-2.1/jit/p.lua
 +share/luajit-2.1/jit/v.lua
 +share/luajit-2.1/jit/vmdef.lua
 +share/luajit-2.1/jit/zone.lua
  @pkgdir share/lua/5.1
  @pkgdir lib/lua/5.1
 diff --git i/lang/LuaJIT2/distinfo w/lang/LuaJIT2/distinfo
 index 9c095926fb6..dde4b33af23 100644
 --- i/lang/LuaJIT2/distinfo
 +++ w/lang/LuaJIT2/distinfo
 @@ -1,10 +1,6 @@
  $NetBSD: distinfo,v 1.13 2021/10/26 10:51:29 nia Exp $
  =
 
 -BLAKE2s (LuaJIT-2.0.5.tar.gz) =3D 54f7b86f27f588160895a8e076bb11d63eb60b=
 dad87c9e573d627ae03ea5319d
 -SHA512 (LuaJIT-2.0.5.tar.gz) =3D 2636675602b4a060b0571c05220db2061dd2f38=
 568e35b2be346a0f5e3128d87057d11d3d0d7567d8cc4e0817b5e4cf2c52a17a480655209=
 62b157816465a9fe
 -Size (LuaJIT-2.0.5.tar.gz) =3D 849845 bytes
 -SHA1 (patch-Makefile) =3D edea30d017c9d2938d951bfdee88020906945aee
 -SHA1 (patch-src_Makefile) =3D d7236260dc17f470d7d6e41a57a22dcd3a501c28
 -SHA1 (patch-src_lj__arch.h) =3D 4c34706db4c678b368bb3e38b07505abde01e590=
 
 -SHA1 (patch-src_lj__ccallback.c) =3D 8032bc451a504ae9538fb0ae4cc1ee729ed=
 e3a70
 -SHA1 (patch-src_lj__mcode.c) =3D c150e0b07ab441e983ace21e0e813fd4334290b=
 5
 +BLAKE2s (luajit-v2.1.1703358377-c525bcb9024510cad9e170e12b6209aedb330f83=
 =2Etar.gz) =3D 36922f5cba073a211f069b6e5cd87e03101b81bc061b9fa82c462e1086=
 a7c32d
 +SHA512 (luajit-v2.1.1703358377-c525bcb9024510cad9e170e12b6209aedb330f83.=
 tar.gz) =3D 86ed4b8fb5fabe8b7ce7c059d18acf16d527501edb1f5d1a0453e17b75a47=
 22f1f048d0309515f25cd6c3850f22934ef793e709362ad88053dd2b0e4ab735666
 +Size (luajit-v2.1.1703358377-c525bcb9024510cad9e170e12b6209aedb330f83.ta=
 r.gz) =3D 1079440 bytes
 +SHA1 (patch-Makefile) =3D 89904974c7e2737d5600c78669d0bdbf0de4cf0a
 diff --git i/lang/LuaJIT2/patches/patch-Makefile w/lang/LuaJIT2/patches/p=
 atch-Makefile
 index aac8fcb70dc..885bcd81165 100644
 --- i/lang/LuaJIT2/patches/patch-Makefile
 +++ w/lang/LuaJIT2/patches/patch-Makefile
 @@ -2,9 +2,9 @@ $NetBSD: patch-Makefile,v 1.6 2017/05/29 21:47:31 alnsn E=
 xp $
  =
 
  Fix installation.
  =
 
 ---- Makefile.orig	2017-05-01 18:11:00.000000000 +0000
 -+++ Makefile
 -@@ -24,7 +24,6 @@ ABIVER=3D  5.1
 +--- Makefile	2023-08-29 08:21:51.000000000 +0800
 ++++ Makefile	2023-08-29 10:20:21.000000000 +0800
 +@@ -30,7 +30,6 @@
   # Change the installation path as needed. This automatically adjusts
   # the paths in src/luaconf.h, too. Note: PREFIX must be an absolute pat=
 h!
   #
 @@ -12,7 +12,7 @@ Fix installation.
   export MULTILIB=3D lib
   #######################################################################=
 #######
   =
 
 -@@ -40,7 +39,7 @@ INSTALL_LMODD=3D $(INSTALL_SHARE)/lua
 +@@ -47,10 +46,10 @@
   INSTALL_LMOD=3D $(INSTALL_LMODD)/$(ABIVER)
   INSTALL_CMODD=3D $(INSTALL_LIB)/lua
   INSTALL_CMOD=3D $(INSTALL_CMODD)/$(ABIVER)
 @@ -20,13 +20,17 @@ Fix installation.
  +INSTALL_MAN=3D $(DPREFIX)/${PKGMANDIR}/man1
   INSTALL_PKGCONFIG=3D $(INSTALL_LIB)/pkgconfig
   =
 
 - INSTALL_TNAME=3D luajit-$(VERSION)
 -@@ -74,7 +73,7 @@ SYMLINK=3D ln -sf
 +-INSTALL_TNAME=3D luajit-$(VERSION)
 ++INSTALL_TNAME=3D luajit-$(MMVERSION)
 + INSTALL_TSYMNAME=3D luajit
 + INSTALL_ANAME=3D libluajit-$(ABIVER).a
 + INSTALL_SOSHORT1=3D libluajit-$(ABIVER).so
 +@@ -81,7 +80,7 @@
   INSTALL_X=3D install -m 0755
   INSTALL_F=3D install -m 0644
   UNINSTALL=3D $(RM)
 --LDCONFIG=3D ldconfig -n
 +-LDCONFIG=3D ldconfig -n 2>/dev/null
  +LDCONFIG=3D true
   SED_PC=3D sed -e "s|^prefix=3D.*|prefix=3D$(PREFIX)|" \
 -             -e "s|^multilib=3D.*|multilib=3D$(MULTILIB)|"
 - =
 
 + 	    -e "s|^multilib=3D.*|multilib=3D$(MULTILIB)|" \
 + 	    -e "s|^relver=3D.*|relver=3D$(RELVER)|"
 diff --git i/lang/LuaJIT2/patches/patch-src_Makefile w/lang/LuaJIT2/patch=
 es/patch-src_Makefile
 deleted file mode 100644
 index 85dfba636cb..00000000000
 --- i/lang/LuaJIT2/patches/patch-src_Makefile
 +++ /dev/null
 @@ -1,16 +0,0 @@
 -$NetBSD: patch-src_Makefile,v 1.2 2017/05/29 21:47:31 alnsn Exp $
 -
 -Fix building on OS X.
 -
 ---- src/Makefile.orig	2017-05-01 18:11:00.000000000 +0000
 -+++ src/Makefile
 -@@ -297,9 +297,6 @@ ifeq (,$(shell $(TARGET_CC) -o /dev/null
 -   TARGET_XCFLAGS+=3D -fno-stack-protector
 - endif
 - ifeq (Darwin,$(TARGET_SYS))
 --  ifeq (,$(MACOSX_DEPLOYMENT_TARGET))
 --    export MACOSX_DEPLOYMENT_TARGET=3D10.4
 --  endif
 -   TARGET_STRIP+=3D -x
 -   TARGET_XSHLDFLAGS=3D -dynamiclib -single_module -undefined dynamic_lo=
 okup -fPIC
 -   TARGET_DYNXLDOPTS=3D
 diff --git i/lang/LuaJIT2/patches/patch-src_lj__arch.h w/lang/LuaJIT2/pat=
 ches/patch-src_lj__arch.h
 deleted file mode 100644
 index 55835241d1e..00000000000
 --- i/lang/LuaJIT2/patches/patch-src_lj__arch.h
 +++ /dev/null
 @@ -1,32 +0,0 @@
 -$NetBSD: patch-src_lj__arch.h,v 1.1 2018/06/02 20:01:21 he Exp $
 -
 -Fix the test for endianness so that NetBSD/powerpc isn't
 -mis-categorized as little-endian only because _LITTLE_ENDIAN
 -is defined -- what matters on NetBSD is the value of _BYTE_ORDER.
 -
 ---- src/lj_arch.h.orig	2017-05-01 18:11:00.000000000 +0000
 -+++ src/lj_arch.h
 -@@ -339,12 +339,21 @@
 - #if defined(_SOFT_FLOAT) || defined(_SOFT_DOUBLE)
 - #error "No support for PowerPC CPUs without double-precision FPU"
 - #endif
 --#if defined(_LITTLE_ENDIAN)
 --#error "No support for little-endian PowerPC"
 -+
 -+#if defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN)
 -+# if (_BYTE_ORDER =3D=3D _LITTLE_ENDIAN)
 -+#  error "No support for little-endian PowerPC"
 -+# endif
 -+#else
 -+# if defined(_LITTLE_ENDIAN)
 -+#  error "No support for little-endian PowerPC"
 -+# endif
 - #endif
 -+
 - #if defined(_LP64)
 - #error "No support for PowerPC 64 bit mode"
 - #endif
 -+
 - #elif LJ_TARGET_MIPS
 - #if defined(__mips_soft_float)
 - #error "No support for MIPS CPUs without FPU"
 diff --git i/lang/LuaJIT2/patches/patch-src_lj__ccallback.c w/lang/LuaJIT=
 2/patches/patch-src_lj__ccallback.c
 deleted file mode 100644
 index acfab0a0d84..00000000000
 --- i/lang/LuaJIT2/patches/patch-src_lj__ccallback.c
 +++ /dev/null
 @@ -1,21 +0,0 @@
 -$NetBSD: patch-src_lj__ccallback.c,v 1.1 2020/11/06 12:15:53 nia Exp $
 -
 -Make this PaX-MPROTECT safe on NetBSD.
 -
 ---- src/lj_ccallback.c.orig	2017-05-01 18:11:00.000000000 +0000
 -+++ src/lj_ccallback.c
 -@@ -228,8 +228,12 @@ static void callback_mcode_new(CTState *
 -   if (!p)
 -     lj_err_caller(cts->L, LJ_ERR_FFI_CBACKOV);
 - #elif LJ_TARGET_POSIX
 --  p =3D mmap(NULL, sz, (PROT_READ|PROT_WRITE), MAP_PRIVATE|MAP_ANONYMOU=
 S,
 --	   -1, 0);
 -+#ifdef PROT_MPROTECT
 -+  p =3D mmap(NULL, sz, (PROT_READ|PROT_WRITE) | PROT_MPROTECT(PROT_EXEC=
 ),
 -+#else
 -+  p =3D mmap(NULL, sz, (PROT_READ|PROT_WRITE),
 -+#endif
 -+           MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
 -   if (p =3D=3D MAP_FAILED)
 -     lj_err_caller(cts->L, LJ_ERR_FFI_CBACKOV);
 - #else
 diff --git i/lang/LuaJIT2/patches/patch-src_lj__mcode.c w/lang/LuaJIT2/pa=
 tches/patch-src_lj__mcode.c
 deleted file mode 100644
 index 647e6ac3bd4..00000000000
 --- i/lang/LuaJIT2/patches/patch-src_lj__mcode.c
 +++ /dev/null
 @@ -1,27 +0,0 @@
 -$NetBSD: patch-src_lj__mcode.c,v 1.1 2020/11/06 12:15:53 nia Exp $
 -
 -Make PaX-MPROTECT safe for NetBSD.
 -
 ---- src/lj_mcode.c.orig	2017-05-01 18:11:00.000000000 +0000
 -+++ src/lj_mcode.c
 -@@ -99,7 +99,11 @@ static int mcode_setprot(void *p, size_t
 - =
 
 - static void *mcode_alloc_at(jit_State *J, uintptr_t hint, size_t sz, in=
 t prot)
 - {
 -+#ifdef PROT_MPROTECT
 -+  void *p =3D mmap((void *)hint, sz, prot | PROT_MPROTECT(MCPROT_RWX), =
 MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
 -+#else
 -   void *p =3D mmap((void *)hint, sz, prot, MAP_PRIVATE|MAP_ANONYMOUS, -=
 1, 0);
 -+#endif
 -   if (p =3D=3D MAP_FAILED) {
 -     if (!hint) lj_trace_err(J, LJ_TRERR_MCODEAL);
 -     p =3D NULL;
 -@@ -255,7 +259,7 @@ static void *mcode_alloc(jit_State *J, s
 - /* All memory addresses are reachable by relative jumps. */
 - static void *mcode_alloc(jit_State *J, size_t sz)
 - {
 --#ifdef __OpenBSD__
 -+#if defined(__NetBSD__) || defined(__OpenBSD__)
 -   /* Allow better executable memory allocation for OpenBSD W^X mode. */=
 
 -   void *p =3D mcode_alloc_at(J, 0, sz, MCPROT_RUN);
 -   if (p && mcode_setprot(p, sz, MCPROT_GEN)) {
 
 --=_MailMate_91265527-FE18-4CD4-8297-D5495A238284_=--
 
 


Home | Main Index | Thread Index | Old Index