From: jem@snakemail.hut.fi (Johan Myreen) Subject: Re: ANNOUNCE: Linux 0.98 pl5 Date: 16 Nov 1992 19:35:59 GMT
In article <1992Nov15.220138.5434@klaava.Helsinki.FI> torvalds@klaava.Helsinki.FI (Linus Torvalds) writes:
>NOTE! READ THIS AND PONDER:
>pl5 now checks against writing to the text segment. Older binaries
>which used the original estdio library (used with the earliest gcc
>versions) are liable to break: not that there should be many of these
>binaries around. So if you get "Segmentation fault (core dumped)" on
>binaries you know used to work, this is the likely cause.
Before the "bug reports" start coming in, I'd like to point out one
consequence of write-protected text segments. Gcc puts strings in the
text segment, and is entitled to do so, since the C standard says
string literals are const.
This breaks code modifying string literals, like for instance the
mktemp library function when called like this: mktemp("/tmp/fooXXXXXX").
This is not a bug in Linux or Gcc, but in *your* application, if you
use mktemp like this, or do tricks like "bar"[2]++...