]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
pcre2: introduce as a new depdendency
authorPhilippe Antoine <contact@catenacyber.fr>
Tue, 13 Apr 2021 12:01:49 +0000 (14:01 +0200)
committerPhilippe Antoine <contact@catenacyber.fr>
Tue, 28 Sep 2021 15:46:19 +0000 (17:46 +0200)
.github/workflows/builds.yml
.github/workflows/commits.yml
.github/workflows/formatting.yml
configure.ac

index 0bce31e435c4a38aec2a962bca67b221c90c2020..377bfdfba09212e16421c1ac38ada91936abc378 100644 (file)
@@ -209,6 +209,7 @@ jobs:
                 make \
                 nss-devel \
                 pcre-devel \
+                pcre2-devel \
                 pkgconfig \
                 python3-devel \
                 python3-sphinx \
@@ -284,6 +285,7 @@ jobs:
                 make \
                 nss-devel \
                 pcre-devel \
+                pcre2-devel \
                 pkgconfig \
                 python36-PyYAML \
                 rust \
@@ -360,6 +362,7 @@ jobs:
                 make \
                 nss-softokn-devel \
                 pcre-devel \
+                pcre2-devel \
                 pkgconfig \
                 python3-yaml \
                 sudo \
@@ -446,6 +449,7 @@ jobs:
                 make \
                 nss-softokn-devel \
                 pcre-devel \
+                pcre2-devel \
                 pkgconfig \
                 python3-yaml \
                 sudo \
@@ -518,6 +522,7 @@ jobs:
                 make \
                 nss-softokn-devel \
                 pcre-devel \
+                pcre2-devel \
                 pkgconfig \
                 python3-yaml \
                 sudo \
@@ -556,6 +561,7 @@ jobs:
           apt -y install \
                 libpcre3 \
                 libpcre3-dev \
+                libpcre2-dev \
                 build-essential \
                 autoconf \
                 automake \
@@ -633,6 +639,7 @@ jobs:
           apt -y install \
                 libpcre3 \
                 libpcre3-dev \
+                libpcre2-dev \
                 build-essential \
                 autoconf \
                 automake \
@@ -706,6 +713,7 @@ jobs:
           apt -y install \
                 libpcre3 \
                 libpcre3-dev \
+                libpcre2-dev \
                 build-essential \
                 autoconf \
                 automake \
@@ -807,6 +815,7 @@ jobs:
                 libpython2.7 \
                 libpcre3 \
                 libpcre3-dev \
+                libpcre2-dev \
                 make \
                 parallel \
                 python3-yaml \
@@ -882,6 +891,7 @@ jobs:
                 libpython2.7 \
                 libpcre3 \
                 libpcre3-dev \
+                libpcre2-dev \
                 make \
                 python3-yaml \
                 software-properties-common \
@@ -922,6 +932,7 @@ jobs:
           apt -y install \
                 libpcre3 \
                 libpcre3-dev \
+                libpcre2-dev \
                 build-essential \
                 autoconf \
                 automake \
@@ -994,6 +1005,7 @@ jobs:
           apt -y install \
                 libpcre3 \
                 libpcre3-dev \
+                libpcre2-dev \
                 build-essential \
                 autoconf \
                 automake \
@@ -1091,6 +1103,7 @@ jobs:
                 afl-clang \
                 libpcre3 \
                 libpcre3-dev \
+                libpcre2-dev \
                 build-essential \
                 autoconf \
                 automake \
@@ -1160,6 +1173,7 @@ jobs:
                 libnfnetlink0 \
                 libpcre3 \
                 libpcre3-dev \
+                libpcre2-dev \
                 libpcap-dev \
                 libyaml-0-2 \
                 libyaml-dev \
@@ -1213,6 +1227,7 @@ jobs:
                 libpcre3 \
                 libpcre3-dbg \
                 libpcre3-dev \
+                libpcre2-dev \
                 libpcap-dev   \
                 libnet1-dev \
                 libyaml-0-2 \
@@ -1279,6 +1294,7 @@ jobs:
                 libpcre3 \
                 libpcre3-dbg \
                 libpcre3-dev \
+                libpcre2-dev \
                 libpcap-dev   \
                 libnet1-dev \
                 libyaml-0-2 \
@@ -1383,7 +1399,7 @@ jobs:
         with:
           msystem: MINGW64
           update: true
-          install: git mingw-w64-x86_64-toolchain automake1.16 automake-wrapper autoconf libtool libyaml-devel pcre-devel jansson-devel make mingw-w64-x86_64-libyaml mingw-w64-x86_64-pcre mingw-w64-x86_64-rust mingw-w64-x86_64-jansson unzip p7zip python-setuptools mingw-w64-x86_64-python-yaml mingw-w64-x86_64-jq mingw-w64-x86_64-libxml2
+          install: git mingw-w64-x86_64-toolchain automake1.16 automake-wrapper autoconf libtool libyaml-devel pcre-devel pcre2-devel jansson-devel make mingw-w64-x86_64-libyaml mingw-w64-x86_64-pcre mingw-w64-x86_64-pcre2 mingw-w64-x86_64-rust mingw-w64-x86_64-jansson unzip p7zip python-setuptools mingw-w64-x86_64-python-yaml mingw-w64-x86_64-jq mingw-w64-x86_64-libxml2
       # hack: install our own cbindgen system wide as we can't get the
       # preinstalled one to be picked up by configure
       - name: cbindgen
index 17d80f63150b919a24712aa5c15ecc138a4a4b10..6386e453445f62c000bd2fbf186b1c898ec68e68 100644 (file)
@@ -21,6 +21,7 @@ jobs:
           apt -y install \
                 libpcre3 \
                 libpcre3-dev \
+                libpcre2-dev \
                 build-essential \
                 autoconf \
                 automake \
index fbf29f665acec02930d1046460d3d9c095ecdcd7..94d633a01399c5f7c0cbfeead7f013e3dc110a4f 100644 (file)
@@ -31,6 +31,7 @@ jobs:
           apt -y install \
                 libpcre3 \
                 libpcre3-dev \
+                libpcre2-dev \
                 build-essential \
                 autoconf \
                 automake \
index 5c5781feec66d23bf469a283bcdca176f1de412e..ef3dc0917ceb3e60c0cd11d27261f7c7220f738b 100644 (file)
         exit 1
     fi
 
+    PCRE2=""
+    AC_CHECK_LIB(pcre2-8, pcre2_compile_8,,PCRE2="no")
+    if test "$PCRE2" = "no"; then
+        echo
+        echo "   ERROR!  pcre2 library not found, go get it"
+        echo "   from www.pcre.org. Or from packages:"
+        echo "   Debian/Ubuntu: apt install libpcre2-dev"
+        echo "   Fedora: dnf install pcre2-devel"
+        echo "   CentOS/RHEL: yum install pcre2-devel"
+        echo
+        exit 1
+    fi
+
+    AC_DEFINE([PCRE2_CODE_UNIT_WIDTH], [8], [Pcre code unit width is 8 bits])
+    AC_MSG_CHECKING(for PCRE2 JIT support)
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pcre2.h> ]],
+        [[
+        int jit = 0;
+        pcre2_config(PCRE2_CONFIG_JIT, &jit);
+        ]])],[ pcre2_jit_available=yes ],[ pcre2_jit_available=no ]
+        )
+    if test "x$pcre2_jit_available" = "xyes"; then
+        AC_MSG_RESULT(yes)
+        AC_DEFINE([PCRE2_HAVE_JIT], [1], [Pcre2 with JIT compiler support enabled])
+    else
+        AC_MSG_RESULT(no)
+    fi
+
     # libpcre 8.35 (especially on debian) has a known issue that results in segfaults
     # see https://redmine.openinfosecfoundation.org/issues/1693
     if test "$with_libpcre_libraries" = "no"; then
     fi
     LIBS="${TMPLIBS}"
 
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pcre.h> ]],
-        [[ int eo = 0; eo |= PCRE_EXTRA_MATCH_LIMIT_RECURSION; ]])],
-        [ pcre_match_limit_recursion_available=yes ],[:]
-    )
-    if test "$pcre_match_limit_recursion_available" != "yes"; then
-        echo
-        echo "   Warning! pcre extra opt PCRE_EXTRA_MATCH_LIMIT_RECURSION not found"
-        echo "   This could lead to potential DoS please upgrade to pcre >= 6.5"
-        echo "   from www.pcre.org."
-        echo "   Continuing for now...."
-        echo
-        AC_DEFINE([NO_PCRE_MATCH_RLIMIT],[1],[Pcre PCRE_EXTRA_MATCH_LIMIT_RECURSION not available])
-    fi
-
     TMPCFLAGS="${CFLAGS}"
     CFLAGS="-O0 -g -Werror -Wall"
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pcre.h> ]],
     )
     CFLAGS="${TMPCFLAGS}"
 
-    #enable support for PCRE-jit available since pcre-8.20
-    AC_MSG_CHECKING(for PCRE JIT support)
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pcre.h> ]],
-        [[
-        int jit = 0;
-        pcre_config(PCRE_CONFIG_JIT, &jit);
-        ]])],[ pcre_jit_available=yes ],[ pcre_jit_available=no ]
-        )
-
-    case $host in
-        *powerpc64*)
-            PKG_CHECK_MODULES(LIBPCREVERSION, [libpcre = 8.39],[libpcre_ppc64_buggy_found1="yes"],[libprce_ppc64_buggy_found1="no"])
-            PKG_CHECK_MODULES(LIBPCREVERSION, [libpcre = 8.40],[libpcre_ppc64_buggy_found2="yes"],[libprce_ppc64_buggy_found2="no"])
-
-            if test "$libprce_ppc64_buggy_found1" = "yes" || test "$libprce_ppc64_buggy_found2"; then
-                # on powerpc64, both gcc and clang lead to SIGILL in
-                # unittests when jit is enabled.
-                pcre_jit_available="no, pcre 8.39/8.40 jit disabled for powerpc64"
-            fi
-            # hack: use libatomic
-            LIBS="${LIBS} -latomic"
-        ;;
-        *)
-            # bug 1693, libpcre 8.35 is broken and debian jessie is still using that
-            if test "$libpcre_buggy_found" = "yes"; then
-                pcre_jit_available="no, libpcre 8.35 blacklisted"
-            fi
-        ;;
-    esac
-
-    if test "x$pcre_jit_available" = "xyes"; then
-       AC_MSG_RESULT(yes)
-       AC_DEFINE([PCRE_HAVE_JIT], [1], [Pcre with JIT compiler support enabled])
-
-       AC_MSG_CHECKING(for PCRE JIT support usability)
-       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pcre.h> ]],
-           [[
-           const char *error;
-           int err_offset;
-           pcre *re = pcre_compile("(a|b|c|d)",0, &error, &err_offset,NULL);
-           pcre_extra *extra = pcre_study(re, PCRE_STUDY_JIT_COMPILE, &error);
-           if (extra == NULL)
-               exit(EXIT_FAILURE);
-           int jit = 0;
-           int ret = pcre_fullinfo(re, extra, PCRE_INFO_JIT, &jit);
-           if (ret != 0 || jit != 1)
-               exit(EXIT_FAILURE);
-           exit(EXIT_SUCCESS);
-           ]])],[ pcre_jit_works=yes ],[:]
-       )
-       if test "x$pcre_jit_works" != "xyes"; then
-           AC_MSG_RESULT(no)
-           echo
-           echo "   PCRE JIT support detection worked but testing it failed"
-           echo "   something odd is going on, please file a bug report."
-           echo
-           exit 1
-       else
-           AC_MSG_RESULT(yes)
-       fi
-    else
-        AC_MSG_RESULT(no)
-    fi
-
-    if test "x$pcre_jit_works" = "xyes"; then
-
-       AC_MSG_CHECKING(for PCRE JIT exec availability)
-       AC_LINK_IFELSE(
-           [AC_LANG_PROGRAM(
-               [
-                  #include <pcre.h>
-                  #include <string.h>
-               ],
-               [
-                   const char *error;
-                   int err_offset;
-                   pcre *re = pcre_compile("(a|b|c|d)", 0, &error, &err_offset,NULL);
-                   pcre_extra *study = pcre_study(re, PCRE_STUDY_JIT_COMPILE, &error);
-                   if (study == NULL)
-                       exit(EXIT_FAILURE);
-                   pcre_jit_stack *stack = pcre_jit_stack_alloc(32*1024,40*1024);
-                   if (stack == 0)
-                       exit(EXIT_FAILURE);
-                   int ret = pcre_jit_exec(re, study, "apple", 5, 0, 0, NULL, 0, stack);
-                   exit(ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
-               ])],
-           [pcre_jit_exec_available="yes" ],
-           [pcre_jit_exec_available="no" ])
-       if test "x$pcre_jit_exec_available" != "xyes"; then
-           AC_MSG_RESULT(no)
-       else
-           AC_MSG_RESULT(yes)
-           AC_DEFINE([PCRE_HAVE_JIT_EXEC], [1], [PCRE with JIT compiler support enabled supporting pcre_jit_exec])
-       fi
-    else
-        AC_MSG_RESULT(no)
-    fi
-
   # libhs
     enable_hyperscan="no"