* cc'ing a program crashes a running copy?
@ 1995-02-09 5:54 Andrej Panjkov
1995-02-09 11:50 ` Arndt Brenschede
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Andrej Panjkov @ 1995-02-09 5:54 UTC (permalink / raw)
Hi--
On an ALPHA 3000/300x with DEC OSF/1 3.05, this strange thing happens:
Suppose 'prog' is the executable form prog.c.
Suppose prog is running.
Compile prog.c in another window (cc -o prog prog.c).
When cc finishes, the excuting copy of prog crashes with a memory fault!?
What th'...?
Get this too: if prog is running and I recompile prog giving the new
executable a new name (cc -o xxx prog.c), prog doesn't crash.
Why should overwriting the executable on disk crash the corresponding
active process in memory? Is this some weird sort of dynamic execution
thing that I don't know about?
Please explain this to me, and suggest a fix/workaround.
Thanks for reading, and thanks in advance for your help.
--
Andrej Panjkov, La Trobe Maths, matap@lure.latrobe.edu.au
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: cc'ing a program crashes a running copy?
1995-02-09 5:54 cc'ing a program crashes a running copy? Andrej Panjkov
@ 1995-02-09 11:50 ` Arndt Brenschede
1995-02-09 22:06 ` Andrew Gabriel
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Arndt Brenschede @ 1995-02-09 11:50 UTC (permalink / raw)
--
In article <matap-090295165458@guardian.maths.latrobe.edu.au>, matap@lure.latrobe.edu.au (Andrej Panjkov) writes:
|> Hi--
|>
|> On an ALPHA 3000/300x with DEC OSF/1 3.05, this strange thing happens:
|>
|> Suppose 'prog' is the executable form prog.c.
|> Suppose prog is running.
|> Compile prog.c in another window (cc -o prog prog.c).
|>
|> When cc finishes, the excuting copy of prog crashes with a memory fault!?
|>
|> What th'...?
|>
|> Get this too: if prog is running and I recompile prog giving the new
|> executable a new name (cc -o xxx prog.c), prog doesn't crash.
|>
|> Why should overwriting the executable on disk crash the corresponding
|> active process in memory? Is this some weird sort of dynamic execution
|> thing that I don't know about?
|>
|> Please explain this to me, and suggest a fix/workaround.
|>
The reason is that the part of the executable that is not in physical memory
is not somewhere else in virtual memory, but only on the disk from where
you startet it. So when you overwrite the executable, the program must
crash. (This is not the case if the executable is on a NFS-mounted disk!)
However, it is somewhat strange that it is possible to overwrite
a running executable. On Ultrix, this was avoided by a mechanism called
'file locking'.
================================================================
Arndt Brenschede, Dipl.-Phys.
II. Physikalisches Institut der Uni Giessen
Heinrich-Buff-Ring 16, 35392 Giessen (Germany)
Tel: 0641-702-2787
Fax: 0641-74390
Mail: arndt@marvin.physik.uni-giessen.de
================================================================
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: cc'ing a program crashes a running copy?
1995-02-09 5:54 cc'ing a program crashes a running copy? Andrej Panjkov
1995-02-09 11:50 ` Arndt Brenschede
@ 1995-02-09 22:06 ` Andrew Gabriel
1995-02-17 15:22 ` Joerg Czeranski
1995-02-10 8:09 ` Stefan Monnier
1995-02-16 15:25 ` Hartmut Streppel
3 siblings, 1 reply; 6+ messages in thread
From: Andrew Gabriel @ 1995-02-09 22:06 UTC (permalink / raw)
Cc: matap
In article <matap-090295165458@guardian.maths.latrobe.edu.au>
matap@lure.latrobe.edu.au "Andrej Panjkov" writes:
> Suppose 'prog' is the executable form prog.c.
> Suppose prog is running.
> Compile prog.c in another window (cc -o prog prog.c).
>
> When cc finishes, the excuting copy of prog crashes with a memory fault!?
>
> What th'...?
>
> Get this too: if prog is running and I recompile prog giving the new
> executable a new name (cc -o xxx prog.c), prog doesn't crash.
>
> Why should overwriting the executable on disk crash the corresponding
> active process in memory? Is this some weird sort of dynamic execution
> thing that I don't know about?
Some unixs swap in the read-only parts of a running process from
the executable file, rather than the swap slice. It looks like this
one does so from what you say. Normally, they protect the running
process by preventing overwriting of the file whilst it's being
executed; looks like this one doesn't :-(.
--
Andrew Gabriel Home: Andrew@cucumber.demon.co.uk
Consultant Software Engineer Work: Andrew.Gabriel@net-tel.co.uk
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: cc'ing a program crashes a running copy?
1995-02-09 5:54 cc'ing a program crashes a running copy? Andrej Panjkov
1995-02-09 11:50 ` Arndt Brenschede
1995-02-09 22:06 ` Andrew Gabriel
@ 1995-02-10 8:09 ` Stefan Monnier
1995-02-16 15:25 ` Hartmut Streppel
3 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 1995-02-10 8:09 UTC (permalink / raw)
In article <matap-090295165458@guardian.maths.latrobe.edu.au>,
Andrej Panjkov <matap@lure.latrobe.edu.au> wrote:
] Suppose 'prog' is the executable form prog.c.
] Suppose prog is running.
] Compile prog.c in another window (cc -o prog prog.c).
]
] When cc finishes, the excuting copy of prog crashes with a memory fault!?
The file is probably on an NFS server. NFS doesn't deal too well with
open files that get destroyed (or overwritten).
NFS has that bad habit of not following the usual semantics of the
unix file system. It looks like a plain unix file system, but it
really isn't. I guess the only remote file system that can claim to be
semantically compatible with ufs is Sprite.
Stefan
--
--------------------------------------------------------------------
-- Suicidez-vous jeune, vous profiterez plus longtemps de la mort --
--------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: cc'ing a program crashes a running copy?
1995-02-09 5:54 cc'ing a program crashes a running copy? Andrej Panjkov
` (2 preceding siblings ...)
1995-02-10 8:09 ` Stefan Monnier
@ 1995-02-16 15:25 ` Hartmut Streppel
3 siblings, 0 replies; 6+ messages in thread
From: Hartmut Streppel @ 1995-02-16 15:25 UTC (permalink / raw)
It is correct that the VM systems uses the file system as paging space for the
text portion of a binary. I was told that the use of mmap makes it impossible
to deliver the good old behaviour that caused the error ETXTBSY (write on o
busy text file) to be generated; i.e. overwriting pages which are active
as parts of the VM system make them dirty pages and the running process
will reclaim
them .mmap experts might be able to think of the reasons why mmap does
need this behaviour.
Regarding the standards, POSIX .1 lists the ETXTBSY errno only as
optional. It would be interesting to know whether other systems that
support mmap have
the same behaviour or not.
Hartmut
#include <std/disclaimer.h>
-------------------------------------------------------------------------------
Hartmut Streppel Internet: hst@mfr.dec.com
Digital Equipment
Postfach 810247 Tel: +49-(0)89-9591-2562
D-81902 Muenchen FAX: +49-(0)89-9591-2281
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: cc'ing a program crashes a running copy?
1995-02-09 22:06 ` Andrew Gabriel
@ 1995-02-17 15:22 ` Joerg Czeranski
0 siblings, 0 replies; 6+ messages in thread
From: Joerg Czeranski @ 1995-02-17 15:22 UTC (permalink / raw)
Andrew Gabriel (Andrew@cucumber.demon.co.uk) wrote:
] In article <matap-090295165458@guardian.maths.latrobe.edu.au>
] matap@lure.latrobe.edu.au "Andrej Panjkov" writes:
] > Suppose 'prog' is the executable form prog.c.
] > Suppose prog is running.
] > Compile prog.c in another window (cc -o prog prog.c).
] >
] > When cc finishes, the excuting copy of prog crashes with a memory fault!?
] >
] > What th'...?
] >
] > Get this too: if prog is running and I recompile prog giving the new
] > executable a new name (cc -o xxx prog.c), prog doesn't crash.
] >
] > Why should overwriting the executable on disk crash the corresponding
] > active process in memory? Is this some weird sort of dynamic execution
] > thing that I don't know about?
] Some unixs swap in the read-only parts of a running process from
] the executable file, rather than the swap slice. It looks like this
] one does so from what you say. [...]
A simple workaround is to "rm prog" (or "mv prog prog.running") before
compiling. This ensures that the compiler creates "prog" with a
new inode and your running "prog" won't crash.
joerg
--
Joerg Czeranski EMail czeranski@informatik.tu-clausthal.de
Osteroeder Strasse 55 czeranski@rz.tu-clausthal.de
D 38678 Clausthal-Zellerfeld WWW http://www.in.tu-clausthal.de/~injc/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1995-02-17 15:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-02-09 5:54 cc'ing a program crashes a running copy? Andrej Panjkov
1995-02-09 11:50 ` Arndt Brenschede
1995-02-09 22:06 ` Andrew Gabriel
1995-02-17 15:22 ` Joerg Czeranski
1995-02-10 8:09 ` Stefan Monnier
1995-02-16 15:25 ` Hartmut Streppel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox