[gentoo-commits] repo/gentoo:master commit in: mail-filter/libmilter/files/, mail-filter/libmilter/

2020-06-28 Thread Joonas Niilola
commit: a9a1ea072ab7c291abce96ee0162a6be3122a1c9
Author: Wynn Wolf Arbor  oriole  systems>
AuthorDate: Tue Jun  9 14:27:30 2020 +
Commit: Joonas Niilola  gentoo  org>
CommitDate: Sun Jun 28 10:40:58 2020 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a9a1ea07

mail-filter/libmilter: Set default pthread stack size to 256 KB on musl

The default stack size for glibc is set to 8MB, whilst musl sets it to
80 KB. This leads to various crashes of applications depending on
libmilter. Enforce a stack size of 256 KB to mitigate these crashes.

See also the following link, from where this patch was taken.
https://git.alpinelinux.org/aports/tree/main/libmilter/default-pthread-stacksize.patch

Signed-off-by: Wynn Wolf Arbor  oriole.systems>
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Closes: https://github.com/gentoo/gentoo/pull/16139
Signed-off-by: Joonas Niilola  gentoo.org>

 .../files/libmilter-musl-stack-size.patch  | 42 ++
 mail-filter/libmilter/libmilter-1.0.2_p1.ebuild|  1 +
 2 files changed, 43 insertions(+)

diff --git a/mail-filter/libmilter/files/libmilter-musl-stack-size.patch 
b/mail-filter/libmilter/files/libmilter-musl-stack-size.patch
new file mode 100644
index 000..9993adfece3
--- /dev/null
+++ b/mail-filter/libmilter/files/libmilter-musl-stack-size.patch
@@ -0,0 +1,42 @@
+Set default pthread stack size to 256 KB
+
+This patch tries to fix various crashes for applications depending on libmilter
+by setting the stack size for pthreads to 256 KB. The default stack size for
+musl libc is set to 80 KB whereas glibc has it set to 8 MB. This causes 
problems
+when a large amount of memory is allocated on the stack.
+
+For example, opendkim allocates blocks of 64 KB multiple times, which causes
+libmilter (and therefore opendkim) to crash. For now, a stack size of 256 KB
+looks sufficient and makes opendkim stop crashing.
+
+Fixes https://bugs.alpinelinux.org/issues/6360
+
+--- a/libmilter/libmilter.h
 b/libmilter/libmilter.h
+@@ -127,10 +127,10 @@
+ # define MI_SOCK_READ(s, b, l)read(s, b, l)
+ # define MI_SOCK_READ_FAIL(x) ((x) < 0)
+ # define MI_SOCK_WRITE(s, b, l)   write(s, b, l)
+-
+-# define thread_create(ptid,wr,arg) pthread_create(ptid, NULL, wr, arg)
+ # define sthread_get_id() pthread_self()
+
++extern int thread_create(pthread_t *ptid, void *(*wr) (void *), void *arg);
++
+ typedef pthread_mutex_t smutex_t;
+ # define smutex_init(mp)  (pthread_mutex_init(mp, NULL) == 0)
+ # define smutex_destroy(mp)   (pthread_mutex_destroy(mp) == 0)
+--- a/libmilter/main.c
 b/libmilter/main.c
+@@ -16,6 +16,12 @@
+ #include 
+ #include 
+
++int thread_create(pthread_t *ptid, void *(*wr) (void *), void *arg) {
++  pthread_attr_t attr;
++  pthread_attr_init();
++  pthread_attr_setstacksize(,256*1024);
++  return pthread_create(ptid, , wr, arg);
++}
+
+ static smfiDesc_ptr smfi = NULL;

diff --git a/mail-filter/libmilter/libmilter-1.0.2_p1.ebuild 
b/mail-filter/libmilter/libmilter-1.0.2_p1.ebuild
index e197eb05925..b9a1147970d 100644
--- a/mail-filter/libmilter/libmilter-1.0.2_p1.ebuild
+++ b/mail-filter/libmilter/libmilter-1.0.2_p1.ebuild
@@ -45,6 +45,7 @@ src_prepare() {
if use elibc_musl; then
use ipv6 && ENVDEF="${ENVDEF} -DNEEDSGETIPNODE"
 
+   eapply "${FILESDIR}/${PN}-musl-stack-size.patch"
eapply "${FILESDIR}/${PN}-musl-disable-cdefs.patch"
fi
 



[gentoo-commits] repo/gentoo:master commit in: mail-filter/libmilter/files/, mail-filter/libmilter/

2019-11-15 Thread Hanno Böck
commit: 9d467a0e64ef635873702cecbf8f614b164a6907
Author: Hanno Böck  gentoo  org>
AuthorDate: Sat Nov 16 07:32:31 2019 +
Commit: Hanno Böck  gentoo  org>
CommitDate: Sat Nov 16 07:32:31 2019 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9d467a0e

mail-filter/libmilter: Bump and glibc 2.30 support

Upstream versions aren't increased properly, so we have to
make this a _p1 version.
Newer build system patch from sendmail ebuild.
Patch for glibc 2.30 support extracted from OpenSUSE.

Closes: https://bugs.gentoo.org/691692
Signed-off-by: Hanno Böck  gentoo.org>
Package-Manager: Portage-2.3.79, Repoman-2.3.18

 mail-filter/libmilter/Manifest |   1 +
 .../libmilter/files/libmilter-glibc-2.30.patch |  25 +++
 .../files/sendmail-8.14.6-build-system.patch   | 211 +
 mail-filter/libmilter/libmilter-1.0.2_p1.ebuild|  72 +++
 4 files changed, 309 insertions(+)

diff --git a/mail-filter/libmilter/Manifest b/mail-filter/libmilter/Manifest
index 1fc4bdf2b58..02a7dd7b9e9 100644
--- a/mail-filter/libmilter/Manifest
+++ b/mail-filter/libmilter/Manifest
@@ -1 +1,2 @@
 DIST sendmail.8.14.5.tar.gz 2092508 BLAKE2B 
3d90fa9778ebb42f2f334b35e46d0f24e8fcfd46fe69d6032f246c90fc998fbeb21e70c70bc454c688a76ea00c90ee9b5f0e5e0fc9b89b9f16fa9c814a825f9c
 SHA512 
178addd247f1c7c8ca90d70b9240db4cad4e55f0710d5df0fe979e5473a182d2035150c352836576a28bb2b9660b0d5ebfcd95269a156ac0d2c3dba3edb60452
+DIST sendmail.8.15.2.tar.gz 2207417 BLAKE2B 
3d9dfb5bc2b535e30ef2fc61333e12a9b1fc45a5d730d2bed1ef956adb574721833f87aeba0475705b76e0c7d6cf00f9a10025bffb0de6c6b4dae606eb2ec399
 SHA512 
04feb37316c13b66b1518596507a7da7c16cb0bf1abf10367f7fd888a428fadb093a9efa55342fa55b936c3f0cbdc63b9e2505cd99201a69a0c05b8ad65f49f9

diff --git a/mail-filter/libmilter/files/libmilter-glibc-2.30.patch 
b/mail-filter/libmilter/files/libmilter-glibc-2.30.patch
new file mode 100644
index 000..5ceac845b90
--- /dev/null
+++ b/mail-filter/libmilter/files/libmilter-glibc-2.30.patch
@@ -0,0 +1,25 @@
+--- a/libmilter/sm_gethost.c   2014-03-05 01:59:45.0 +0100
 b/libmilter/sm_gethost.c   2019-11-14 18:59:41.885353232 +0100
+@@ -51,18 +51,20 @@ sm_getipnodebyname(name, family, flags,
+ {
+   bool resv6 = true;
+   struct hostent *h;
+-
++#ifdef RES_USE_INET6
+   if (family == AF_INET6)
+   {
+   /* From RFC2133, section 6.1 */
+   resv6 = bitset(RES_USE_INET6, _res.options);
+   _res.options |= RES_USE_INET6;
+   }
++#endif
+   SM_SET_H_ERRNO(0);
+   h = gethostbyname(name);
++#ifdef RES_USE_INET6
+   if (family == AF_INET6 && !resv6)
+   _res.options &= ~RES_USE_INET6;
+-
++#endif
+   /* the function is supposed to return only the requested family */
+   if (h != NULL && h->h_addrtype != family)
+   {

diff --git a/mail-filter/libmilter/files/sendmail-8.14.6-build-system.patch 
b/mail-filter/libmilter/files/sendmail-8.14.6-build-system.patch
new file mode 100644
index 000..3348e921926
--- /dev/null
+++ b/mail-filter/libmilter/files/sendmail-8.14.6-build-system.patch
@@ -0,0 +1,211 @@
+diff -Nru sendmail-8.14.3.orig/cf/cf/Makefile sendmail-8.14.3/cf/cf/Makefile
+--- sendmail-8.14.3.orig/cf/cf/Makefile2005-06-14 04:16:34.0 
+0200
 sendmail-8.14.3/cf/cf/Makefile 2009-09-20 10:55:50.0 +0200
+@@ -80,10 +80,10 @@
+ install-cf:  install-sendmail-cf install-submit-cf
+ 
+ install-sendmail-cf: $(CF).cf
+-  $(INSTALL) -c -o $(CFOWN) -g $(CFGRP) -m $(CFMODE) $(CF).cf 
${DESTDIR}$(MAILDIR)/sendmail.cf
++  $(INSTALL) -c -o $(CFOWN) -g $(CFGRP) -m $(CFMODE) $(CF).cf 
"${DESTDIR}$(MAILDIR)/sendmail.cf"
+ 
+ install-submit-cf: $(SUBMIT).cf
+-  $(INSTALL) -c -o $(CFOWN) -g $(CFGRP) -m $(CFMODE) $(SUBMIT).cf 
${DESTDIR}$(MAILDIR)/submit.cf
++  $(INSTALL) -c -o $(CFOWN) -g $(CFGRP) -m $(CFMODE) $(SUBMIT).cf 
"${DESTDIR}$(MAILDIR)/submit.cf"
+ 
+ depend:
+
+diff -Nru sendmail-8.14.6.orig/devtools/M4/UNIX/defines.m4 
sendmail-8.14.6/devtools/M4/UNIX/defines.m4
+--- sendmail-8.14.6.orig/devtools/M4/UNIX/defines.m4   2012-01-21 
00:07:08.0 +
 sendmail-8.14.6/devtools/M4/UNIX/defines.m42012-12-27 
08:13:15.792214375 +
+@@ -26,7 +26,7 @@
+ CCLINK = ifdef(`confCCLINK', `confCCLINK', `confCC')
+ # Linker for libraries
+ LD=   ifdef(`confLD', `confLD', `confCC')
+-LDOPTS=   ifdef(`confLDOPTS', `confLDOPTS') ifdef(`confMT', 
ifdef(`confMTLDOPTS', `confMTLDOPTS', `'), `')
++LDOPTS=   ifdef(`confLDOPTS', `confLDOPTS')
+ LDOPTS_SO= ${LDOPTS} ifdef(`confLDOPTS_SO', `confLDOPTS_SO', `-shared')
+ 
+ # Shell
+@@ -71,7 +71,7 @@
+ LIBADD= ifdef(`conf_'bldCURRENT_PRD`_LIBS', `conf_'bldCURRENT_PRD`_LIBS')
+ 
+ # libraries required on your system
+-LIBS= ${LIBADD} ifdef(`confLIBS', `confLIBS') 
ifdef(`conf_'bldCURRENT_PRD`_LIB_POST', `conf_'bldCURRENT_PRD`_LIB_POST')
++LIBS= ${LIBADD} ifdef(`confLIBS', `confLIBS')