Re: lmtpd segfaults after update to 2.4.19, seems it wants to act as proxy

"Simon Matter" <[email protected]>
Newsgroups gmane.mail.imap.cyrus
Message-ID <[email protected]>
>
> Quoting Simon Matter <[email protected]>:
>
>> Hi,
>>
>> I'm resending this with new subject and one again attached the straces
>> of
>> a delivery with 2.4.18 and 2.4.19.
>>
>>>>> I've just updated our cyrus-imapd rpms from 2.4.18 -> 2.4.19. All
>> seems well with just some small changes to the build.
>>>>>
>>>>> However, I just can't get it to work: lmtpd segfaults on mail
>>>>> delivery.
>>>>>
>>>>> The logs show something like this:
>>>>> May 17 14:21:42 mh1 kernel: lmtpd[7433]: segfault at 5ebc24d7 ip
>> 00007f216292973b sp 00007ffe5ebc1f58 error 4 in
>>>>> lmtpd[7f21628c1000+169000]
>>>>> May 17 14:21:42 mh1 master[7423]: process 7433 exited, signaled to
>>>>> death
>>>>> by 11
>>>>>
>>>>> First I've rebuilt without some of the custom patches in the package
>>>>> like
>>>>> the autocreate patches. But without a change.
>>>>>
>>>>> I've then straced an lmtpd during mail delivery, once with 2.4.18 and
>> once
>>>>> with 2.4.19 in the hope to find something. The traces are attached.
>>>>>
>>>>> I see that there were quite some change concerning lmtp, does anyone
>> of the developers have an idea where the problem in lmtpd changes
>> could be?
>>>>
>>>> It turns out that lmtpd wants to act as proxy, because only then it
>> creates the spoolfile in /tmp/. But why?
>>>> Regards,
>>>> Simon
>>>>
>>>
>>> Are you running a murder setup? Can you produce a coredump and brovide
>>> a
>> backtrace with symbols loaded?
>>
>> Hi,
>>
>> I did two things meanwhile:
>>
>> 1) Built a completely vanilla cyrus-imapd-2.4.19 without any patches to
>> make sure it's not anything wrong with additional patches. The crash was
>> the same.
>>
>> 2) Ran the normal build with an unstripped "lmtpd" binary and produced
>> core and backtrace. So below:
>>
>> Core was generated by `lmtpd'.
>> Program terminated with signal 11, Segmentation fault.
>> #0  strlcpy (dst=0x7ffaa64e00d0 "", src=0x5d73c6c7 <Address 0x5d73c6c7
>> out
>> of bounds>, len=1024) at xstrlcpy.c:65
>> 65		if ((dst[n] = src[n]) == '\0') break;
>> Missing separate debuginfos, use: debuginfo-install
>> cyrus-sasl-gssapi-2.1.23-15.el6_6.2.x86_64
>> cyrus-sasl-lib-2.1.23-15.el6_6.2.x86_64
>> cyrus-sasl-md5-2.1.23-15.el6_6.2.x86_64
>> cyrus-sasl-plain-2.1.23-15.el6_6.2.x86_64 db4-4.7.25-22.el6.x86_64
>> glibc-2.12-1.209.el6_9.1.x86_64 keyutils-libs-1.4-5.el6.x86_64
>> krb5-libs-1.10.3-65.el6.x86_64 libcom_err-1.41.12-23.el6.x86_64
>> libselinux-2.0.94-7.el6.x86_64
>> nss-softokn-freebl-3.14.3-23.3.el6_8.x86_64
>> openssl-1.0.1e-57.el6.x86_64 pcre-7.8-7.el6.x86_64
>> tcp_wrappers-libs-7.6-58.el6.x86_64 zlib-1.2.3-29.el6.x86_64
>> (gdb) bt
>> #0  strlcpy (dst=0x7ffaa64e00d0 "", src=0x5d73c6c7 <Address 0x5d73c6c7
>> out
>> of bounds>, len=1024) at xstrlcpy.c:65
>> #1  0x00007ffaa5150c2e in proxy_adddest (dlist=0x7ffc5d73c288,
>> rcpt=0x7ffaa64d26d0 "[email protected]", rcpt_num=0,
>> server=0x5d73c6c7 <Address 0x5d73c6c7 out of bounds>, authas=0x0) at
>> proxy.c:81
>
> here the bt is already in the wrong path and server has not been set
> wich leads to the SIGSEV
>
>> #2  0x00007ffaa514fbae in deliver (msgdata=0x7ffaa64d0950, authuser=0x0,
>> authstate=0x7ffc5d73c280) at lmtpd.c:749
>
> This is the point where the wrong path is taken.
>
>
> r = mlookup(namebuf, &server, NULL, NULL);
> if (!r && server) {
>      /* remote mailbox */
>      proxy_adddest(&dlist, rcpt, n, server, authuser);
>      status[n] = nosieve;
> }
>
> mlookup did return something that is not 0, and server has not been set
> in mlookup. In 2.4.17 there has was "if (server) *server = NULL;"

Hi Michael,

Thanks a lot for pointing me into the right direction. Indeed attached
patch makes it work for me.

I don't know if this is the proper fix for the issue. Hopefully someone
who knows better than me can comment.

Regards,
Simon

----
Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus
cyrus-imapd-2.4.19-deliver_local_segfault.patch (text/x-patch, 430 B)
--- cyrus-imapd-2.4.19/imap/lmtpd.c.orig	2017-05-15 07:43:30.000000000 +0200
+++ cyrus-imapd-2.4.19/imap/lmtpd.c	2017-05-20 08:36:47.629758869 +0200
@@ -392,6 +392,8 @@
     char *c;
     struct mboxlist_entry mbentry;
 
+    if (server) *server = NULL;
+
     /* do a local lookup and kick the slave if necessary */
     r = mboxlist_lookup(name, &mbentry, tid);
     if (r == IMAP_MAILBOX_NONEXISTENT && config_mupdate_server) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.