Subject: Re: Squid on Alpha blows up..
To: None <buehler@skycache.com, netbsd-ports@netbsd.org>
From: Ross Harvey <ross@ghs.com>
List: netbsd-ports
Date: 03/02/1999 14:44:26
The program contains what is almost certainly an illegal C construct where
it is probably playing with pointers instead of letting the compiler allocate
all objects. This is kind of common in network programs, where people define
a struct that mirrors a protocol frame, and then they think they can just
cast pointers of arbitrary types and make them point at arbitrary alignments
within the frame.

The only safe way to deal with data packed into a protocol frame is to
memcpy() each object out to a compiler-allocated variable or field before
touching it. (And if more programmers would do this, then the compilers
would probably be taught to optimize it away so there isn't a time penalty
when it wasn't necessary for a given target.)

Sometimes the problem involves assumptions about the length of ints or
longs.

The kernel is correctly (if a bit slowly) fixing up those unaligned memory
ops for you. There is a sysctl that will turn off the messages.

The best solution is to fix the program. It's a red flag, and there is some
(small) chance that the program is not even working correctly. It would be
nice to see with gdb(1) what line is actually triggering this message. If
you can tell me where this is happening I can fix the squid code for you.

	Ross.Harvey@Computer.Org