lkml.org 
[lkml]   [2011]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] pids: Make it possible to clone tasks with given pids
On 11/17, Pavel Emelyanov wrote:
>
> +static int set_pidmap(struct pid_namespace *pid_ns, int pid)
> +{
> + int offset;
> + struct pidmap *map;
> +
> + /*
> + * When creating a new pid namespace we must make its init
> + * have pid == 1 in it.
> + */
> + if (pid_ns->child_reaper == NULL)
> + return 0;

Do we really need this check? please see below...

> + /*
> + * Don't allow to create a task with a pid which has recently
> + * belonged to some other (dead already) task. Only init (of
> + * a freshly created namespace) and his clones can do this.
> + */
> + if (pid_ns->last_pid != 1)
> + return -EPERM;

->last_pid == 1. This means that pid_nr == 1 was already created
in this namespace via CLONE_NEWPID, and the child with this pid
must be ->child_reaper, no?

IOW. if copy_process() allocs the first pid in the new pid_ns, it
always sets ->child_reaper.


Cough. I really think 45a68628 should be reverted ;) IMHO it
complicates the understanding of CLONE_NEWPID logic.

Oleg.



\
 
 \ /
  Last update: 2011-11-17 16:39    [W:0.747 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site