misaligned data
Two more tidbits on the misaligned data problem in 2.5.53:
o using -g instead of -O2 compiles just fine
o The generating the warning is the "tv_add" call in sctp_pack_cookie():
...
/* Set an expiration time for the cookie. */
do_gettimeofday(&cookie->c.expiration);
tv_add(&asoc->cookie_life, &cookie->c.expiration);
...But I'm under the impression the do_gettimeofday() above would puke when trying to access the same misaligned timeval_t as well. tv_add() catches the problem since it is a macro and code gets generated to directly reference the struct instead of an anonymous address.
The asm output is:
...
ldw 5144(%r8),%r19
ldw 8(%r6),%r20
add,l %r20,%r19,%r20
ldd 5136(%r8),%r21
ldd 52(%r3),%r19 # line 2347 is misaligned.
extrd,s %r20,63,32,%r20
add,l %r19,%r21,%r25
ldil L'999999,%r19
cmpb,*>= %r19,%r20,.L1873
copy %r4,%r27
ldil L'-1000000,%r19
ldo 1(%r25),%r25
ldo R'-1000000(%r19),%r19
add,l %r20,%r19,%r20
.L1873:
std %r25,52(%r3) # also misalignedBased on the math, looks like %r25 has the "seconds" field and %r19 the microseconds.
Oh, only one definition and usage of tv_add().
The offending field is "&cookie->c.expiration".
cookie is type "sctp_signed_cookie_t". (include/net/sctp/structs.h)
/* The format of our cookie that we send to our peer. */
typedef struct sctp_signed_cookie {
__u8 signature[SCTP_SECRET_SIZE];
sctp_cookie_t c;
} sctp_signed_cookie_t;struct sctp_cookie mostly uses __u32 except for "struct timeval expiration". "struct timeval" is declared in include/linux/time.h.
Not sure if it's safe to just pad "struct sctp_cookie" or if something else needs to be done.
If this isn't a parisc toolchain bug, then other arches (eg ia64) will need a fix as well.
cheers,
grant
Quoted 17 lines
ldd 52(%r3),%r19 # line 2347 is misaligned. std %r25,52(%r3) # also misalignedBased on the math, looks like %r25 has the "seconds" field and %r19 the microseconds.
Oh, only one definition and usage of
tv_add().
The offending field is "&cookie->c.expiration".
cookie is type "sctp_signed_cookie_t". (include/net/sctp/structs.h)/* The format of our cookie that we send to our peer. */
typedef struct sctp_signed_cookie { __u8 signature[SCTP_SECRET_SIZE]; sctp_cookie_t c; } sctp_signed_cookie_t;
Quoted 4 lines
struct
sctp_cookiemostly uses__u32except for "struct timeval expiration". "struct timeval" is declared ininclude/linux/time.h.
Not sure if it's safe to just pad "structsctp_cookie" or if something else needs to be done.
I'd wonder more about the packed attribute on sctp_init_chunk_t and sctp_inithdr_t. What version of gcc?
Dave
Signature · 2 lines
J. David Anglin [email protected] National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
Quoted 2 lines · John David Anglin
I'd wonder more about the packed attribute on
sctp_init_chunk_tandsctp_inithdr_t. What version of gcc?
sorry...I overlooked the attribute.
gcc version 3.0.4
I don't recall if I tried gcc-3.2.
thanks,
grant
On Fri, Dec 27, 2002 at 09:49:18PM -0500, John David Anglin wrote:
...
Quoted 5 lines
Quoted 2 lines
Not sure if it's safe to just pad "struct
sctp_cookie" or if something else needs to be done.I'd wonder more about the packed attribute on
sctp_init_chunk_tandsctp_inithdr_t.
I think that's the problem.
I've wimped out and just disabled CONFIG_IP_SCTP.
I really want to chase final problems with 2.4 and get $#@&% XF86 working on the OB600CT again (yes, XF86 4.0 worked, 4.2 does not :^( )
Quoted 1 line
What version of gcc?
In reflecting on it a bit more, I'm pretty sure I tried gcc-3.2 and came to the same result.
("gcc version 3.2.2 20021212 (Debian prerelease)")
grant
Quoted 4 lines
Quoted 2 lines
I'd wonder more about the packed attribute on
sctp_init_chunk_tandsctp_inithdr_t.I think that's the problem.
I am not aware of any specific code in the backend related to the handling of packed structures. So, this is likely a generic problem, maybe on big endian machines.
Quoted 5 lines
Quoted 1 line
What version of gcc?
In reflecting on it a bit more, I'm pretty sure I tried gcc-3.2 and came to the same result.
("gcc version 3.2.2 20021212 (Debian prerelease)")
There are some fixes in the passing of small structs in 3.3 (less than 8 bytes). This affects varargs and library functions that pass small structs by value.
Dave
Signature · 2 lines
J. David Anglin [email protected] National Research Council of Canada (613) 990-0752 (FAX: 952-6605)