Restrict configuration of the JIT SELinux compatible memory allocator to Linux

and NetBSD.
This commit is contained in:
Philip.Hazel 2020-04-28 15:29:18 +00:00
parent 56c4bf9095
commit 9ff7f342f8
3 changed files with 27 additions and 9 deletions

View File

@ -200,8 +200,12 @@ SET(PCRE2_HEAP_MATCH_RECURSE OFF CACHE BOOL
SET(PCRE2_SUPPORT_JIT OFF CACHE BOOL SET(PCRE2_SUPPORT_JIT OFF CACHE BOOL
"Enable support for Just-in-time compiling.") "Enable support for Just-in-time compiling.")
SET(PCRE2_SUPPORT_JIT_SEALLOC OFF CACHE BOOL IF(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD)
"Enable SELinux compatible execmem allocator in JIT (experimental).") SET(PCRE2_SUPPORT_JIT_SEALLOC OFF CACHE BOOL
"Enable SELinux compatible execmem allocator in JIT (experimental).")
ELSE(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD)
SET(PCRE2_SUPPORT_JIT_SEALLOC IGNORE)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD)
SET(PCRE2GREP_SUPPORT_JIT ON CACHE BOOL SET(PCRE2GREP_SUPPORT_JIT ON CACHE BOOL
"Enable use of Just-in-time compiling in pcre2grep.") "Enable use of Just-in-time compiling in pcre2grep.")
@ -331,8 +335,12 @@ IF(PCRE2_SUPPORT_JIT_SEALLOC)
CHECK_SYMBOL_EXISTS(mkostemp stdlib.h REQUIRED) CHECK_SYMBOL_EXISTS(mkostemp stdlib.h REQUIRED)
UNSET(CMAKE_REQUIRED_DEFINITIONS) UNSET(CMAKE_REQUIRED_DEFINITIONS)
IF(${REQUIRED}) IF(${REQUIRED})
ADD_DEFINITIONS(-D_GNU_SOURCE) IF(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD)
SET(SLJIT_PROT_EXECUTABLE_ALLOCATOR 1) ADD_DEFINITIONS(-D_GNU_SOURCE)
SET(SLJIT_PROT_EXECUTABLE_ALLOCATOR 1)
ELSE(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD)
MESSAGE(FATAL_ERROR "Your configuration is not supported")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD)
ELSE(${REQUIRED}) ELSE(${REQUIRED})
SET(PCRE2_SUPPORT_JIT_SEALLOC OFF) SET(PCRE2_SUPPORT_JIT_SEALLOC OFF)
ENDIF(${REQUIRED}) ENDIF(${REQUIRED})

View File

@ -120,6 +120,9 @@ does). Patch by Carlo Marcelo Arenas Belon.
29. Check for the existence of memfd_create in both CMake and configure 29. Check for the existence of memfd_create in both CMake and configure
configurations. Patch by Carlo Marcelo Arenas Belon. configurations. Patch by Carlo Marcelo Arenas Belon.
30. Restrict the configuration setting for the SELinux compatible execmem
allocator (change 10.30/44) to Linux and NetBSD.
Version 10.34 21-November-2019 Version 10.34 21-November-2019
------------------------------ ------------------------------

View File

@ -176,11 +176,18 @@ if test "$enable_jit" = "auto"; then
echo checking for JIT support on this hardware... $enable_jit echo checking for JIT support on this hardware... $enable_jit
fi fi
# Handle --enable-jit-sealloc (disabled by default) # Handle --enable-jit-sealloc (disabled by default and only experimental)
AC_ARG_ENABLE(jit-sealloc, case $host_os in
AS_HELP_STRING([--enable-jit-sealloc], linux* | netbsd*)
[enable SELinux compatible execmem allocator in JIT (experimental)]), AC_ARG_ENABLE(jit-sealloc,
, enable_jit_sealloc=no) AS_HELP_STRING([--enable-jit-sealloc],
[enable SELinux compatible execmem allocator in JIT (experimental)]),
,enable_jit_sealloc=no)
;;
*)
enable_jit_sealloc=unsupported
;;
esac
# Handle --disable-pcre2grep-jit (enabled by default) # Handle --disable-pcre2grep-jit (enabled by default)
AC_ARG_ENABLE(pcre2grep-jit, AC_ARG_ENABLE(pcre2grep-jit,