1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
diff -Nurp a/cmake/Hyperscan.cmake b.hyperscan/cmake/Hyperscan.cmake
--- a/cmake/Hyperscan.cmake 2020-09-30 20:27:23.000000000 +0100
+++ b.hyperscan/cmake/Hyperscan.cmake 2020-12-28 15:58:12.603285789 +0000
@@ -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 -Nurp a/src/hs_helper.c b.hyperscan/src/hs_helper.c
--- a/src/hs_helper.c 2020-09-30 20:27:23.000000000 +0100
+++ b.hyperscan/src/hs_helper.c 2020-12-28 20:17:33.697849599 +0000
@@ -247,11 +247,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 -Nurp a/src/libserver/cfg_utils.c b.hyperscan/src/libserver/cfg_utils.c
--- a/src/libserver/cfg_utils.c 2020-09-30 20:27:23.000000000 +0100
+++ b.hyperscan/src/libserver/cfg_utils.c 2020-12-28 20:15:35.322542255 +0000
@@ -816,7 +816,7 @@ rspamd_config_post_load (struct rspamd_c
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 -Nurp a/src/libserver/maps/map_helpers.c b.hyperscan/src/libserver/maps/map_helpers.c
--- a/src/libserver/maps/map_helpers.c 2020-09-30 20:27:23.000000000 +0100
+++ b.hyperscan/src/libserver/maps/map_helpers.c 2020-12-28 20:19:16.289253951 +0000
@@ -942,11 +942,13 @@ rspamd_re_map_finalize (struct rspamd_re
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");
@@ -1572,4 +1574,4 @@ rspamd_match_cdb_map (struct rspamd_cdb_
}
return NULL;
-}
\ No newline at end of file
+}
|