Problem report: Struct aliasing problem causes Thread_Ready_Chain corruption in 4.6.99.3

Peer Stritzinger peerst at gmail.com
Wed Nov 22 09:06:28 UTC 2006


Till,

On 11/22/06, Till Straumann <strauman at slac.stanford.edu> wrote:
> FYI
>
> linux (2.6.18) is built with -fno-strict-aliasing and I believe that's
> what we
> should do. It is extremely hard to find all problematic cases of aliasing
> and as someone pointed out, as gcc gets smarter we'll run into more
> problems.

FreeBSD 6.1 sets -fno-strict-aliasing in the kernel and kernel module makefiles.

. if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing)
CFLAGS+=        -fno-strict-aliasing

> Look e.g., at networking code where a checksum of a header is computed.
> Type-punning is pretty common in these situations and I wouldn't trust
> old BSD code to be written with strict aliasing in mind.

>From my time working for BSDi (the guys who wrote most of the
networking code when they were at Berkley) I remember that they
avoided -O2 when building the kernel
because BSD kernels break strict aliasing altogether.

>From what I have seen in the 4.4-BSD Lite2 network stack when I ported
it into a different embedded systems environment I can say it
definitely does not adhere
to strict aliasing.

Regards,
-- Peer



More information about the users mailing list