Hi all.
We got a SIGBUS (due to an alignment violation)
running ca_test (and other apps)
EPICS: 3.14.0.beta1
system: solaris-sparc-gnu
compiler: egcs-2.91.66
I found that
void *
tsFreeList<T,N,DEBUG_LEVEL>::allocate(size_t)
may return improperly aligned memory:
Because 'items' are declared
union {
tsFreeListItem<T,...> *pNext;
char pad[sizeof(T)];
}
the compiler only makes sure 'items' fulfill
the alignment requirements of pNext.
However, 'items' may need stricter alignment
(which goes unnoticed because the 'item' pointer
is later cast to (void*)): e.g. it may contain a double
which on sparc needs to be 8byte aligned...
The proposed fix is to put the 'items' into a
chunk first, so they get the chunk's alignment.
Unfortunately, this fix breaks binary compatibility
- everything needs to be rebuilt.
Regards,
-- Till
Patch against base-3.14-beta1
Index: src/libCom/cxxTemplates/tsFreeList.h
===================================================================
RCS file: /afs/slac/g/spear/cvsrep/epics/base/src/libCom/cxxTemplates/tsFreeList.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** src/libCom/cxxTemplates/tsFreeList.h 2002/03/09 18:09:30 1.1.1.1
--- src/libCom/cxxTemplates/tsFreeList.h 2002/04/05 00:52:34 1.2
***************
*** 74,81 ****
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >
struct tsFreeListChunk {
! tsFreeListChunk < T, N, DEBUG_LEVEL > *pNext;
tsFreeListItem < T, DEBUG_LEVEL > items [N];
};
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >
--- 74,84 ----
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >
struct tsFreeListChunk {
! /* Till Straumann <[email protected]>, 2002/4/4
! * put the items first to maintain alignment.
! */
tsFreeListItem < T, DEBUG_LEVEL > items [N];
+ tsFreeListChunk < T, N, DEBUG_LEVEL > *pNext;
};
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >
- Replies:
- RE: ca_test bus error on solaris-sparc-gnu + fix Jeff Hill
- Navigate by Date:
- Prev:
Re: seq 1.9.5 restored to ftp site F. Gougnaud
- Next:
Re: seq 1.9.4 Benjamin Franksen
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
<2002>
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: seq 1.9.5 restored to ftp site F. Gougnaud
- Next:
RE: ca_test bus error on solaris-sparc-gnu + fix Jeff Hill
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
<2002>
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|