cyrusimap / cyrus-imapd

Cyrus IMAP is an email, contacts and calendar server
http://cyrusimap.org
Other
550 stars 151 forks source link

Segmentation fault in "Mailbox/queryChange" #2510

Closed zvasilev closed 6 years ago

zvasilev commented 6 years ago

Segmentation fault is caused when calling "Mailbox/queryChanges".

{"methodCalls":[["Mailbox/changes",{"accountId":"u1","sinceState":"13968"},"#23"],["Mailbox/queryChanges",{"sinceQueryState":"13968"},"#24"]],"using":["ietf:jmap","ietf:jmapmail"]}

Seems the problem is that mbrec->mboxname is null.

p *mbrec $6 = {id = 0x55ad399c1e20 "0051fe63-2ce4-4317-8027-c77ca157f695", mbname = 0x55ad399c5350, mboxname = 0x0, utf8mboxname = 0x0, jmapname = 0x0, sort_order = 0, foldermodseq = 2, createdmodseq = 0, mbtype = 0, shared_mbtype = _MBOX_SHARED}

(gdb) bt

0 0x00007ff27a94df93 in strhash (string=0x0) at lib/strhash.c:50

1 0x00007ff27a9460d9 in hash_lookup (key=0x0, table=0x7ffe979a0a60) at lib/hash.c:156

2 0x000055ad38370b3c in jmap_myrights_byname (req=0x7ffe979a0b10, mboxname=0x0) at imap/http_jmap.c:2440

3 0x000055ad38370cb3 in jmap_hasrights_byname (req=0x7ffe979a0b10, mboxname=0x0, rights=1) at imap/http_jmap.c:2464

4 0x000055ad384006dd in jmap_mailbox_querychanges (req=0x7ffe979a0b10) at imap/jmap_mailbox.c:1353

5 0x000055ad3836939d in jmap_api (txn=0x55ad3991cb30, res=0x7ffe979a0c50) at imap/http_jmap.c:950

6 0x000055ad3836992c in jmap_post (txn=0x55ad3991cb30, params=0x0) at imap/http_jmap.c:1012

7 0x000055ad3831d242 in frame_recv_cb (session=0x55ad3991b2f0, frame=0x55ad3991b488, user_data=0x7ffe979a8090)

at imap/http_h2.c:371

8 0x00007ff27b35735d in ?? () from /usr/lib/x86_64-linux-gnu/libnghttp2.so.14

9 0x00007ff27b35baae in nghttp2_session_mem_recv () from /usr/lib/x86_64-linux-gnu/libnghttp2.so.14

10 0x00007ff27b35d954 in nghttp2_session_recv () from /usr/lib/x86_64-linux-gnu/libnghttp2.so.14

11 0x000055ad3831e465 in http2_input (txn=0x7ffe979a4e80) at imap/http_h2.c:644

12 0x000055ad38344326 in cmdloop (conn=0x7ffe979a8090) at imap/httpd.c:1774

13 0x000055ad3833fc21 in service_main (argc=2, argv=0x55ad398dceb0, envp=0x7ffe979a9880) at imap/httpd.c:841

14 0x000055ad38365275 in main (argc=2, argv=0x7ffe979a9868, envp=0x7ffe979a9880) at master/service.c:634

brong commented 6 years ago

Oh - interesting. Do you have a test which can reproduce it?

Bron.

On Sat, Sep 8, 2018, at 00:22, Живко Василев wrote:

Segmentation fault is caused when calling "Mailbox/queryChanges".

{"methodCalls":[["Mailbox/changes",{"accountId":"u1","sinceState":"13968"},"#23"],["Mailbox/queryChanges",{"sinceQueryState":"13968"},"#24"]],"using":["ietf:jmap","ietf:jmapmail"]}

Seems the problem is that mbrec->mboxname is null.

p *mbrec $6 = {id = 0x55ad399c1e20 "0051fe63-2ce4-4317-8027-c77ca157f695", mbname = 0x55ad399c5350, mboxname = 0x0, utf8mboxname = 0x0, jmapname = 0x0, sort_order = 0, foldermodseq = 2, createdmodseq = 0, mbtype = 0, shared_mbtype = _MBOX_SHARED}

(gdb) bt

0 0x00007ff27a94df93 in strhash (string=0x0) at lib/strhash.c:50

1 https://github.com/cyrusimap/cyrus-imapd/issues/1 0x00007ff27a9460d9 in hash_lookup (key=0x0, table=0x7ffe979a0a60) at lib/hash.c:156

2 https://github.com/cyrusimap/cyrus-imapd/pull/2 0x000055ad38370b3c in jmap_myrights_byname (req=0x7ffe979a0b10, mboxname=0x0) at imap/http_jmap.c:2440

3 https://github.com/cyrusimap/cyrus-imapd/issues/3 0x000055ad38370cb3 in jmap_hasrights_byname (req=0x7ffe979a0b10, mboxname=0x0, rights=1) at imap/http_jmap.c:2464

4 https://github.com/cyrusimap/cyrus-imapd/issues/4 0x000055ad384006dd in jmap_mailbox_querychanges (req=0x7ffe979a0b10) at imap/jmap_mailbox.c:1353

5 https://github.com/cyrusimap/cyrus-imapd/issues/5 0x000055ad3836939d in jmap_api (txn=0x55ad3991cb30, res=0x7ffe979a0c50) at imap/http_jmap.c:950

6 https://github.com/cyrusimap/cyrus-imapd/issues/6 0x000055ad3836992c in jmap_post (txn=0x55ad3991cb30, params=0x0) at imap/http_jmap.c:1012

7 https://github.com/cyrusimap/cyrus-imapd/issues/7 0x000055ad3831d242 in frame_recv_cb (session=0x55ad3991b2f0, frame=0x55ad3991b488, user_data=0x7ffe979a8090)

at imap/http_h2.c:371

8 https://github.com/cyrusimap/cyrus-imapd/issues/8 0x00007ff27b35735d in ?? () from /usr/lib/x86_64-linux-gnu/libnghttp2.so.14

9 https://github.com/cyrusimap/cyrus-imapd/issues/9 0x00007ff27b35baae in nghttp2_session_mem_recv () from /usr/lib/x86_64-linux-gnu/libnghttp2.so.14

10 https://github.com/cyrusimap/cyrus-imapd/pull/10 0x00007ff27b35d954 in nghttp2_session_recv () from /usr/lib/x86_64-linux-gnu/libnghttp2.so.14

11 https://github.com/cyrusimap/cyrus-imapd/issues/11 0x000055ad3831e465 in http2_input (txn=0x7ffe979a4e80) at imap/http_h2.c:644

12 https://github.com/cyrusimap/cyrus-imapd/pull/12 0x000055ad38344326 in cmdloop (conn=0x7ffe979a8090) at imap/httpd.c:1774

13 https://github.com/cyrusimap/cyrus-imapd/pull/13 0x000055ad3833fc21 in service_main (argc=2, argv=0x55ad398dceb0, envp=0x7ffe979a9880) at imap/httpd.c:841

14 https://github.com/cyrusimap/cyrus-imapd/issues/14 0x000055ad38365275 in main (argc=2, argv=0x7ffe979a9868, envp=0x7ffe979a9880) at master/service.c:634

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cyrusimap/cyrus-imapd/issues/2510, or mute the thread https://github.com/notifications/unsubscribe-auth/AABE7QUUDHChyCEyepuHU5Y4nRaMi8Eiks5uYoEogaJpZM4We6ya.

-- Bron Gondwana, CEO, FastMail Pty Ltd brong@fastmailteam.com

zvasilev commented 6 years ago

Actually no. Trying to implement JMAP protocol, so I just build a Cyrus and add one account. Is it possible to give you somehow Cyrus data?

Also, I was trying to use Mailbox/set (rename, delete, creating subfolder) but it turns out that cannot create subfolders correctly. Is it possible for these test to produce damaged mailboxes structure?

brong commented 6 years ago

Sure, if you build up a tarball of the config, or at least the exact version you're running and the build and config options. Also, if you can capture telemetry of exactly how your account is being set up, that would help. Ideally if this is reproduable, we'd create a Cassandane test so we can make sure it stays fixed.

Bron.

On Sat, Sep 8, 2018, at 15:48, Живко Василев wrote:

Actually no. Trying to implement JMAP protocol, so I just build a Cyrus and add one account. Is it possible to give you somehow Cyrus data?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cyrusimap/cyrus-imapd/issues/2510#issuecomment-419615578, or mute the thread https://github.com/notifications/unsubscribe-auth/AABE7aMU0YwBnP_IIHqsjrXbqnXZGuglks5uY1pAgaJpZM4We6ya.

-- Bron Gondwana, CEO, FastMail Pty Ltd brong@fastmailteam.com

rsto commented 6 years ago

Being able to reproduce issue reports, especially crashers, is always a good thing. But for this particular issue I'm pretty sure where I messed up, so there's no need for a detailed error description until I've tested my assumption.

zvasilev commented 6 years ago

Ok great, because I get that data, but it turns out the SQLite files are encrypted. I was using this https://cyrusimap.org/imap/installing.html guide.

What password is used for SQLite files, If found issues in the future?