Demand paged executables

Leslie Mikesell les at chinet.chi.il.us
Sat Feb 4 09:40:27 AEST 1989


In article <6211 at saturn.ucsc.edu> brad at polaris.UUCP (Brad Smith) writes:
>Two questions/points on this:
>
>	- Wouldn't there be some problems with other links to
>	  a file being invalidated (pointing to the old version)
>	  if the file was unlinked, a new inode allocated, and
>	  a new link created to copy over an executing program?

No - the sequence is:
  link old_name new_name
  unlink old_name
(assuming no symlinks..) This gives new_name a pointer to the original
inode and makes it possible to remove old_name since it is no longer the
last link to the inode.  mv will do this if the destination is on the
same filesystem as the source.

>	- It seems the reason for not locking shell scripts is
>	  that virtual memory for the executable is not being
>	  paged out of the file containing the script.  Some
>	  program (typically a shell) is being run with the
>	  contents of the script as input... or something to
>	  that effect.

Actually it is totally unrelated because scripts are treated as an ordinary
file even though they are marked as executable.  I just mentioned it because
the person who thought of protecting demand paged executables should also
have realized that scripts need equal protection.  Of course, that person
probably didn't have any control over the way shells handle their input.
Does anyone have any useful trick examples of modifying a running shell
script?  How about horror stories of editing a program while cron is running
it?
 
Les Mikesell



More information about the Comp.unix.wizards mailing list