[Pcre-svn] [824] code/trunk: Add makefile support for SELinu…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [824] code/trunk: Add makefile support for SELinux allocator in JIT.
Revision: 824
          http://www.exim.org/viewvc/pcre2?view=rev&revision=824
Author:   zherczeg
Date:     2017-06-15 07:20:30 +0100 (Thu, 15 Jun 2017)
Log Message:
-----------
Add makefile support for SELinux allocator in JIT.


Modified Paths:
--------------
    code/trunk/CMakeLists.txt
    code/trunk/configure.ac
    code/trunk/src/config.h.in


Modified: code/trunk/CMakeLists.txt
===================================================================
--- code/trunk/CMakeLists.txt    2017-06-12 17:48:03 UTC (rev 823)
+++ code/trunk/CMakeLists.txt    2017-06-15 06:20:30 UTC (rev 824)
@@ -168,6 +168,9 @@
 SET(PCRE2_SUPPORT_JIT OFF CACHE BOOL
     "Enable support for Just-in-time compiling.")


+SET(PCRE2_SUPPORT_JIT_SEALLOC OFF CACHE BOOL
+    "Enable SELinux compatible execmem allocator in JIT.")
+
 SET(PCRE2_SUPPORT_PCRE2GREP_JIT ON CACHE BOOL
     "Enable use of Just-in-time compiling in pcre2grep.")


@@ -288,6 +291,10 @@
         SET(SUPPORT_JIT 1)
 ENDIF(PCRE2_SUPPORT_JIT)


+IF(PCRE2_SUPPORT_JIT_SEALLOC)
+        SET(SLJIT_PROT_EXECUTABLE_ALLOCATOR 1)
+ENDIF(PCRE2_SUPPORT_JIT_SEALLOC)
+
 IF(PCRE2_SUPPORT_PCRE2GREP_JIT)
         SET(SUPPORT_PCRE2GREP_JIT 1)
 ENDIF(PCRE2_SUPPORT_PCRE2GREP_JIT)
@@ -764,6 +771,7 @@
   MESSAGE(STATUS "  Build 16 bit PCRE2 library ...... : ${PCRE2_BUILD_PCRE2_16}")
   MESSAGE(STATUS "  Build 32 bit PCRE2 library ...... : ${PCRE2_BUILD_PCRE2_32}")
   MESSAGE(STATUS "  Enable JIT compiling support .... : ${PCRE2_SUPPORT_JIT}")
+  MESSAGE(STATUS "  Use SELinux allocator in JIT .... : ${PCRE2_SUPPORT_JIT_SEALLOC}")
   MESSAGE(STATUS "  Enable Unicode support .......... : ${PCRE2_SUPPORT_UNICODE}")
   MESSAGE(STATUS "  Newline char/sequence ........... : ${PCRE2_NEWLINE}")
   MESSAGE(STATUS "  \\R matches only ANYCRLF ......... : ${PCRE2_SUPPORT_BSR_ANYCRLF}")


Modified: code/trunk/configure.ac
===================================================================
--- code/trunk/configure.ac    2017-06-12 17:48:03 UTC (rev 823)
+++ code/trunk/configure.ac    2017-06-15 06:20:30 UTC (rev 824)
@@ -143,6 +143,12 @@
                              [enable Just-In-Time compiling support]),
               , enable_jit=no)


+# Handle --enable-jit-sealloc (disabled by default)
+AC_ARG_ENABLE(jit-sealloc,
+              AS_HELP_STRING([--enable-jit-sealloc],
+                             [enable SELinux compatible execmem allocator in JIT]),
+              , enable_jit_sealloc=no)
+
 # Handle --disable-pcre2grep-jit (enabled by default)
 AC_ARG_ENABLE(pcre2grep-jit,
               AS_HELP_STRING([--disable-pcre2grep-jit],
@@ -584,6 +590,13 @@
   enable_pcre2grep_jit="no"
 fi


+if test "$enable_jit_sealloc" = "yes"; then
+  AC_DEFINE([SLJIT_PROT_EXECUTABLE_ALLOCATOR], [1], [
+    Define to any non-zero number to enable support for SELinux
+    compatible executable memory allocator in JIT. Note that this
+    will have no effect unless SUPPORT_JIT is also defined.])
+fi
+
 if test "$enable_pcre2grep_jit" = "yes"; then
   AC_DEFINE([SUPPORT_PCRE2GREP_JIT], [], [
     Define to any value to enable JIT support in pcre2grep. Note that this will
@@ -977,6 +990,7 @@
     Build 32-bit pcre2 library ......... : ${enable_pcre2_32}
     Include debugging code ............. : ${enable_debug}
     Enable JIT compiling support ....... : ${enable_jit}
+    Use SELinux allocator in JIT ....... : ${enable_jit_sealloc}
     Enable Unicode support ............. : ${enable_unicode}
     Newline char/sequence .............. : ${enable_newline}
     \R matches only ANYCRLF ............ : ${enable_bsr_anycrlf}


Modified: code/trunk/src/config.h.in
===================================================================
--- code/trunk/src/config.h.in    2017-06-12 17:48:03 UTC (rev 823)
+++ code/trunk/src/config.h.in    2017-06-15 06:20:30 UTC (rev 824)
@@ -254,6 +254,11 @@
    your system. */
 #undef PTHREAD_CREATE_JOINABLE


+/* Define to any non-zero number to enable support for SELinux compatible
+ executable memory allocator in JIT. Note that this will have no effect
+ unless SUPPORT_JIT is also defined. */
+#undef SLJIT_PROT_EXECUTABLE_ALLOCATOR
+
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS