Re: V2.1.57 hangs when overwriting libc

Matthias Urlichs (smurf@lap.noris.de)
10 Oct 1997 13:37:52 +0200


David Woodhouse <dwmw2@cam.ac.uk> writes:
> olaf@bigred.inka.de said:
>
> > Wrong. You'll overwrite the code in the library which is mapped by
> > about every process in the system with something else and trash
> > running images - new libraries tend to have different code from old
> > ones ;-)
>
> Indeed true. But he was only restoring from a backup, and the library coming
> out of the tar file was identical to the one in place.
>
While it was copied over, the library was quite a bit shorter.

Tar opens its files with O_WRONLY|O_NONBLOCK|O_APPEND|O_CREAT|O_TRUNC,
cp with O_WRONLY|O_CREAT|O_TRUNC. Therefore, at least the swap-in of
unmodified pages from the library would fail.

Presumably, the kernel should notice this and keep a copy of the
MAP_PRIVATEd pages around somehow (presumably by reading them when they're
about to be overwritten / the file is truncated), but currently it doesn't
do that.

-- 
Matthias Urlichs
noris network GmbH