home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.22 / text0102.txt < prev    next >
Encoding:
Text File  |  1991-03-06  |  2.0 KB  |  48 lines

  1. Submitted-by: peter@ficc.ferranti.com (Peter da Silva)
  2.  
  3. Look, I know you don't like spawn(). But in a lot of environments... INCLUDING
  4. ONES THAT ARE OTHERWISE QUITE CAPABLE OF SUPPORTING A POSIX ABI... it is *not*
  5. possible to do a safe and efficient implementation of fork(). Leave in the
  6. fork() call, but allow a more efficient (and, let's face it, easier to
  7. understand) alternative: spawn().
  8.  
  9. In article <17598@cs.utexas.edu> mohta@necom830.cc.titech.ac.jp (Masataka Ohta) writes:
  10. > First, list every operations which is safe between fork() and exec()
  11. > *and* between BSD vfork() and exec().
  12.  
  13. > Then, those are the safe operations of POSIX vfork() on *all* architectures.
  14.  
  15. No. Those are the safe operations between fork() and exec() on UNIX.
  16.  
  17. POSIX looks like it's going to comprise far more than UNIX.
  18.  
  19. Let's say you define vfork() as "set a flag that all posix calls that deal
  20. with uid, signals, files, etc... look at, so they just write a "script" of
  21. actions to take on behalf of the new process".
  22.  
  23. Then, you define "exec" as "look at the script, if there, and cons up an
  24. efficient system call on the underlying O/S (VMS, for example) to satisfy
  25. it".
  26.  
  27. > Most (perhaps, more than 90%) of cases where fork/exec is necessary
  28. > is covered by system(). spawn() is not necessary.
  29.  
  30.     No, system() and popen() can not, ever, let you pass a set of
  31.     arguments to a program without diddling by the shell. When you
  32.     have no way of knowing whether that shell will be sh, csh, ksh,
  33.     or even rc what can you do to protect yourself?
  34.  
  35.     Who knows, I can easily imagine DEC setting things up so a user
  36.     could set his shell to DCL and hose *everything* up.
  37.  
  38.     Using system() in programs like (for example) uucp, mail handlers,
  39.     and so on is a security hole you can drive a truck through. There
  40.     are lots of systems where you can use this to get pretty much *any*
  41.     file on a neighbor's machine.
  42. -- 
  43. Peter da Silva.  `-_-'  peter@ferranti.com
  44. +1 713 274 5180.  'U`  "Have you hugged your wolf today?"
  45.  
  46. Volume-Number: Volume 22, Number 105
  47.  
  48.