Re: [PATCH 3/3] pids: Make it possible to clone tasks with givenpids

From: Pavel Emelyanov
Date: Thu Nov 10 2011 - 12:36:13 EST


On 11/10/2011 09:30 PM, Tejun Heo wrote:
> Hello, Pavel.
>
>> for (i = ns->level; i >= 0; i--) {
>> - nr = alloc_pidmap(tmp);
>> + nr = 0;
>> + if (unlikely(want_pids != NULL)) {
>> + if (get_user(nr, want_pids)) {
>> + nr = -EFAULT;
>> + goto out_free;
>> + }
>> +
>> + if (nr != 0) {
>> + want_pids++;
>> + nr = set_pidmap(tmp, nr);
>> + } else
>> + want_pids = NULL; /* optimize above */
>> + }
>> + if (nr == 0)
>> + nr = alloc_pidmap(tmp);
>
> Hmmm... is it necessary to be able to replicate pids on all
> namespaces?

Not for us (I mean OpenVZ). But since we should (in theory) be able to
recreate the nested set of namespaces it would be good if the API allows
for this from the very beginning.

> Also, isn't it a bit weird to be able to request PIDs in
> the namespaces which is beyond the task which requested cloning?

It is, but the last_pid != 0 check will abort this request with EPERM :)
Do you think some other behavior would be better?

> Thanks.

Thanks,
Pavel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/