Alignment fixups for gethostbyname_r

Carmelo Amoroso carmelo73 at
Sun Jan 6 08:53:11 UTC 2008

Mike Frysinger wrote:
> On Saturday 22 December 2007, Carmelo Amoroso wrote:
>> 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.
>> 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.
> i dont think so.  the gethostbyname_r() API takes a char* for its scratch 
> space which means no alignment requirements are stipulated.  
Right, I was completely wrong ;-)


More information about the uClibc mailing list