[CRIU] [PATCH] tty: restore sid on master points only
Cyrill Gorcunov
gorcunov at openvz.org
Tue Mar 19 11:37:04 EDT 2013
On Tue, Mar 19, 2013 at 07:13:35PM +0400, Andrey Vagin wrote:
> If a master point has sid, it doesn't mean, that all slave points
> will have sid. Look at tty03 for example:
>
> PID SID TT COMMAND
> 26748 26748 ? tty03
> 26749 26749 pts/2 \_ tty03
> 26750 26750 ? \_ tty03
>
> The second process has not a file descriptor for the ctl tty,
> but this tty is opened in tty03.
>
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
> test/zdtm.sh | 1 +
> tty.c | 6 ++----
> 2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/test/zdtm.sh b/test/zdtm.sh
> index 3ecba36..4163282 100755
> --- a/test/zdtm.sh
> +++ b/test/zdtm.sh
> @@ -73,6 +73,7 @@ static/pty00
> static/pty01
> static/pty04
> static/tty02
> +static/tty03
> static/child_opened_proc
> static/cow01
> static/fpu00
> diff --git a/tty.c b/tty.c
> index 251930b..a9cc11a 100644
> --- a/tty.c
> +++ b/tty.c
> @@ -731,10 +731,8 @@ static int tty_find_restoring_task(struct tty_info *info)
> }
>
> if (info->tie->sid) {
> - if (pty_is_master(info)) {
> - if (tty_has_active_pair(info))
> - return 0;
> - }
> + if (!pty_is_master(info))
> + return 0;
Lets imagine another situation -- we have 2 tasks, where second is forked
task1 task2
----- -----
ptm = open ptmx
pts = open pts
setsid()
fork()
close(ptm)
close(pts)
--- c/r session for task2 only ---
task2 has only one tty-info with some sid,
in the code about we see it's not master anymore
and simply return 0, would it work? There should be a message
but I guess it won't appear with this patch applied.
pr_err("No task found with sid %d\n", info->tie->sid);
Did I miss something?
More information about the CRIU
mailing list