[CRIU] [PATCH] restore: Serialize access to last_pid

Andrey Vagin avagin at gmail.com
Mon Nov 18 04:11:21 MSK 2019


On Sun, Nov 17, 2019 at 12:33:37PM +0300, Cyrill Gorcunov wrote:
> On Sun, Nov 17, 2019 at 01:13:58AM -0800, Andrey Vagin wrote:
> > > -	return clone(fn, stack_ptr, flags, arg);
> > > +	context_lock();
> > > +	ret = clone(fn, stack_ptr, flags, arg);
> > 
> > Here is one more problem. clone can fork a process with a pid which is
> > going to be used be one of restored threads.
> 
> Well, this helpers will run in serialized mode and they are finished
> before we yield new thread. So no, this won't be a problem. The main
> problem is that all this looks like a broken archtecture design.

I don't understand what "serialized mode" means.

You wrote: "When we do clone threads in a later stage of
restore procedure it may race with helpers
which do call clone_noasan by self.".

This means that clone_noasan can be called when we are restoring threads
and clocn_noasan can fork a process with a pid of one of restored
threads.

> 
> I think we need (well, I need) to think more, maybe a I figure out
> some explicit way to handle this.

+1 ;)


More information about the CRIU mailing list