]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] allow hyperscan for aarch64 3588/head
authorDuncan Bellamy <dunk@denkimushi.com>
Sun, 27 Dec 2020 22:36:02 +0000 (22:36 +0000)
committerDuncan Bellamy <dunk@denkimushi.com>
Mon, 28 Dec 2020 23:02:57 +0000 (23:02 +0000)
cmake/Hyperscan.cmake
src/hs_helper.c
src/libserver/cfg_utils.c
src/libserver/maps/map_helpers.c

index b8f83a3bb3ee98d12097d95e6df33cb1fa8363ae..664ce7312dc9861afac3ff9b35c7a8ffa1d2b5d7 100644 (file)
@@ -1,9 +1,6 @@
 option (ENABLE_HYPERSCAN    "Enable hyperscan for fast regexp processing [default: OFF]" OFF)
 
 if (ENABLE_HYPERSCAN MATCHES "ON")
-    if (NOT ("${ARCH}" STREQUAL "x86_64" OR "${ARCH}" STREQUAL "i386"))
-        MESSAGE(FATAL_ERROR "Hyperscan is supported only on x86_64/i386 architectures")
-    endif ()
     ProcessPackage (HYPERSCAN LIBRARY hs INCLUDE hs.h INCLUDE_SUFFIXES
             hs include/hs
             ROOT ${HYPERSCAN_ROOT_DIR} MODULES libhs)
@@ -16,4 +13,4 @@ if (ENABLE_HYPERSCAN MATCHES "ON")
             set (USE_CXX_LINKER 1)
         endif ()
     endif ()
-endif ()
\ No newline at end of file
+endif ()
index 1f915b01bc7c6e409bd8d37c6d0d1585eb949e34..f4f00cf0540f3fd650cb95bd151a69a811f99042 100644 (file)
@@ -254,11 +254,13 @@ static gboolean
 rspamd_rs_compile (struct hs_helper_ctx *ctx, struct rspamd_worker *worker,
                gboolean forced)
 {
+#ifndef __aarch64__
        if (!(ctx->cfg->libs_ctx->crypto_ctx->cpu_config & CPUID_SSSE3)) {
                msg_warn ("CPU doesn't have SSSE3 instructions set "
                                "required for hyperscan, disable hyperscan compilation");
                return FALSE;
        }
+#endif
 
        if (!rspamd_hs_helper_cleanup_dir (ctx, forced)) {
                msg_warn ("cannot cleanup cache dir '%s'", ctx->hs_dir);
index 05cc63c4f3dc8b1274184af27ff67f3b18b97158..987123cbb3f42e92ef17ba713c60dc4c16496fb8 100644 (file)
@@ -816,7 +816,7 @@ rspamd_config_post_load (struct rspamd_config *cfg,
        rspamd_regexp_library_init (cfg);
        rspamd_multipattern_library_init (cfg->hs_cache_dir);
 
-#ifdef WITH_HYPERSCAN
+#if defined(WITH_HYPERSCAN) && !defined(__aarch64__)
        if (!cfg->disable_hyperscan) {
                if (!(cfg->libs_ctx->crypto_ctx->cpu_config & CPUID_SSSE3)) {
                        msg_warn_config ("CPU doesn't have SSSE3 instructions set "
index 13a34201f8c78d809a4b31fc501b0e2d0cfe8cb0..c2bfe1292834acf7f55edce015fbb49ba712bc87 100644 (file)
@@ -1280,11 +1280,13 @@ rspamd_re_map_finalize (struct rspamd_regexp_map_helper *re_map)
 
        map = re_map->map;
 
+#ifndef __aarch64__
        if (!(map->cfg->libs_ctx->crypto_ctx->cpu_config & CPUID_SSSE3)) {
                msg_info_map ("disable hyperscan for map %s, ssse3 instructons are not supported by CPU",
                                map->name);
                return;
        }
+#endif
 
        if (hs_populate_platform (&plt) != HS_SUCCESS) {
                msg_err_map ("cannot populate hyperscan platform");
@@ -1940,4 +1942,4 @@ rspamd_match_cdb_map (struct rspamd_cdb_map_helper *map,
        }
 
        return NULL;
-}
\ No newline at end of file
+}