Re: [PATCH v2 1/2] fork: extend clone3() to support CLONE_SET_TID
From: Oleg Nesterov
Date: Fri Aug 02 2019 - 09:30:41 EST
On 08/02, Oleg Nesterov wrote:
>
> On 08/02, Adrian Reber wrote:
> >
> > On Wed, Jul 31, 2019 at 07:41:36PM +0200, Oleg Nesterov wrote:
> > > But the main question is how it can really help if ns->level > 0, unlikely
> > > CRIU will ever need to clone the process with the same pid_nr == set_tid
> > > in the ns->parent chain.
> >
> > Not sure I understand what you mean. For CRIU only the PID in the PID
> > namespace is relevant.
>
> If it runs "inside" this namespace. But in this case alloc_pid() should
> use nr == set_tid only once in the main loop, when i == ns->level.
and I just noticed that your patch does exactly this, it clears set_tid
after the 1st usage when i == ns->level.
> > > So may be kernel_clone_args->set_tid should be pid_t __user *set_tid_array?
> > > Or I missed something ?
> >
> > Not sure why and how an array would be needed. Could you give me some
> > more details why you think this is needed.
>
> IIURC, criu can restore the process tree along with nested pid namespaces.
>
> how can this patch help in this case?
>
> But again, perhaps I missed something. I forgot everything about criu.
Yes... I guess in this case it can "safely" modify ns_last_pid in the child
namespaces it needs to create.
So Adrian, sorry for confusion, I think your patch is fine.
Oleg.