dovecot-2.3 (-git) Warning and Fatal Compile Error

Reuben Farrelly
2017-10-20T02:23:40Z

On 18/10/2017 11:40 PM, Timo Sirainen wrote:
> On 18 Oct 2017, at 6.34, Reuben Farrelly <reuben-dovecot at reub.net>
wrote:
>>
>> I haven't been tracking dovecot-2.3 until now, but I've just
given it a quick run, and there are a few things that may need some attention.
>>
>> /usr/include/features.h:376:4: warning: #warning _FORTIFY_SOURCE
requires compiling with optimization (-O) [-Wcpp]
>> #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
>
> Don't use -O0 or use configure --disable-hardening or just ignore it.
>
>> The build then fails entirely with this:
>>
>> DMODULEDIR=\""/usr/lib64/dovecot"\"   -O0 -g -pipe
-march=native -mtune=native -ggdb -c -o realpath.lo realpath.c
>> edit-mail.c: In function ?edit_mail_wrap?:
>> edit-mail.c:235:14: error: too few arguments to function
?mailbox_transaction_begin?
>>   raw_trans = mailbox_transaction_begin(raw_box, 0);
>
> I don't think your pigeonhole is from git master.

Thanks.  That was it...

Now onto 2.3 -git, there is a repeatable crash occurring in lmtp.  In
fact it looks like there could be more than one problem, because even
invoking lmtp (with gdb) and no arguments results in a gdb error about
an unaddressable byte.

However when lmtp is used normally within dovecot it crashes out on a
few but not all mails.

The full gdb output looks like this:

Oct 20 12:59:21 thunderstorm.reub.net dovecot: master: Dovecot
v2.3.devel (c398eca6b) starting up for imap, lmtp, sieve
Oct 20 12:59:30 thunderstorm.reub.net postfix/qmgr[5057]: 9A25122B50:
from=<xxx at gmail.com>, size=18515, nrcpt=1 (queue active)
Oct 20 12:59:30 thunderstorm.reub.net postfix/qmgr[5057]: 32D0722B4B:
from=<xxx at youtube-subscriptions.bounces.google
.com>, size=27030, nrcpt=1 (queue active)
Oct 20 12:59:31 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
Syscall param epoll_pwait(sigmask) points to unaddressable byte(s)
Oct 20 12:59:31 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
at 0x58A7705: epoll_pwait (epoll_pwait.c:42)
Oct 20 12:59:31 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0x5504697: io_loop_handler_run_internal (ioloop-epoll.c:182)
Oct 20 12:59:31 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0x5501C4F: io_loop_handler_run (ioloop.c:666)
Oct 20 12:59:31 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0x5501B2E: io_loop_run (ioloop.c:639)
Oct 20 12:59:31 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0x5449F05: master_service_run (master-service.c:733)
Oct 20 12:59:31 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0x10D8E8: main (main.c:139)
Oct 20 12:59:31 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
Address 0x0 is not stack'd, malloc'd or (recently) free'd
Oct 20 12:59:31 thunderstorm.reub.net dovecot: lmtp: Error: ==28006=Oct 20
12:59:32 thunderstorm.reub.net dovecot: lmtp(28006): Connect from
local
Oct 20 12:59:33 thunderstorm.reub.net dovecot: lmtp: Error: ==28009==
Syscall param epoll_pwait(sigmask) points to unaddressable byte(s)
Oct 20 12:59:33 thunderstorm.reub.net dovecot: lmtp: Error: ==28009==
at 0x58A7705: epoll_pwait (epoll_pwait.c:42)
Oct 20 12:59:33 thunderstorm.reub.net dovecot: lmtp: Error: ==28009==
by 0x5504697: io_loop_handler_run_internal (ioloop-epoll.c:182)
Oct 20 12:59:33 thunderstorm.reub.net dovecot: lmtp: Error: ==28009==
by 0x5501C4F: io_loop_handler_run (ioloop.c:666)
Oct 20 12:59:33 thunderstorm.reub.net dovecot: lmtp: Error: ==28009==
by 0x5501B2E: io_loop_run (ioloop.c:639)
Oct 20 12:59:33 thunderstorm.reub.net dovecot: lmtp: Error: ==28009==
by 0x5449F05: master_service_run (master-service.c:733)
Oct 20 12:59:33 thunderstorm.reub.net dovecot: lmtp: Error: ==28009==
by 0x10D8E8: main (main.c:139)
Oct 20 12:59:33 thunderstorm.reub.net dovecot: lmtp: Error: ==28009==
Address 0x0 is not stack'd, malloc'd or (recently) free'd
Oct 20 12:59:33 thunderstorm.reub.net dovecot: lmtp: Error: ==28009=Oct 20
12:59:33 thunderstorm.reub.net dovecot: lmtp(28009): Connect from
local
Oct 20 12:59:34 thunderstorm.reub.net dovecot:
lmtp(liam)<28006><aFFxDIRY6VlmbQAAzkCIew>: aFFxDIRY6VlmbQAAzkCIew:
sieve: msgid=<001a114bd6f6d2fc86055be257ba at google.com>: stored mail
into
mailbox 'INBOX'
Oct 20 12:59:34 thunderstorm.reub.net dovecot:
indexer-worker(liam)<28026><aFFxDIRY6VlmbQAAzkCIew:xdWnOIZY6Vl6bQAAzkCIew>:
Indexed 1 messages in INBOX (UIDs 634..634)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
Invalid read of size 8
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
at 0x543AECB: smtp_submit_session_init (smtp-submit.c:61)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0x543B05B: smtp_submit_init_simple (smtp-submit.c:100)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xAA8BC4B: lda_sieve_smtp_start (lda-sieve-plugin.c:77)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACBF4C0: sieve_smtp_start (sieve-smtp.c:31)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACBF679: sieve_smtp_start_single (sieve-smtp.c:63)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACF4E0F: act_redirect_send (cmd-redirect.c:351)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACF53F0: act_redirect_commit (cmd-redirect.c:495)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACDFC58: sieve_result_action_commit (sieve-result.c:1206)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACDFE9D: sieve_result_action_commit_or_rollback (sieve-result.c:1267)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACE0093: sieve_result_transaction_commit_or_rollback
(sieve-result.c:1334)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACE02E0: sieve_result_execute (sieve-result.c:1413)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACF993C: sieve_multiscript_execute (sieve.c:666)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
Address 0x0 is not stack'd, malloc'd or (recently) free'd
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006=Oct 20
12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006=Oct 20 12:59:35
thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
Process terminating with default action of signal 11 (SIGSEGV): dumping core
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
Access not within mapped region at address 0x0
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
at 0x543AECB: smtp_submit_session_init (smtp-submit.c:61)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0x543B05B: smtp_submit_init_simple (smtp-submit.c:100)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xAA8BC4B: lda_sieve_smtp_start (lda-sieve-plugin.c:77)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACBF4C0: sieve_smtp_start (sieve-smtp.c:31)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACBF679: sieve_smtp_start_single (sieve-smtp.c:63)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACF4E0F: act_redirect_send (cmd-redirect.c:351)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACF53F0: act_redirect_commit (cmd-redirect.c:495)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACDFC58: sieve_result_action_commit (sieve-result.c:1206)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACDFE9D: sieve_result_action_commit_or_rollback (sieve-result.c:1267)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACE0093: sieve_result_transaction_commit_or_rollback
(sieve-result.c:1334)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACE02E0: sieve_result_execute (sieve-result.c:1413)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
by 0xACF993C: sieve_multiscript_execute (sieve.c:666)
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
If you believe this happened as a result of a stack
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
overflow in your program's main thread (unlikely but
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
possible), you can try to increase the size of the
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
main thread stack using the --main-stacksize= flag.
Oct 20 12:59:35 thunderstorm.reub.net dovecot: lmtp: Error: ==28006==
The main thread stack size used in this run was 8388608.
Oct 20 12:59:35 thunderstorm.reub.net dovecot:
lmtp(liam)<28006><aFFxDIRY6VlmbQAAzkCIew>: Fatal: master:
service(lmtp):
child 28006 killed with signal 11 (core not dumped)
Oct 20 12:59:35 thunderstorm.reub.net postfix/lmtp[28004]: 9A25122B50:
to=<xxx at thunderstorm.reub.net>, orig_to=<xxx at farrelly.name>,
relay=thunderstorm.reub.net[private/dovecot-lmtp], delay=62182,
delays=62177/0.01/2/3, dsn=4.4.2, status=deferred (lost connection with
thunderstorm.reub.net[private/dovecot-lmtp] while sending end of data --
message may be sent more than once)
Oct 20 12:59:36 thunderstorm.reub.net dovecot:
indexer-worker(liam)<28026><4I9/OIVY6VlpbQAAzkCIew:yNxBKIhY6Vl6bQAAzkCIew>:
Indexed 1 messages in Youtube Notifications (UIDs 1544..1544)
Oct 20 12:59:36 thunderstorm.reub.net dovecot:
lmtp(liam)<28009><4I9/OIVY6VlpbQAAzkCIew>: 4I9/OIVY6VlpbQAAzkCIew:
sieve: msgid=<001a11414af89d6783055bed7dee at google.com>: stored mail
into
mailbox 'Youtube Notifications'

[For some reason the core file is not being created, and I'm not sure
why yet]

Secondly, this ssl_dh messages is always printed from doveconf:

doveconf: Warning: please set ssl_dh=</etc/dovecot/dh.pem
doveconf: Warning: You can generate it with: dd
if=/var/lib/dovecot/ssl-parameters.dat bs=1 skip=88 | openssl dh -inform
der > /etc/dovecot/dh.pem

Yet the file is there:

thunderstorm conf.d # ls -la /etc/dovecot/dh.pem
-rw-r--r-- 1 root root 769 Oct 19 21:55 /etc/dovecot/dh.pem

And the config is there as well:

thunderstorm dovecot # doveconf -P | grep ssl_dh
ssl_dh = </etc/dovecot/dh.pem
doveconf: Warning: please set ssl_dh=</etc/dovecot/dh.pem
doveconf: Warning: You can generate it with: dd
if=/var/lib/dovecot/ssl-parameters.dat bs=1 skip=88 | openssl dh -inform
der > /etc/dovecot/dh.pem
   ssl_dh = -----BEGIN DH PARAMETERS-----
   ssl_dh = -----BEGIN DH PARAMETERS-----
   ssl_dh = -----BEGIN DH PARAMETERS-----
   ssl_dh = -----BEGIN DH PARAMETERS-----
   ssl_dh = -----BEGIN DH PARAMETERS-----
   ssl_dh = -----BEGIN DH PARAMETERS-----
   ssl_dh = -----BEGIN DH PARAMETERS-----
   ssl_dh = -----BEGIN DH PARAMETERS-----
thunderstorm dovecot #

It appears that this warning is being triggered by the presence of the
ssl-parameters.dat file because when I remove it the warning goes away.
Perhaps the warning could be made a bit more specific about this file
being removed if it is not required because at the moment the warning
message is not related to the trigger.

Thanks,
Reuben