64-bit alignment problems.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm finally getting around to upgrading my 2.3.7 system to 2.3.9. When I
put in 2.3.7 I had to patch a few things to make it work properly on
64-bit SPARC, mainly unaligned dereferences causing BUS faults due to
the SPARC MMU.

Thankfully 2.3.9 has most of these sorted, mainly through using align_htonll()
and friends to force aligned accesses, but at least one place still
causes a crash for me.

Here's the patch, could it be included in the next release? I did send
the patches to cyrus-bugs@xxxxxxxxxxxxxx at the time but never got a
response, nor did they get fixed in subsequent releases so apologies if
anyone feels this is the wrong forum for this.

--- cyrus-imapd-2.3.9.dist/imap/annotate.c      2007-08-15 17:20:55.000000000 +0000
+++ cyrus-imapd-2.3.9/imap/annotate.c   2007-09-04 15:01:48.066105997 +0000
@@ -310,7 +310,8 @@

     /* xxx use datalen? */
     /* xxx sanity check the data? */
-    attrib->size = (size_t) ntohl(*(unsigned long *) data);
+    memcpy(&tmp, data, sizeof(unsigned long));
+    attrib->size = (size_t) ntohl(tmp);
     data += sizeof(unsigned long); /* skip to value */

     attrib->value = data;

and a backtrace from cyr_expire..

Program terminated with signal 10, Bus error.
#0  0x000000010002af64 in split_attribs (data=0xffffffff7c017014 "",
    datalen=30, attrib=0xffffffff7fffeed0) at annotate.c:313
313         attrib->size = (size_t) ntohl(*(unsigned long *) data);
(gdb) where
#0  0x000000010002af64 in split_attribs (data=0xffffffff7c017014 "",
    datalen=30, attrib=0xffffffff7fffeed0) at annotate.c:313
#1  0x000000010002e094 in annotatemore_lookup (
    mboxname=0xffffffff7fffeef5 "blah.com!user.fred",
    entry=0x100061990 "/vendor/cmu/cyrus-imapd/expire", userid=0x1000619b0 "",
    attrib=0xffffffff7fffeed0) at annotate.c:1349

Thanks,

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

[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux