64-bit alignment problems.

Andy Fiddaman cyrus at fiddaman.net
Sun Sep 9 14:46:18 EDT 2007


On Fri, 7 Sep 2007, Ken Murchison wrote:

; We have been running 2.3.x code on 64-bit sparcv9 kernels (Solaris 8 on Sun
; Fire V240) without any problem.  What is your hardware and OS?

The test server is a Sun V210 running
SunOS xxx 5.10 Generic_125100-10 sun4u sparc SUNW,Sun-Fire-V210

(Solaris 10u2 fully patched as of ~4 weeks ago)

I've compiled Cyrus as a 64-bit application:

# file /opt/cyrus/bin/imapd
/opt/cyrus/bin/imapd:   ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped

CFLAGS="-g -fPIC" ./configure \
        --prefix=/opt/cyrus \
        --with-cyrus-prefix=/opt/cyrus \
        --sysconfdir=/opt/cyrus/etc \
        --with-openssl=/opt/openssl \
        --with-sasl=/opt/CYRsasl2 \
        --with-bdb=/opt/bdb \
        --with-bdb-incdir=/opt/bdb/include \
        --with-bdb-libdir=/opt/bdb/lib \
        --enable-replication \
        --enable-murder \
        --with-perl=/opt/perl/bin/perl

Without the patches I get a lot of Bus errors in various processes,
examples below - as you can see they're all related to an unaligned 64-bit
dereference.

Program terminated with signal 10, Bus error.
#0 0x0000000100060138 in mailbox_index_record_to_buf (
record=0xffffffff7fffdb20, buf=0xffffffff7fffd9ec "") at mailbox.c:1372
1372 *((bit64 *)(buf+OFFSET_MODSEQ_64)) = htonll(record->modseq);

Program terminated with signal 10, Bus error.
#0 0x0000000100062b78 in mailbox_expunge (mailbox=0x100270558, decideproc=0,
deciderock=0x0, flags=0) at mailbox.c:2194
2194 *((bit64 *)(buf+OFFSET_QUOTA_MAILBOX_USED64)) = htonll(0);

Program terminated with signal 10, Bus error.
#0 0x0000000100009e38 in restore_expunged (mailbox=0xffffffff7fffe618,
msgs=0x100202900, eexists=1, expunge_index_base=0xffffffff7a100000 "",
numrestored=0xffffffff7fffd584, unsetdeleted=0) at unexpunge.c:307
307 newquotaused =

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);

etc. etc.



More information about the Info-cyrus mailing list