Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jan 2008 21:49:39 +0000
From:      Nicholas Clark <nick@ccl4.org>
To:        Mark Tinguely <tinguely@casselton.net>
Cc:        freebsd-arm@freebsd.org, des@freebsd.org
Subject:   Re: sshd broken on arm?
Message-ID:  <20080118214939.GB23703@plum.flirble.org>
In-Reply-To: <200801181915.m0IJFndO057697@casselton.net>
References:  <20080118185634.GA28843@zibbi.meraka.csir.co.za> <200801181915.m0IJFndO057697@casselton.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 18, 2008 at 01:15:49PM -0600, Mark Tinguely wrote:
> 
> <deleted background on sshd failing>

> >  In a C function if you have something like "char tmp[4]", can you assume
> >  that the compiler will align it on a 4 byte boundary or can it do it on
> >  a byte boundary?
> 
> No it will not automatically be align correctly to be used as a integer.
> 
> >  If one cannot access unaligned ints and char arrays are not int aligned,
> >  then we were just lucky that the code worked at some stage.
> 
> The items above this array were probably a multiple of 4 bytes and something
> has changed in a structure to make this no longer true. You can find the
> offending structure and pad it to make it a multiple of 4 bytes, or cheat
> and declare a integer before the char array.

Or put the char array in a union with an integer, although that might require
too many changes in other parts of the code.

Nicholas Clark



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080118214939.GB23703>