The sendmail Mail Filter API (Milter) is designed to allow third-party programs access to mail messages as they are being processed in order to filter meta-information and content. This library is a prerequisite for the OpenDKIM package. The proposed Makefile also contains sections for building Sendmail. These sections are commented out because more work is necessary to properly complete porting of Sendmail to LEDE/OpenWrt. The notes in Makefile provide details on what is required to complete the port. It has been verified that Sendmail executables compile and run properly on the target system when the commented sections in Makefile are uncommented. Signed-off-by: Val Kulkov <val.kulkov@gmail.com>
48 lines
1.9 KiB
Diff
48 lines
1.9 KiB
Diff
This patch increases the stack size for pthreads from 80 KB, the default
|
|
stack size for musl libc, to 2 MB. The default stack size for glibc is 8 MB.
|
|
|
|
OpenDKIM, an application that depends on libmilter, segfaults if the stack
|
|
size for pthreads is left unchanged at the musl default value of 80 KB.
|
|
Apparently, OpenDKIM allocates blocks of 64 KB multiple times, which causes
|
|
libmilter and therefore OpenDKIM to crash:
|
|
https://git.alpinelinux.org/cgit/aports/commit/?id=95724d1bd53ae87f72e6388cb7323dbd8f84be9d
|
|
|
|
This patch follows the patch suggested by an Alpine Linux user in bug report
|
|
above. Also, a bug report has been filed upstream:
|
|
https://sourceforge.net/p/opendkim/bugs/258/
|
|
|
|
|
|
Index: sendmail-8.15.2/libmilter/libmilter.h
|
|
===================================================================
|
|
--- sendmail-8.15.2.orig/libmilter/libmilter.h
|
|
+++ sendmail-8.15.2/libmilter/libmilter.h
|
|
@@ -127,10 +127,10 @@ struct smfi_str
|
|
# 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)
|
|
Index: sendmail-8.15.2/libmilter/main.c
|
|
===================================================================
|
|
--- sendmail-8.15.2.orig/libmilter/main.c
|
|
+++ sendmail-8.15.2/libmilter/main.c
|
|
@@ -16,6 +16,12 @@ SM_RCSID("@(#)$Id: main.c,v 8.85 2013-11
|
|
#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,2*1024*1024);
|
|
+ return pthread_create(ptid, &attr, wr, arg);
|
|
+}
|
|
|
|
static smfiDesc_ptr smfi = NULL;
|
|
|