[lkml]   [2006]   [Jan]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: RFC [patch 13/34] PID Virtualization Define new task_pid api
On Jan 21, 2006, at 09:42, Eric W. Biederman wrote:
> Hubertus Franke <> writes:
>> Actions: The vpid_to_pid will disappear and the check for whether
>> we are in the same container needs to be pushed down into the task
>> lookup. question remains to figure out whether the context of
>> the task lookup (will always remain the caller ?).
> Any place the kernel saves a pid and then proceeds to signal it
> later. At that later point in time it is possibly you will be in
> the wrong context.
> This probably justifies having a kpid_t that has both the process
> space id and the pid in it. For when the kernel is storing pids to
> use as weak references, for signal purposes etc.

The kernel should not be saving a PID. The kernel should be sticking
a pointer to a struct task_struct somewhere (with appropriate
refcounting) and using that.

> The only way I know to make this change safely is to make
> compilation of all functions that manipulate pids in possibly
> dangerous ways fail. And then to manually and slowly fix them up.
> That way if something is missed. You get a compile error instead
> of incorrect execution.

I agree. This is one of the things I really liked about the recent
mutex patch; it added a lot of checks to various codepaths to verify
at both compile time and run time that the code was correct.

My personal opinion is that we need to add a new race-free API, say
open("/proc/fork"); that forks a process and returns an open "process
handle", essentially a filehandle that references a particular
process. (Also, an open("/proc/self/handle") or something to return
a current-process handle) Through some method of signaling the
kernel (syscall, ioctl, some other?) a process can send a signal to
the process referenced by the handle, check its status, etc. A
process handle might be passed to other processes using a UNIX-domain
socket. You would be able to dup() a process handle and then
restrict the set of valid operations on the new process handle, so
that it could be passed to another process without giving that
process access to the full set of operations (check status only, not
able to send a signal, for example).

Obviously we would need to maintain support for the old interface for
some period of time, but I think the new one would make it much
easier to write simple race-free programs.

Kyle Moffett

Simple things should be simple and complex things should be possible
-- Alan Kay

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-01-22 07:47    [W:0.276 / U:2.484 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site