diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a71252..956aa18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,6 +168,9 @@ SET(PCRE2_HEAP_MATCH_RECURSE OFF CACHE BOOL 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 @@ IF(PCRE2_SUPPORT_JIT) 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 @@ IF(PCRE2_SHOW_REPORT) 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}") diff --git a/configure.ac b/configure.ac index 1205039..d713dc2 100644 --- a/configure.ac +++ b/configure.ac @@ -143,6 +143,12 @@ AC_ARG_ENABLE(jit, [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 @@ else 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 @@ $PACKAGE-$VERSION configuration summary: 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} diff --git a/src/config.h.in b/src/config.h.in index 0ff1ed5..7a3a861 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -254,6 +254,11 @@ sure both macros are undefined; an emulation function will then be used. */ 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