segfault in ctl_mboxlist -d with 2.5.4

ellie timoney ellie at fastmail.com
Fri Jul 10 02:30:45 EDT 2015


Hi Chris,

Your suggested fix is now in git on the cyrus-imapd-2.5 branch.  Thanks.
:)

dump_cb() and its surrounds have been refactored heavily on our master
branch, and it looks a lot more robust than the 2.5 code.  So I'm
looking at back-porting those changes as an alternative.

One way or another, this will be fixed in 2.5.5.

Cheers,

ellie

On Fri, Jul 10, 2015, at 10:11 AM, ellie timoney wrote:
> Hi Chris,
> 
> Thanks for reporting this.  I've raised it as
> https://git.cyrus.foundation/T207 and will look at it today.
> 
> Cheers,
> 
> ellie
> 
> On Thu, Jul 9, 2015, at 01:06 AM, Chris Stromsoe wrote:
> > I'm seeing a segfault running ctl_mboxlist -d with 2.5.4.  mailboxes.db 
> > format is twoskip.  All mailbxoes are on the default partition.
> > 
> > gdb traces it back to this printf() in dump_cb():
> > 
> >      case DUMP:
> >          if (!d->partition || !strcmpsafe(d->partition, part)) {
> >              printf("%s\t%d %s %s\n", name, mbtype, part, acl);
> >              if (d->purge) {
> >                  cyrusdb_delete(mbdb, key, keylen, &(d->tid), 0);
> >              }
> >          }
> >          break;
> > 
> > 
> > Initializing part to NULL at the start of the function fixes the
> > segfault.
> > 
> > The mailbox causing the problem has MBTYPE_DELETED.  Tracing through the 
> > logic earlier in dump_cb(), the call to dlist_getatom() is failing but
> > the 
> > partition is not being set to NULL because the if explicitly excludes 
> > mailboxes of MBTYPE_DELETED.
> > 
> >              // The partition is always there...
> >              r = dlist_getatom(dl, "P", (const char **)&part);
> > 
> >              if (!r && !(mbtype & MBTYPE_DELETED)) {
> >                  syslog(
> >                          LOG_ERR,
> >                          "No partition for mailbox '%s'",
> >                          name
> >                      );
> > 
> >                  part = NULL;
> >              }
> > 
> > The test should probably be rewritten to be:
> > 
> >              if (!r) {
> >                  if (!(mbtype & MBTYPE_DELETED)) {
> >                      syslog(
> >                              LOG_ERR,
> >                              "No partition for mailbox '%s'",
> >                              name
> >                          );
> >                  }
> >                  part = NULL;
> >              }
> > 
> > 
> > 
> > -Chris


More information about the Cyrus-devel mailing list