Processes and mmap

Darren Tucker dtucker at zip.com.au
Fri Jul 4 10:39:33 EST 2008


Georgi Chulkov wrote:
> Hello again,
> 
> I have noticed that when a connection is made to the main sshd process, it 
> first forks, and then execv()s itself, thur restarting itself completely. 
> What is the reason for the execv()?

Some security measures, in particular address space layout 
randomization, are only applied at exec time.  Doing this means that 
each connection gets a unique layout rather than a clone of the original 
sshd.  See:

http://www.openbsd.org/papers/openssh-measures-asiabsdcon2007.pdf
http://www.openbsd.org/papers/ven05-deraadt/index.html

> My other concern is that I would like to have some global state inherited from 
> the main sshd process to all forked processes, which is however sensitive 
> data. Is it safe to pass it as a command-line argument during the execv() 
> call?

No, command line arguments are visible to all users on many systems. 
See sshd.c:send_rexec_state() for how sshd sends some state to the new 
copy (via a pipe).

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
     Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.


More information about the openssh-unix-dev mailing list