summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Vaněk <arkamar@atlas.cz>2022-11-14 15:05:09 +0100
committerSam James <sam@gentoo.org>2022-11-15 00:56:19 +0000
commit1d2bf9e530d455d9d2e4b318d33c411ffb9e36f5 (patch)
treef12ef02d8b4324dafff7f03820936e309b4b17cb
parentsys-apps/ppc64-diag: add myself as a maintainer (diff)
downloadgentoo-1d2bf9e530d455d9d2e4b318d33c411ffb9e36f5.tar.gz
gentoo-1d2bf9e530d455d9d2e4b318d33c411ffb9e36f5.tar.bz2
gentoo-1d2bf9e530d455d9d2e4b318d33c411ffb9e36f5.zip
mail-filter/rspamd: fix page-alignment of .unser files
This revision applies patch taken from upstream [1] which fixes page-alignment issue of .unser files causing segfaults. The issue affects only those who already started rspamd-3.4. All .unser files will be automatically removed in postinstall phase for those who are updating from 3.4 to 3.4-r1. [1] https://github.com/rspamd/rspamd/issues/4329 Signed-off-by: Petr Vaněk <arkamar@atlas.cz> Closes: https://github.com/gentoo/gentoo/pull/28263 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--mail-filter/rspamd/files/rspamd-3.4-hyperscan-page-alignment.patch28
-rw-r--r--mail-filter/rspamd/rspamd-3.4-r1.ebuild (renamed from mail-filter/rspamd/rspamd-3.4.ebuild)13
2 files changed, 41 insertions, 0 deletions
diff --git a/mail-filter/rspamd/files/rspamd-3.4-hyperscan-page-alignment.patch b/mail-filter/rspamd/files/rspamd-3.4-hyperscan-page-alignment.patch
new file mode 100644
index 000000000000..913f1f7ecd4d
--- /dev/null
+++ b/mail-filter/rspamd/files/rspamd-3.4-hyperscan-page-alignment.patch
@@ -0,0 +1,28 @@
+Fix for hyperscan page alignment issues.
+
+Upstream-Issue: https://github.com/rspamd/rspamd/issues/4329
+
+diff --git a/src/libserver/hyperscan_tools.cxx b/src/libserver/hyperscan_tools.cxx
+index 6187208a9..96366067d 100644
+--- a/src/libserver/hyperscan_tools.cxx
++++ b/src/libserver/hyperscan_tools.cxx
+@@ -306,7 +306,15 @@ auto load_cached_hs_file(const char *fname, std::int64_t offset = 0) -> tl::expe
+ msg_debug_hyperscan_lambda("multipattern: create new database in %s; %Hz size",
+ tmpfile_pattern.data(), unserialized_size);
+ void *buf;
+- posix_memalign(&buf, 16, unserialized_size);
++#ifdef HAVE_GETPAGESIZE
++ auto page_size = getpagesize();
++#else
++ auto page_size = sysconf(_SC_PAGESIZE);
++#endif
++ if (page_size == -1) {
++ page_size = 4096;
++ }
++ posix_memalign(&buf, page_size, unserialized_size);
+ if (buf == nullptr) {
+ return tl::make_unexpected(error {"Cannot allocate memory", errno, error_category::CRITICAL });
+ }
+--
+2.37.4
+
diff --git a/mail-filter/rspamd/rspamd-3.4.ebuild b/mail-filter/rspamd/rspamd-3.4-r1.ebuild
index cb1d4e71df63..fc1664f05a6d 100644
--- a/mail-filter/rspamd/rspamd-3.4.ebuild
+++ b/mail-filter/rspamd/rspamd-3.4-r1.ebuild
@@ -71,6 +71,7 @@ PATCHES=(
"${FILESDIR}/${PN}-3.2-unbundle-lua.patch"
"${FILESDIR}/${PN}-2.5-unbundle-snowball.patch"
"${FILESDIR}/${PN}-3.3-remove-test-case.patch"
+ "${FILESDIR}/${PN}-3.4-hyperscan-page-alignment.patch"
)
src_prepare() {
@@ -133,4 +134,16 @@ src_install() {
pkg_postinst() {
tmpfiles_process "${PN}.conf"
+
+ for ver in ${REPLACING_VERSIONS}; do
+ if ver_test "${ver}" -eq "3.4"; then
+ elog "rspamd-3.4 is known to segfault when it is updated from older version due"
+ elog "to a page-alignment of hyperscan .unser files. The issue is patched in this"
+ elog "ebuild revision rspamd-3.4-r1. All possibly broken .unser files will be"
+ elog "automaticaly removed. See https://github.com/rspamd/rspamd/issues/4329 for"
+ elog "more information."
+
+ find "${EROOT}/var/lib/rspamd" -type f -name '*.unser' -delete
+ fi
+ done
}