Alignment fixups for gethostbyname_r

Carmelo Amoroso carmelo73 at gmail.com
Sat Dec 22 06:35:10 UTC 2007


Daniel Jacobowitz wrote:
> MontaVista noticed that when their kernels were configured to trap
> on unaligned access gethostbyname_r could mysteriously crash.  I
> tracked this down to an unaligned buffer being passed to
> gethostbyname_r from some other part of uClibc (afraid I don't
> remember where from any more).  We have to pad the beginning of
> the buffer to a pointer alignment before we store pointers in
> it.
> 
> Is this patch OK?
> 
Hi Daniel,
I've merged it into my sh4-nptl branch to do some tests,
but not possible until Jan 3rd.
The patch is surely ok, but, the caller of the gethostbyname is the
real cause of the error, that could happen in some other part,
being the passed buffer unaligned.
So, if you could go back in your mind and remember the scenario,
will be really useful.
I've also seeing misaligned access message from kernel in hald on sh4 box,
but unfortunately it's not related to this.

Cheers,
Carmelo



More information about the uClibc mailing list