Subject: Re: The _weirdest_ segfault...
To: Andreas Falck <email@example.com>
From: Peter Seebach <firstname.lastname@example.org>
Date: 05/17/2000 16:27:13
In message <Pine.GSO.email@example.com>, Andrea
s Falck writes:
>Yes, but it's not the writes or reads that segfaults, it's
Yes. Because malloc() is making decisions based on corrupted data.
>The shell works perfectly on FreeBSD/x86 where it was developed, the
>problem is only on the Alpha!
No surprise; the rules are different, the way memory is laid out may vary.
p = malloc(16);
1. 16 bytes are allocated.
2. Something, somewhere, makes a note that that 16 byte area is allocated.
That latter data is *also* in dynamically allocated space. It may be adjacent
to the 16 bytes. If you overwrite it, you are not doing anything that
"should" segfault (you're still writing to memory owned by your process), but
you are corrupting the data malloc() will use to make later decisions about
Anyway, if it were an alignment thing, you'd either get no crashes, or a bus
error. Segfault is access to memory you don't own, which is consistent with