Squatter BUS error.

Andy Fiddaman cyrus at fiddaman.net
Wed Jun 30 04:05:08 EDT 2004

I am running Cyrus IMAP 2.2.6 as a 64-bit binary on Solaris 9. I don't
know whether this is officially supported but it is running perfectly
apart from one small problem; that squatter crashes when indexing
mailboxes due to an address alignment error.

The crash is being caused by the ntohl() call in annotate.c:split_attribs()
(Note that on this architecture, an unsigned long is 64-bits)

    attrib->size = (size_t) ntohl(*(unsigned long *) data);

Changing this line to

    attrib->size = (size_t) ntohl(*(uint32_t *) data);

stops the crashes but I don't know enough about what's going on here to
know if this is a good fix.

If anyone has any ideas about the proper way to fix this that would be



12588/1:            Incurred fault #5, FLTACCESS  %pc = 0x100030D30
12588/1:              siginfo: SIGBUS BUS_ADRALN addr=0xFFFFFFFF7CF00334
12588/1:            Received signal #10, SIGBUS [default]
12588/1:              siginfo: SIGBUS BUS_ADRALN addr=0xFFFFFFFF7CF00334

(gdb) where
#0  split_attribs (
    data=0xffffffff7cf00334 <Address 0xffffffff7cf00334 out of bounds>,
    datalen=32, attrib=0xffffffff7fffce30) at sys/byteorder.h:139
#1  0x00000001000329e4 in annotatemore_lookup (
    mboxname=0xffffffff7cf00334 <Address 0xffffffff7cf00334 out of bounds>,
    entry=0x20 <Address 0x20 out of bounds>, userid=0xffffffff7fffce30 "",
    attrib=0xffffffff7fffce30) at annotate.c:1199
#2  0x0000000100008bd8 in index_me (
    name=0xffffffff7fffe1b0 "mydomainx.co.uk!user.xx", matchlen=23,
    maycreate=1, rock=0xffffffff7fffe0e0) at squatter.c:319
#3  0x000000010002284c in find_cb (rockp=0xffffffff7fffe940,
    key=0xffffffff7ce004a4 <Address 0xffffffff7ce004a4 out of bounds>,
    data=0xffffffff7ce004c0 <Address 0xffffffff7ce004c0 out of bounds>,
    datalen=62) at mboxlist.c:1853
#4  0x0000000100044ab4 in myforeach (db=0x1001e0e30,
    prefix=0xffffffff7fffe560 "*", prefixlen=0, goodp=0x10002238c <find_p>,
    cb=0x1000226f8 <find_cb>, rock=0xffffffff7fffe940, tid=0x0)
    at sys/byteorder.h:141
#5  0x0000000100022f2c in mboxlist_findall (namespace=0x1001d2f28,
    pattern=0xffffffff7fffea80 "*", isadmin=1, userid=0x0, auth_state=0x0,
    proc=0x1000084ac <index_me>, rock=0xffffffff7fffe940) at mboxlist.c:2032
#6  0x0000000100009150 in main (argc=2, argv=0xffffffff7ffffb58)
    at squatter.c:529

(gdb) frame 0
#0  split_attribs (
    data=0xffffffff7cf00334 <Address 0xffffffff7cf00334 out of bounds>,
    datalen=32, attrib=0xffffffff7fffce50) at sys/byteorder.h:139
139     {

(gdb) list
135     /* Convert a network long to a host long.  */
137     static __inline__ unsigned long
138     ntohl (unsigned long __arg)
139     {
140       return htonl (__arg);
141     }

Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

More information about the Info-cyrus mailing list