Github messages for voidlinux
 help / color / mirror / Atom feed
From: ericonr <ericonr@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] libmilter: set explicit stack size.
Date: Wed, 16 Dec 2020 03:45:11 +0100	[thread overview]
Message-ID: <20201216024511.5OKE49vdrOBZGgM2vq48H6fGIb9B3t12xWlFex6eSNs@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-27143@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages libmilter
https://github.com/void-linux/void-packages/pull/27143

libmilter: set explicit stack size.
Patch taken from alpine. libmilter stack overflows with musl's default
thread stack size.

Based on #27031 

A patch file from https://github.com/void-linux/void-packages/pull/27143.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libmilter-27143.patch --]
[-- Type: text/x-diff, Size: 3240 bytes --]

From b646dd6e99b4444c961d8d1ce9ff278be6feddd1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Mon, 14 Dec 2020 10:47:59 -0300
Subject: [PATCH] libmilter: set explicit stack size.

Patch taken from alpine. libmilter stack overflows with musl's default
thread stack size.
---
 .../libmilter/patches/thread-stacksize.patch  | 42 +++++++++++++++++++
 srcpkgs/libmilter/template                    |  4 +-
 2 files changed, 44 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/libmilter/patches/thread-stacksize.patch

diff --git a/srcpkgs/libmilter/patches/thread-stacksize.patch b/srcpkgs/libmilter/patches/thread-stacksize.patch
new file mode 100644
index 00000000000..0881abdfd94
--- /dev/null
+++ b/srcpkgs/libmilter/patches/thread-stacksize.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
+
+--- libmilter/libmilter.h
++++ 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)
+--- libmilter/main.c
++++ libmilter/main.c
+@@ -16,6 +16,12 @@
+ #include <fcntl.h>
+ #include <sys/stat.h>
+
++int thread_create(pthread_t *ptid, void *(*wr) (void *), void *arg) {
++	pthread_attr_t attr;
++	pthread_attr_init(&attr);
++	pthread_attr_setstacksize(&attr,256*1024);
++	return pthread_create(ptid, &attr, wr, arg);
++}
+
+ static smfiDesc_ptr smfi = NULL;
diff --git a/srcpkgs/libmilter/template b/srcpkgs/libmilter/template
index b801ee3e5b9..f51b61430ce 100644
--- a/srcpkgs/libmilter/template
+++ b/srcpkgs/libmilter/template
@@ -1,9 +1,10 @@
 # Template file for 'libmilter'
 pkgname=libmilter
 version=1.0.2
-revision=3
+revision=4
 _pkgname=sendmail
 _version=8.15.2
+wrksrc="${_pkgname}-${_version}"
 hostmakedepends="m4"
 short_desc="Implementation of the sendmail Mail Filter API"
 maintainer="John Regan <john@jrjrtech.com>"
@@ -11,7 +12,6 @@ license="Sendmail"
 homepage="https://www.milter.org/developers/api/"
 distfiles="ftp://ftp.mirrorservice.org/sites/ftp.sendmail.org/pub/${_pkgname}/${_pkgname}.${_version}.tar.gz"
 checksum=24f94b5fd76705f15897a78932a5f2439a32b1a2fdc35769bb1a5f5d9b4db439
-wrksrc="${_pkgname}-${_version}"
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	makedepends+=" musl-legacy-compat"

  reply	other threads:[~2020-12-16  2:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 13:50 [PR PATCH] " ericonr
2020-12-16  2:45 ` ericonr [this message]
2020-12-16  3:02 ` [PR PATCH] [Merged]: " ericonr

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=20201216024511.5OKE49vdrOBZGgM2vq48H6fGIb9B3t12xWlFex6eSNs@z \
    --to=ericonr@users.noreply.github.com \
    --cc=ml@inbox.vuxu.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;
as well as URLs for NNTP newsgroup(s).