current cvs segfault on Debian hppa

Gyepi SAM gyepi at praxis-sw.com
Thu Oct 3 14:02:21 CEST 2002


On Thu, Oct 03, 2002 at 12:33:03AM -0500, Eric Seppanen wrote:
> On Wed, Oct 02, 2002 at 08:47:03PM -0400, Clint Adams wrote:
> > $1 = (struct hashnode_t *) 0x3f4f9
> > (gdb) p *p
> > $2 = {key = 0x3f50d "jae at jerhard.org", buf = 0x3f509, next = 0x0, 
> >   iter_next = 0x4ff0b}
> 
> This makes me wonder if the memory allocation in the wordhash functions 
> are getting the data alignment right.  If I remember correctly, x86 allows 
> you to get away with stupid things like pointers at odd addresses, while 
> other architectures do not.
> 
> The pointer above has a value of 0x3f4f9, an odd address.  That makes me 
> worry.
> 
> Oooh.  Look here: when we call 
> 
> hmalloc(h, sizeof(hashnode_t) + n + m);;  <-- (btw: ;; typo in code?)
> 
> where m is a string length, we're going to throw the alignment all out of 
> whack and start storing unaligned structures.  Even if this isn't the 
> problem in this case, I belive that dropping structures into unaligned 
> locations in memory is at best poor coding and a performance hit, and at 
> worst will cause bus errors on some architectures.
> 
> Someone back me up on this: if hmalloc() is returning odd addresses and 
> we're laying down structures at that address, we're broken on many 
> architectures, right?

You are right on all counts. I had combined the hmalloc calls in an attempt to
be efficient, but had not thought about the alignment issue in other platforms.
I have since recanted my ways and fixed the code, and have been working with Clint offlist
to solve the problem.  I'll post a patch as soon as we have a solution.

-Gyepi


For summay digest subscription: bogofilter-digest-subscribe at aotto.com



More information about the Bogofilter mailing list