Subject: Re: forkexec(2)
To: Todd Vierling <tv@NetBSD.ORG>
From: Ignatios Souvatzis <is@jocelyn.rhein.de>
List: tech-kern
Date: 04/13/1998 22:31:55
> On Mon, 13 Apr 1998, Ignatios Souvatzis wrote:
> 
> : You need something like:
> : 
> : /* save my versions */
> : savestdin = dup(0);
> 
> : /* open childs versions */
> : close(0);
> : open(what I want to be at stdin in the child);
> 
> : callexec();
> 
> "Security problem."  What is stopping the child program from arbitrarily
> reading from the file descriptors dup()ed above?  "Oh, we need to restrict
> forkexec() to only pass descriptors 0-2."  ick.

Oh, I was just citing-out-of-my-head what os-9 did. AFAICT, there was no
serious security problem associated with passing the other descriptors...

Oh yes, and now dup2(). closing 0 and dup-ing is the official way to change
the std path of newly created processes, according to the OS-9 System
Programmers Manual :-)

	-is