aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-12-31 17:15:11 +0000
committerGitHub <noreply@github.com>2020-12-31 17:15:11 +0000
commit53d713ae525dd1eef6169abe3ec7cf66af1f4ab8 (patch)
treef5127d7220eb1bb620653ba308490b8bbed18434
parenta94393193e8859bbdcea0d553e4a946bd5e69a1c (diff)
parentf5a86afd19b3c2feaf470eb001a636beb1d72947 (diff)
downloadrspamd-53d713ae525dd1eef6169abe3ec7cf66af1f4ab8.tar.gz
rspamd-53d713ae525dd1eef6169abe3ec7cf66af1f4ab8.zip
Merge pull request #3588 from a16bitsysop/hyperscan
[Feature] allow hyperscan for aarch64
-rw-r--r--cmake/Hyperscan.cmake5
-rw-r--r--src/hs_helper.c2
-rw-r--r--src/libserver/cfg_utils.c2
-rw-r--r--src/libserver/maps/map_helpers.c4
4 files changed, 7 insertions, 6 deletions
diff --git a/cmake/Hyperscan.cmake b/cmake/Hyperscan.cmake
index b8f83a3bb..664ce7312 100644
--- a/cmake/Hyperscan.cmake
+++ b/cmake/Hyperscan.cmake
@@ -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 ()
diff --git a/src/hs_helper.c b/src/hs_helper.c
index 1f915b01b..f4f00cf05 100644
--- a/src/hs_helper.c
+++ b/src/hs_helper.c
@@ -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);
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 05cc63c4f..987123cbb 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -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 "
diff --git a/src/libserver/maps/map_helpers.c b/src/libserver/maps/map_helpers.c
index 13a34201f..c2bfe1292 100644
--- a/src/libserver/maps/map_helpers.c
+++ b/src/libserver/maps/map_helpers.c
@@ -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
+}