[CRIU] [PATCH] pstree: don't replace sid if the root task is a session leader

Andrew Vagin avagin at parallels.com
Mon Apr 1 10:46:57 EDT 2013


On Mon, Apr 01, 2013 at 06:36:01PM +0400, Cyrill Gorcunov wrote:
> On Mon, Apr 01, 2013 at 06:27:03PM +0400, Andrey Vagin wrote:
> > The root task must remain a session leader after c/r. The root task
> > can be executed in another pidns and the sid from another name space
> > will be invalid.
> > 
> > Cc: Cyrill Gorcunov <gorcunov at openvz.org>
> > Reported-by: Pavel Emelyanov <xemul at parallels.com>
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> >  pstree.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/pstree.c b/pstree.c
> > index 1fd1832..b910721 100644
> > --- a/pstree.c
> > +++ b/pstree.c
> > @@ -154,6 +154,9 @@ static int prepare_pstree_for_shell_job(void)
> >  	if (!opts.shell_job)
> >  		return 0;
> >  
> > +	if (root_item->sid == root_item->pid.virt)
> > +		return 0;
> > +
> 
> Hmm, looks good, but could you clarify please -- this routine
> ahs been updating gids as well, won't they left intouched after
> this change and thus ctl+z wouldn;t work? Or I miss something here?

------
man 2 setsid
The calling process is the leader of the new session, the process
group leader of the new process group, and has no controlling tty.
------

After my changes all sid and pgid will be restored correctly, so
they should work by the same way...


More information about the CRIU mailing list