Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Re: Overwriting exe's crashes osf programs ? Why
  1996-02-22  5:00 Overwriting exe's crashes osf programs ? Why levine
  1996-02-22  5:00 ` Thomas Graichen
@ 1996-02-22  5:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
  1996-02-22  5:00 ` Jeffrey M. Denham
  2 siblings, 0 replies; 8+ messages in thread
From: Alan Rollow - Dr. File System's Home for Wayward Inodes. @ 1996-02-22  5:00 UTC (permalink / raw)



In article <4gie5u$ngn@lal.interserv.net>, levine@amarex.com writes:

>When we overwrite executables on disk programs running that exe crash..
>Can I aviod with any link options ??? 

Yes.  Use the -o option to specify a different file so that you don't
overwrite the running version.  I prefer the ULTRIX behavior (BSD?)
where trying to write on a running program would fail with ETXTBSY.

>		 Jeremy Levine - levine@amarex.com
--
Alan Rollow				alan@nabeth.cxo.dec.com




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Overwriting exe's crashes osf programs ? Why
  1996-02-22  5:00 Overwriting exe's crashes osf programs ? Why levine
  1996-02-22  5:00 ` Thomas Graichen
  1996-02-22  5:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
@ 1996-02-22  5:00 ` Jeffrey M. Denham
  1996-02-23  5:00   ` Richard Westerik
  2 siblings, 1 reply; 8+ messages in thread
From: Jeffrey M. Denham @ 1996-02-22  5:00 UTC (permalink / raw)



In article <4gie5u$ngn@lal.interserv.net>, levine@amarex.com writes:
>When we overwrite executables on disk programs running that exe crash...Can I aviod
>with any link options ???   
>
>		 Jeremy Levine - levine@amarex.com
>
>

This should be in the FAQ too. The Digitial UNIX I/O system doesn't
support the ETXTBUSY functionality of some UNIX-based OS. The core
dump happens when the thread running the overwritten program attempts
to page in something from the image. What evers was at the old location
may no longer be good text, so it dies with an illegal instruction fault.

There's no cc/ld option to prevent this directly. Instead, you need
a rule to mv a.out (or whatever -o specified) to the final image name.
The mv leaves the original file open internally without interference.
When the last processes running the program exits, the internal
copy of the replaced program will be deleted.


-- 

-----------------------------------------------------------------------------
Jeff Denham, Unix Software Group, Digital Equipment Corporation
email: denham@zk3.dec.com, voice: (603) 881-0057



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Overwriting exe's crashes osf programs ? Why
  1996-02-22  5:00 Overwriting exe's crashes osf programs ? Why levine
@ 1996-02-22  5:00 ` Thomas Graichen
  1996-02-27  5:00   ` Jon Trulson
  1996-02-22  5:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
  1996-02-22  5:00 ` Jeffrey M. Denham
  2 siblings, 1 reply; 8+ messages in thread
From: Thomas Graichen @ 1996-02-22  5:00 UTC (permalink / raw)


levine@amarex.com wrote:
: When we overwrite executables on disk programs running that exe crash...Can I aviod
: with any link options ???   

i think this happens because Digital UNIX uses (like most othere modern unices
too) demand paging of executables - i.e. it reads pages which are unused at
the program start later if it needs them - if you now delete the executable it
will die if it needs a page it doesn't have in memory and wanted to read it
from the executable file which doesn't exit any longer

maybe you can avoid it by using a special linker option (don't have a man page
of the Digital UNIX linker handy here - run FreeBSD at home :-) or simply
moving it to a new name and delete it later - don't know what you need the
deletability for

t

--
  thomas graichen    graichen@mail.physik.fu-berlin.de    graichen@FreeBSD.org

  perfection is reached, not when there is no longer anything to add, but when
      there is no longer anything to take away    antoine de saint-exupery



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Overwriting exe's crashes osf programs ? Why
@ 1996-02-22  5:00 levine
  1996-02-22  5:00 ` Thomas Graichen
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: levine @ 1996-02-22  5:00 UTC (permalink / raw)


When we overwrite executables on disk programs running that exe crash...Can I aviod
with any link options ???   

		 Jeremy Levine - levine@amarex.com




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Overwriting exe's crashes osf programs ? Why
  1996-02-22  5:00 ` Jeffrey M. Denham
@ 1996-02-23  5:00   ` Richard Westerik
  1996-02-25  5:00     ` Mike Iglesias
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Westerik @ 1996-02-23  5:00 UTC (permalink / raw)



In article <4gie5u$ngn@lal.interserv.net>, levine@amarex.com writes:

>>When we overwrite executables on disk programs running that exe crash...Can I aviod
>>with any link options ???   
>>		 Jeremy Levine - levine@amarex.com

denham@denham.zk3.dec.com (Jeffrey M. Denham) responds:

>This should be in the FAQ too. The Digitial UNIX I/O system doesn't
>support the ETXTBUSY functionality of some UNIX-based OS. The core
>dump happens when the thread running the overwritten program attempts
>to page in something from the image. What evers was at the old location
>may no longer be good text, so it dies with an illegal instruction fault.

>There's no cc/ld option to prevent this directly. Instead, you need
>a rule to mv a.out (or whatever -o specified) to the final image name.
>The mv leaves the original file open internally without interference.
>When the last processes running the program exits, the internal
>copy of the replaced program will be deleted.

I disagree. It's not "just" cc or ld that can cause a situation like this.
A customer of ours was once badly bitten by this 'feature' of Digital 
Unix. He tried to restore (part of?) /usr while running the restore from 
a 'dxterm' under X11.

When the restore process hit 'dxterm' it must have memory faulted, causing
the 'dxterm' to close and killing the restore with it. The customer tried 
selecting 'dxterm' from the menu, but it died instantly. I tried 'xterm' 
which did work, and figured out the 'dxterm' had been corrupted (only 
partially restored).

This can happen not only when you try to overwrite an executable with a 
*different* content, but also when the content is going to be exactly the 
same! I've seen this problem on numerous occasions. I consider it to be a 
bug.

In my point of view the system only has two options:

(A)	allow overwriting executables *AND* surviving it
	(like the systems that do not have demand paging, if the system
	 loads the entire executable in memory at process creation then
  	 it doesn't matter if the filesystem copy gets overwritten while
	 it is running)

(B)	disallow it
	(like most vendors UNIXes do: HP-UX, SCO, IBM AIX etc.)

Implementing ETXTBSY cannot be so difficult; some systems we sold 10 years
ago already had demand paging *and* a protection against this sort of 
scheme.

What is Digital's reaction to comments like this?

Kind regards,
Richard
-- 
.------------------------- Richard M.J. Westerik --------------------------.
|\@@@@\  | Private e-mail : richardw@tiger.xs4all.nl OR richardw@xs4all.nl |   
| \@@@@\ | Business e-mail: richardw@bssi.nl       CompuServe: 100120,1136 |
|  \@@@@\| World wide web : http://www.xs4all.nl/~richardw (not finished)  |
`------------------- A day not loved is a day not lived -------------------'



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Overwriting exe's crashes osf programs ? Why
  1996-02-23  5:00   ` Richard Westerik
@ 1996-02-25  5:00     ` Mike Iglesias
  1996-02-25  5:00       ` Richard Westerik
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Iglesias @ 1996-02-25  5:00 UTC (permalink / raw)


In article <022396184941Rnf0.79b5@tiger.xs4all.nl>,
Richard Westerik <richardw@tiger.xs4all.nl> wrote:
>I disagree. It's not "just" cc or ld that can cause a situation like this.
>A customer of ours was once badly bitten by this 'feature' of Digital 
>Unix. He tried to restore (part of?) /usr while running the restore from 
>a 'dxterm' under X11.

One should use caution when restoring /usr (or files in / for that matter)
while the system is up.  In fact, it's probably better to do it single
user. 

>This can happen not only when you try to overwrite an executable with a 
>*different* content, but also when the content is going to be exactly the 
>same! I've seen this problem on numerous occasions. I consider it to be a 
>bug.

So you'd like the OS to compare what it's going to write out with
what's already there?  Sounds slow and cpu intensive if you ask me.
If you don't do it in the OS, you'd have to implement it in all the
utilities that write and copy files.

SunOS has the same problem with writing over executables while they are
running.


-- 
Mike Iglesias                        Internet:    iglesias@draco.acs.uci.edu
University of California, Irvine     phone:       (714) 824-6926
Office of Academic Computing         FAX:         (714) 824-2069




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Overwriting exe's crashes osf programs ? Why
  1996-02-25  5:00     ` Mike Iglesias
@ 1996-02-25  5:00       ` Richard Westerik
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Westerik @ 1996-02-25  5:00 UTC (permalink / raw)


iglesias@draco.acs.uci.edu (Mike Iglesias) writes:

>In article <022396184941Rnf0.79b5@tiger.xs4all.nl>,
>Richard Westerik <richardw@tiger.xs4all.nl> wrote:
>>I disagree. It's not "just" cc or ld that can cause a situation like this.
>>A customer of ours was once badly bitten by this 'feature' of Digital 
>>Unix. He tried to restore (part of?) /usr while running the restore from 
>>a 'dxterm' under X11.

>One should use caution when restoring /usr (or files in / for that matter)
>while the system is up.  In fact, it's probably better to do it single
>user. 

Of course, I know that, but the customer didn't (he never read the 
manual). What I meant was, if it is something the system cannot handle 
(like Digital UNIX obviously cannot) it should *prevent* users from 
"accidentally" doing it. Most Unix systems on the market today either (a) 
give ETXTBSY and do not overwrite the executable OR (b) survive, replacing
the executable without apparent side-effects.

>>This can happen not only when you try to overwrite an executable with a 
>>*different* content, but also when the content is going to be exactly the 
>>same! I've seen this problem on numerous occasions. I consider it to be a 
>>bug.

>So you'd like the OS to compare what it's going to write out with
>what's already there?  Sounds slow and cpu intensive if you ask me.
>If you don't do it in the OS, you'd have to implement it in all the
>utilities that write and copy files.

No, the OS should simply disallow writing over executables that are in 
use. It is *simple* to figure out (at open() time) if a file being opened 
for writing is in use as an executable. The OS could check and give an 
error message and avoid overwriting. In that case, it wouldn't have to 
check the contents, which I agree could prove impossible or 
time-consuming.

I merely reacted to someone who stated that it would be "logical" (my 
wording) to generate "Memory fault - core dumped" by overwriting an 
executable with a different version. I agree, but wanted to stress it 
*also* happens when restoring a version with identical content.

>SunOS has the same problem with writing over executables while they are
>running.

OK, that I didn't know (we don't deal a lot with Sun at the company I work
for). Some other major vendors don't have this problem, notably AT&T, IBM,
HP and SCO.

Richard
-- 
.------------------------- Richard M.J. Westerik --------------------------.
|\@@@@\  | Private e-mail : richardw@tiger.xs4all.nl OR richardw@xs4all.nl |   
| \@@@@\ | Business e-mail: richardw@bssi.nl       CompuServe: 100120,1136 |
|  \@@@@\| World wide web : http://www.xs4all.nl/~richardw (not finished)  |
`------------------- A day not loved is a day not lived -------------------'



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Overwriting exe's crashes osf programs ? Why
  1996-02-22  5:00 ` Thomas Graichen
@ 1996-02-27  5:00   ` Jon Trulson
  0 siblings, 0 replies; 8+ messages in thread
From: Jon Trulson @ 1996-02-27  5:00 UTC (permalink / raw)


Thomas Graichen (graichen@mail.physik.fu-berlin.de) wrote:
: levine@amarex.com wrote:
: : When we overwrite executables on disk programs running that exe crash...Can I aviod
: : with any link options ???   


	Yeah this is due to demnd paging.  If you need to overwrite an 
existing (and running) executable, simply 'rm' it first.  If the file 
is in use, the inode will be kept until it's no longer in use and the 
program will continue running.  So if you rm the file first, then copy the 
new version  in, you should be ok.




--
Jon Trulson		Inet: (work) trulsonj@clem.mscd.edu
Systems Programmer II       : (home) jon@radscan.com
Information Technology, Metropolitan State College of Denver, Colorado
Patent Pending




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1996-02-27  5:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-02-22  5:00 Overwriting exe's crashes osf programs ? Why levine
1996-02-22  5:00 ` Thomas Graichen
1996-02-27  5:00   ` Jon Trulson
1996-02-22  5:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
1996-02-22  5:00 ` Jeffrey M. Denham
1996-02-23  5:00   ` Richard Westerik
1996-02-25  5:00     ` Mike Iglesias
1996-02-25  5:00       ` Richard Westerik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox