public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: mail-filter/rspamd/, mail-filter/rspamd/files/
Date: Tue, 15 Nov 2022 00:56:39 +0000 (UTC)	[thread overview]
Message-ID: <1668473779.1d2bf9e530d455d9d2e4b318d33c411ffb9e36f5.sam@gentoo> (raw)

commit:     1d2bf9e530d455d9d2e4b318d33c411ffb9e36f5
Author:     Petr Vaněk <arkamar <AT> atlas <DOT> cz>
AuthorDate: Mon Nov 14 14:05:09 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Nov 15 00:56:19 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d2bf9e5

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 <AT> atlas.cz>
Closes: https://github.com/gentoo/gentoo/pull/28263
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../rspamd-3.4-hyperscan-page-alignment.patch      | 28 ++++++++++++++++++++++
 .../{rspamd-3.4.ebuild => rspamd-3.4-r1.ebuild}    | 13 ++++++++++
 2 files changed, 41 insertions(+)

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
similarity index 83%
rename from mail-filter/rspamd/rspamd-3.4.ebuild
rename to 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
 }


             reply	other threads:[~2022-11-15  0:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15  0:56 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-10-02 17:44 [gentoo-commits] repo/gentoo:master commit in: mail-filter/rspamd/, mail-filter/rspamd/files/ Petr Vaněk
2024-07-13 20:43 Petr Vaněk
2024-03-13 17:32 Petr Vaněk
2023-12-03 22:01 Petr Vaněk
2023-08-07 17:22 Sam James
2023-08-07  5:43 Sam James
2022-11-06  6:17 Sam James
2022-04-12  8:20 Sam James
2021-09-07 20:25 Sam James
2021-09-07 20:25 Sam James
2021-08-22  2:50 Sam James
2020-10-08 19:41 Sam James
2020-04-04  8:06 Joonas Niilola
2020-02-24  5:55 Joonas Niilola
2019-12-14  8:41 Joonas Niilola
2019-11-04 11:22 Dirkjan Ochtman
2018-03-11 14:07 Dirkjan Ochtman
2017-06-13 19:52 Dirkjan Ochtman
2016-09-10 14:56 Dirkjan Ochtman
2016-04-26 19:33 Dirkjan Ochtman
2016-01-13 16:30 Dirkjan Ochtman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1668473779.1d2bf9e530d455d9d2e4b318d33c411ffb9e36f5.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox