Marcus Rückert 2021-11-03 13:47:05 +00:00 committed by Git OBS Bridge
parent d98b7898fe
commit 70d2825ec3
7 changed files with 80 additions and 342 deletions

View File

@ -1,178 +0,0 @@
From 099d5414e97244ec44cf46b14cd176b3a3dc52e3 Mon Sep 17 00:00:00 2001
From: Viktor Kirilov <vik.kirilov@gmail.com>
Date: Sun, 21 Mar 2021 18:12:59 +0200
Subject: [PATCH] fixed #473 - SIGSTKSZ is no longer a constant in glibc 2.34+
so now the alternative stack memory is always dinamically allocated (even for
older glibc versions where SIGSTKSZ is still a constant)
---
doctest/doctest.h | 31 +++++++++++++++++++++++++------
doctest/parts/doctest.cpp | 31 +++++++++++++++++++++++++------
2 files changed, 50 insertions(+), 12 deletions(-)
diff --git a/contrib/doctest/doctest/doctest.h b/doctest/doctest.h
index 88917eff..3ec64708 100644
--- a/contrib/doctest/doctest/doctest.h
+++ b/contrib/doctest/doctest/doctest.h
@@ -4171,7 +4171,9 @@ namespace {
#if !defined(DOCTEST_CONFIG_POSIX_SIGNALS) && !defined(DOCTEST_CONFIG_WINDOWS_SEH)
struct FatalConditionHandler
{
- void reset() {}
+ static void reset() {}
+ static void allocateAltStackMem() {}
+ static void freeAltStackMem() {}
};
#else // DOCTEST_CONFIG_POSIX_SIGNALS || DOCTEST_CONFIG_WINDOWS_SEH
@@ -4224,6 +4226,9 @@ namespace {
std::exit(EXIT_FAILURE);
}
+ static void allocateAltStackMem() {}
+ static void freeAltStackMem() {}
+
FatalConditionHandler() {
isSet = true;
// 32k seems enough for doctest to handle stack overflow,
@@ -4341,7 +4346,8 @@ namespace {
static bool isSet;
static struct sigaction oldSigActions[DOCTEST_COUNTOF(signalDefs)];
static stack_t oldSigStack;
- static char altStackMem[4 * SIGSTKSZ];
+ static size_t altStackSize;
+ static char* altStackMem;
static void handleSignal(int sig) {
const char* name = "<unknown signal>";
@@ -4357,11 +4363,19 @@ namespace {
raise(sig);
}
+ static void allocateAltStackMem() {
+ altStackMem = new char[altStackSize];
+ }
+
+ static void freeAltStackMem() {
+ delete[] altStackMem;
+ }
+
FatalConditionHandler() {
isSet = true;
stack_t sigStack;
sigStack.ss_sp = altStackMem;
- sigStack.ss_size = sizeof(altStackMem);
+ sigStack.ss_size = altStackSize;
sigStack.ss_flags = 0;
sigaltstack(&sigStack, &oldSigStack);
struct sigaction sa = {};
@@ -4386,10 +4400,11 @@ namespace {
}
};
- bool FatalConditionHandler::isSet = false;
+ bool FatalConditionHandler::isSet = false;
struct sigaction FatalConditionHandler::oldSigActions[DOCTEST_COUNTOF(signalDefs)] = {};
- stack_t FatalConditionHandler::oldSigStack = {};
- char FatalConditionHandler::altStackMem[] = {};
+ stack_t FatalConditionHandler::oldSigStack = {};
+ size_t FatalConditionHandler::altStackSize = 4 * SIGSTKSZ;
+ char* FatalConditionHandler::altStackMem = nullptr;
#endif // DOCTEST_PLATFORM_WINDOWS
#endif // DOCTEST_CONFIG_POSIX_SIGNALS || DOCTEST_CONFIG_WINDOWS_SEH
@@ -6282,7 +6297,11 @@ int Context::run() {
p->cout = &fstr;
}
+ FatalConditionHandler::allocateAltStackMem();
+
auto cleanup_and_return = [&]() {
+ FatalConditionHandler::freeAltStackMem();
+
if(fstr.is_open())
fstr.close();
diff --git a/contrib/doctest/doctest/parts/doctest.cpp b/doctest/parts/doctest.cpp
index 2b334374..8c09a4f3 100644
--- a/contrib/doctest/doctest/parts/doctest.cpp
+++ b/contrib/doctest/doctest/parts/doctest.cpp
@@ -1461,7 +1461,9 @@ namespace {
#if !defined(DOCTEST_CONFIG_POSIX_SIGNALS) && !defined(DOCTEST_CONFIG_WINDOWS_SEH)
struct FatalConditionHandler
{
- void reset() {}
+ static void reset() {}
+ static void allocateAltStackMem() {}
+ static void freeAltStackMem() {}
};
#else // DOCTEST_CONFIG_POSIX_SIGNALS || DOCTEST_CONFIG_WINDOWS_SEH
@@ -1514,6 +1516,9 @@ namespace {
std::exit(EXIT_FAILURE);
}
+ static void allocateAltStackMem() {}
+ static void freeAltStackMem() {}
+
FatalConditionHandler() {
isSet = true;
// 32k seems enough for doctest to handle stack overflow,
@@ -1631,7 +1636,8 @@ namespace {
static bool isSet;
static struct sigaction oldSigActions[DOCTEST_COUNTOF(signalDefs)];
static stack_t oldSigStack;
- static char altStackMem[4 * SIGSTKSZ];
+ static size_t altStackSize;
+ static char* altStackMem;
static void handleSignal(int sig) {
const char* name = "<unknown signal>";
@@ -1647,11 +1653,19 @@ namespace {
raise(sig);
}
+ static void allocateAltStackMem() {
+ altStackMem = new char[altStackSize];
+ }
+
+ static void freeAltStackMem() {
+ delete[] altStackMem;
+ }
+
FatalConditionHandler() {
isSet = true;
stack_t sigStack;
sigStack.ss_sp = altStackMem;
- sigStack.ss_size = sizeof(altStackMem);
+ sigStack.ss_size = altStackSize;
sigStack.ss_flags = 0;
sigaltstack(&sigStack, &oldSigStack);
struct sigaction sa = {};
@@ -1676,10 +1690,11 @@ namespace {
}
};
- bool FatalConditionHandler::isSet = false;
+ bool FatalConditionHandler::isSet = false;
struct sigaction FatalConditionHandler::oldSigActions[DOCTEST_COUNTOF(signalDefs)] = {};
- stack_t FatalConditionHandler::oldSigStack = {};
- char FatalConditionHandler::altStackMem[] = {};
+ stack_t FatalConditionHandler::oldSigStack = {};
+ size_t FatalConditionHandler::altStackSize = 4 * SIGSTKSZ;
+ char* FatalConditionHandler::altStackMem = nullptr;
#endif // DOCTEST_PLATFORM_WINDOWS
#endif // DOCTEST_CONFIG_POSIX_SIGNALS || DOCTEST_CONFIG_WINDOWS_SEH
@@ -3572,7 +3587,11 @@ int Context::run() {
p->cout = &fstr;
}
+ FatalConditionHandler::allocateAltStackMem();
+
auto cleanup_and_return = [&]() {
+ FatalConditionHandler::freeAltStackMem();
+
if(fstr.is_open())
fstr.close();

View File

@ -1,45 +0,0 @@
From 309bb213cffb23e6bee98157b53cf5db31f97ef9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Van=C4=9Bk?= <arkamar@atlas.cz>
Date: Sat, 21 Aug 2021 11:24:35 +0200
Subject: [PATCH] Add SYSTEM_FMT cmake option
This gives packagers option to use system version of fmt rather than
bundled one. It is disabled by default.
---
CMakeLists.txt | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2c38758f3..fc4175677 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,6 +58,7 @@ OPTION(ENABLE_LIBUNWIND "Use libunwind to print crash traces [default: OFF]"
OPTION(ENABLE_LUA_TRACE "Trace all Lua C API invocations [default: OFF]" OFF)
OPTION(ENABLE_LUA_REPL "Enables Lua repl (requires C++11 compiler) [default: ON]" ON)
OPTION(SYSTEM_ZSTD "Use system zstd instead of bundled one [default: OFF]" OFF)
+OPTION(SYSTEM_FMT "Use system fmt instead of bundled one [defalut: OFF]" OFF)
############################# INCLUDE SECTION #############################################
@@ -117,7 +118,6 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/"
"${CMAKE_SOURCE_DIR}/contrib/lc-btrie"
"${CMAKE_SOURCE_DIR}/contrib/lua-lpeg"
"${CMAKE_SOURCE_DIR}/contrib/frozen/include"
- "${CMAKE_SOURCE_DIR}/contrib/fmt/include"
"${CMAKE_SOURCE_DIR}/contrib/doctest"
"${CMAKE_SOURCE_DIR}/contrib/fu2/include"
"${CMAKE_BINARY_DIR}/src" #Stored in the binary dir
@@ -650,7 +650,12 @@ ADD_SUBDIRECTORY(contrib/libev)
ADD_SUBDIRECTORY(contrib/kann)
ADD_SUBDIRECTORY(contrib/fastutf8)
ADD_SUBDIRECTORY(contrib/google-ced)
-ADD_SUBDIRECTORY(contrib/fmt)
+IF(SYSTEM_FMT MATCHES "OFF")
+ ADD_SUBDIRECTORY(contrib/fmt)
+ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/contrib/fmt/include")
+ELSE()
+ find_package(fmt)
+ENDIF()
ADD_SUBDIRECTORY(contrib/doctest)
IF (NOT WITH_LUAJIT)

View File

@ -1,112 +0,0 @@
From cdedeb9f4f3168293a1efe0347da753b6f812a5e Mon Sep 17 00:00:00 2001
From: "Tomohiro \"Tomo-p\" KATO" <tomop@teamgedoh.net>
Date: Tue, 16 Feb 2021 00:29:59 +0900
Subject: [PATCH] fix compatibility with lua-5.4
---
src/libserver/cfg_rcl.c | 3 +++
src/libstat/stat_config.c | 3 +++
src/lua/lua_thread_pool.cxx | 5 ++++-
src/plugins/fuzzy_check.c | 3 +++
src/plugins/lua/hfilter.lua | 4 ++--
src/plugins/lua/milter_headers.lua | 2 +-
6 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index b19a1dedc2..d91ebf3aee 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -3571,6 +3571,9 @@ rspamd_rcl_maybe_apply_lua_transform (struct rspamd_config *cfg)
return;
}
else {
+#if LUA_VERSION_NUM >= 504
+ lua_settop(L, -2);
+#endif
if (lua_type (L, -1) != LUA_TFUNCTION) {
msg_warn_config ("lua script must return "
"function and not %s",
diff --git a/src/libstat/stat_config.c b/src/libstat/stat_config.c
index 17d0fdcc70..0c9ae2ed08 100644
--- a/src/libstat/stat_config.c
+++ b/src/libstat/stat_config.c
@@ -172,6 +172,9 @@ rspamd_stat_init (struct rspamd_config *cfg, struct ev_loop *ev_base)
lua_tostring (L, -1));
}
else {
+#if LUA_VERSION_NUM >= 504
+ lua_settop(L, -2);
+#endif
if (lua_type (L, -1) != LUA_TTABLE) {
msg_err_config ("lua stat must return "
"table and not %s",
diff --git a/src/lua/lua_thread_pool.cxx b/src/lua/lua_thread_pool.cxx
index 62da49482e..dc6c15163a 100644
--- a/src/lua/lua_thread_pool.cxx
+++ b/src/lua/lua_thread_pool.cxx
@@ -261,12 +261,15 @@ lua_thread_pool_restore_callback_full(struct lua_callback_state *cbs,
static gint
lua_do_resume_full(lua_State *L, gint narg, const gchar *loc) {
+#if LUA_VERSION_NUM >= 504
+ int nres;
+#endif
msg_debug_lua_threads ("%s: lua_do_resume_full", loc);
#if LUA_VERSION_NUM < 502
return lua_resume(L, narg);
#else
#if LUA_VERSION_NUM >= 504
- return lua_resume (L, NULL, narg, NULL);
+ return lua_resume (L, NULL, narg, &nres);
#else
return lua_resume (L, NULL, narg);
#endif
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c
index 722daeacbd..ea8bcf7567 100644
--- a/src/plugins/fuzzy_check.c
+++ b/src/plugins/fuzzy_check.c
@@ -1006,6 +1006,9 @@ fuzzy_check_module_config (struct rspamd_config *cfg, bool validate)
fuzzy_module_ctx->enabled = FALSE;
}
else {
+#if LUA_VERSION_NUM >= 504
+ lua_settop(L, -2);
+#endif
if (lua_type (L, -1) != LUA_TTABLE) {
msg_err_config ("lua fuzzy must return "
"table and not %s",
diff --git a/src/plugins/lua/hfilter.lua b/src/plugins/lua/hfilter.lua
index 9179f63b80..3889eaa5bb 100644
--- a/src/plugins/lua/hfilter.lua
+++ b/src/plugins/lua/hfilter.lua
@@ -357,7 +357,7 @@ local function hfilter_callback(task)
local lines = html_text_part:get_lines_count()
if lines > 0 and lines < 2 then
task:insert_result('HFILTER_URL_ONELINE', 1.00,
- string.format('html:%d:%d', sc, lines))
+ string.format('html:%d:%d', math.floor(sc), lines))
end
end
end
@@ -376,7 +376,7 @@ local function hfilter_callback(task)
local lines = plain_text_part:get_lines_count()
if lines > 0 and lines < 2 then
task:insert_result('HFILTER_URL_ONELINE', 1.00,
- string.format('plain:%d:%d', rel, lines))
+ string.format('plain:%d:%d', math.floor(rel), lines))
end
end
end
diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua
index 0dfaa9e030..1b58cee860 100644
--- a/src/plugins/lua/milter_headers.lua
+++ b/src/plugins/lua/milter_headers.lua
@@ -383,7 +383,7 @@ local function milter_headers(task)
if local_mod.remove then
remove[local_mod.header] = local_mod.remove
end
- add[local_mod.header] = string.rep(local_mod.char, score)
+ add[local_mod.header] = string.rep(local_mod.char, math.floor(score))
end
local function spam_header (class, name, value, remove_v)

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:86600f6b6690395f42fd2136b708b0410e3c17328a9e05d7034e80a2dc0aaf12
size 5535659

3
rspamd-3.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7f37514f16f4d194cacaef9f54eeead73ae2c208bc4439fd7f1de4e220f9db30
size 5566920

View File

@ -1,3 +1,78 @@
-------------------------------------------------------------------
Wed Nov 3 13:39:29 UTC 2021 - Marcus Rueckert <mrueckert@suse.de>
- Update to 3.1
- [Feature] Add junk_threshold for autolearn
- [Feature] Add neural test command
- [Feature] Antivirus: Allow to set fake eicar patterns for
testing AV engines
- [Feature] Lua_cdb: Add cdb building interface
- [Feature] Ratelimit: Add per bucket configurations
- [Feature] S3: Allow to store structured data in messagepack
- [Fix] Add concept of uncancellable events to prevent
use-after-free
- [Fix] Add temporary guard to prevent linked list exploitation
- [Fix] Allow spaces in DKIM key records
- [Fix] Another rework of the ucl hashing
- [Fix] Another try to fix references safety
- [Fix] Another try to fix rspamd_text passing in the selectors
- [Fix] Avoid copy for received structure as it has raw C
pointers
- [Fix] Avoid dangling reference
- [Fix] Correctly check numeric URLs in URL DNS lists
- [Fix] Delete the correct pointer type
- [Fix] Dmarc: Always lowercase domain
- [Fix] Fix compilation of the hyperscan databases with errors
- [Fix] Fix hash table lookup
- [Fix] Fix http message flag shift
- [Fix] Fix parsing of the from_hostname when it is an IP address
- [Fix] Fix parsing of the unquoted attributes in HTML
- [Fix] Fix passing of rspamd_text in selectors pipelines
- [Fix] Fix rubbish QP sequences decoding
- [Fix] Fix some complicated case with the closing tags parsing
- [Fix] Fix the case when l tag is too small
- [Fix] Html: Fix the case where only bgcolor is explicitly set
- [Fix] Libucl: Fix deletion from ucl objects
- [Fix] Namespace and add metadata for OpenMetrics, fix
interleaving
- [Fix] Plug memory leak in http settings reload
- [Fix] Preserve SPF top record in the mempool variable
- [Fix] Remove aarch64 GC64 workaround
- [Fix] Remove bogus G_LIKELY
- [Fix] Spf: Do not parse non TXT DNS replies as TXT replies
- [Fix] Try to use on_connect/on_disconnect callbacks to handle
internal Redis failures
- [Fix] buffer overflow in rspamc counters
- [Fix] fix static building
- [Fix] lua_scanners - message_min_words logic
- [Fix] src/lua/lua_mimepart.c: fix null dereference
- [Project] Add constant iterators
- [Project] Add helper library to handle mime strings in a more
safe matter
- [Project] Add preliminary support of CDB bayes dump
- [Project] Add trim operations
- [Project] Allow mempool allocated mime strings
- [Project] Cdb: Finish backend implementation
- [Project] Cdb: Fix configuration load
- [Project] Cdb: Use shared data between cdb statfiles
- [Project] Cdb: continue statistics backend implementation
- [Project] Finish received headers rework part
- [Project] Move C++ specific declarations to C++ header
- [Project] Rework received headers parsing to C++
- [Project] Start using of the new received structure
- [Project] Start work on cdb backend
- [Rework] Further rework of the redis pool
- [Rework] Redis_pool: fix issues found
- [Rework] Rework learn and add classify condition
- [Rework] Save invisible content to a separate buffer
- [Rework] Start rewriting of the redis pool logic
- [Rules] Improve zero font rule
Full Changelog: https://github.com/rspamd/rspamd/compare/3.0...3.1
- drop patches included in this update:
https://github.com/onqtam/doctest/commit/099d5414e97244ec44cf46b14cd176b3a3dc52e3.patch
https://github.com/rspamd/rspamd/commit/cdedeb9f4.patch
https://github.com/rspamd/rspamd/commit/309bb213cf.patch
-------------------------------------------------------------------
Thu Sep 30 17:58:39 UTC 2021 - Marcus Rueckert <mrueckert@suse.de>

View File

@ -57,7 +57,7 @@
%endif
Name: rspamd
Version: 3.0
Version: 3.1
Release: 0
Summary: Spam filtering system
License: Apache-2.0
@ -67,9 +67,6 @@ Source0: https://github.com/rspamd/rspamd/archive/%{version}/%{name}-%{ve
Source1: usr.bin.rspamd
Patch0: rspamd-conf.patch
Patch1: rspamd-after-redis-target.patch
Patch2: https://github.com/rspamd/rspamd/commit/309bb213cf.patch
Patch3: https://github.com/rspamd/rspamd/commit/cdedeb9f4.patch
Patch4: https://github.com/onqtam/doctest/commit/099d5414e97244ec44cf46b14cd176b3a3dc52e3.patch
# PATCH-FIX-UPSTREAM - https://github.com/rspamd/rspamd/issues/3656
%if !0%{?is_opensuse}
# because 80-check-malware-scan-clamav triggered in SLE-15-SP2
@ -585,6 +582,7 @@ echo "# Site-specific additions and overrides for 'usr.bin.rspamd'" > %{buildroo
%{_datadir}/rspamd/lualib/rspamadm/statistics_dump.lua
%{_datadir}/rspamd/lualib/rspamadm/template.lua
%{_datadir}/rspamd/lualib/rspamadm/vault.lua
%{_datadir}/rspamd/lualib/rspamadm/neural_test.lua
%dir %{_datadir}/rspamd/lualib/plugins
%{_datadir}/rspamd/lualib/plugins/dmarc.lua