[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: memory alignment errors (ITS#2760)



Probably should use a union with a long here to ensure proper
alignment....

Kurt

At 03:56 PM 10/9/2003, hyc@symas.com wrote:
>> -----Original Message-----
>> From: owner-openldap-bugs@OpenLDAP.org
>> [mailto:owner-openldap-bugs@OpenLDAP.org]On Behalf Of
>richton@nbcs.rutgers.edu
>
>> Full_Name: Aaron Richton
>> Version: HEAD, 2.1.22
>> OS: sparc64-solaris
>> URL:
>> Submission from: (NULL) (165.230.41.99)
>
>> When compiling under the Sun Studio compilers for Solaris
>> 9/sparc64 (64 bit
>> code), slapd dies with a SIGBUS. You can easily reproduce
>> this with a run of
>> test000 (see below, run under HEAD) eg:
>>
>> CC='/opt/SUNWspro/bin/cc' CFLAGS='-xarch=v9' ./configure
>> make depend;make;make test
>
>> dbx stack trace from test000:
>> t@3 (l@3) signal BUS (invalid address alignment) in ber_init2
>> at line 307 in
>> file "io.c"
>>   307           ber->ber_tag = LBER_DEFAULT;
>
>> =>[1] ber_init2(ber = 0xffffffff7cbff5bc, bv =
>> 0xffffffff7cbfe568, options = 1),
>> line 307 in "io.c"
>>   [2] slap_send_search_entry(op = 0x100386bb0, rs =
>> 0xffffffff7cbffae0), line
>> 674 in "result.c"
>
>Interesting. This bug affects 4 files in the tree - passwd.c, result.c,
>str2filter.c, and back-bdb/search.c. It never appeared in my tests of 64bit
>on Solaris, but I use gcc. Can you try this, as a test - in the above files,
>replace all occurrences of "char berbuf[LBER_ELEMENT_SIZEOF]" with "int
>berbuf[LBER_ELEMENT_SIZEOF]" and see if that changes things. This assumes
>that "int" actually is aligned on a 64-bit boundary. If not, use some other
>type that is.
>
>  -- Howard Chu
>  Chief Architect, Symas Corp.       Director, Highland Sun
>  http://www.symas.com               http://highlandsun.com/hyc
>  Symas: Premier OpenSource Development and Support