From 488dde94db43fbb89631f84fdc899f90d5314939 Mon Sep 17 00:00:00 2001 From: ph10 Date: Tue, 28 Apr 2020 15:29:18 +0000 Subject: Restrict configuration of the JIT SELinux compatible memory allocator to Linux and NetBSD. git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1252 6239d852-aaf2-0410-a92c-79f79f948069 --- CMakeLists.txt | 16 ++++++++++++---- ChangeLog | 3 +++ configure.ac | 17 ++++++++++++----- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08f1dd5..5e9da6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -200,8 +200,12 @@ 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 (experimental).") +IF(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD) + 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 "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) UNSET(CMAKE_REQUIRED_DEFINITIONS) IF(${REQUIRED}) - ADD_DEFINITIONS(-D_GNU_SOURCE) - SET(SLJIT_PROT_EXECUTABLE_ALLOCATOR 1) + IF(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD) + 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}) SET(PCRE2_SUPPORT_JIT_SEALLOC OFF) ENDIF(${REQUIRED}) diff --git a/ChangeLog b/ChangeLog index 04a0623..94c7f03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -120,6 +120,9 @@ does). Patch by Carlo Marcelo Arenas Belon. 29. Check for the existence of memfd_create in both CMake and configure 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 ------------------------------ diff --git a/configure.ac b/configure.ac index 7e33807..214e46c 100644 --- a/configure.ac +++ b/configure.ac @@ -176,11 +176,18 @@ if test "$enable_jit" = "auto"; then echo checking for JIT support on this hardware... $enable_jit fi -# 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 (experimental)]), - , enable_jit_sealloc=no) +# Handle --enable-jit-sealloc (disabled by default and only experimental) +case $host_os in + linux* | netbsd*) + AC_ARG_ENABLE(jit-sealloc, + 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) AC_ARG_ENABLE(pcre2grep-jit, -- cgit v1.2.1