[CRIU] [PATCH 09/10] tty: Introduce deferred checking of tty sids

Cyrill Gorcunov gorcunov at openvz.org
Mon Oct 29 05:07:52 EDT 2012


The dumping of tty peers is somewhat tricky. And it became more
complex once we allowed to migrate/inherit sessions.

It's being found (in screen c/r) that we've a problem in looking
up of session leaders while dumping tty.

Let me explain with more details. Here is an example of screen
session

  PID   GID   SID
20567 20567 20567           SCREEN
20568 20568 20568  pts/3     \_ /bin/bash

The screen opens master peer (ptmx) and then provides
bash the slave peer (pts/3) where bash sets up a session
leader on it.

Thus we get interesting scenario -- our pstree construction
is done in lazy fashion, we run parasite code to fetch sid/pgid
of a process tree item only when we're really dumping the task.

Thus when we start dumping ptmx peer (which belongs to SCREEN)
we've not yet constructed the process tree item for children
(ie /bin/bash) and the lookup function in tty code (which walks
over all process items in a tree) simply fails to find sid of
child, because we've not yet dumped it.

Thus, to resolve such situation we verify tty sids at late stage
of dumping.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-dump.c     |    3 ++
 include/tty.h |    1 +
 tty.c         |   97 +++++++++++++++++++++++++++++++++++++++-----------------
 3 files changed, 71 insertions(+), 30 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0009-tty-Introduce-deferred-checking-of-tty-sids.patch
Type: text/x-patch
Size: 4132 bytes
Desc: not available
Url : http://openvz.org/pipermail/criu/attachments/20121029/32ccc8ea/0009-tty-Introduce-deferred-checking-of-tty-sids-0001.bin


More information about the CRIU mailing list