[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inheritance of "/", auth and proc handles

From: Thomas Bushnell, BSG
Subject: Re: Inheritance of "/", auth and proc handles
Date: 19 Dec 2002 15:44:53 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Ludovic Courtès <> writes:

> If I understand correctly, each task created by the Hurd "inherits" a
> handle to the root filesystem, as well as to the auth and proc servers from
> its parent task.  For auth and proc, this is necessary because they don't
> have an entry in the filesystem hierarchy, which is probably due to security
> reasons also.  For "/", it is necessary because the root filesystem is the
> root nameserver of the Hurd.  Is it correct so far?


> Now, I'm trying to understand how those three handles are actually passed
> to new tasks.  The exec interface has an obsolete call called "exec_init"
> that has a auth handle and a proc handle argument.  However, "exec_exec"
> doesn't have such things so how does it work?  Any pointer?

exec_init is not obsolete.  It is, however, only used once in
bootstrapping the system, and isn't really relevant to what you're
worried about.

There are two parts to the answer for your question.

At fork, when a new task is actually created, the task inherits these
send rights because the implementation of fork in libc explicitly
copies all the ports from the old task to the new one, under the same
port names.  (Of course it gets a *new* proc handle.)

At exec, the old image is destroyed.  The ports that are preserved
(like the root filesystem, or the auth and proc handles) are passed to
file_exec (in the portarray argument), and then to exec_exec.

The exec server saves these away.  After it sets up the new task, it
sets the "bootstrap port" (part of the Mach interface for tasks) to
point to itself.  The task starts up, fetches its bootstrap port from
the kernel, and then calls exec_startup_get_info on that port, which
returns the descriptor table, the portarray, and a set of integers
(with things like the umask).

The interfaces don't have any special interpretation for the these
integers and ports, they just pass them around as requested.  However,
by convention the same specific things are always passed.  You can see
the list at the end of <hurd/hurd_types.h> in the INIT_PORT_* and
INIT_INT_* values.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]