criu/scripts
Pavel Tikhomirov 9e91e62a7c criu-ns: capture controlling tty
When we are restoring in new pidns we specifically do setsid() from
criu-ns init so that sids of restored tasks are non-zero in this pidns
and on next dump CRIU would not have problems with zero sids, see [1].

But after this CRIU tries to inherit and setup a tty for the restored
process, and it fails to set it's process group via TIOCSPGRP to be a
foreground group for it's tty, because tty already is a controlling tty
for other session (which we had before setsid).

So to make it restore we need to reset tty to be a controlling tty of
criu-ns init via TIOCSCTTY before calling criu.

Else when restoring first time via criu-ns (from criu-ns dump) we get:

Error (criu/tty.c:689): tty: Failed to set group 40816 on 0: Inappropriate ioctl for device

https://github.com/checkpoint-restore/criu/issues/232 [1]

v2: add why and what comment in code, set controlling tty only for
--shell-job and fail if stdin is not a tty.

Fixes: #1893
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2023-04-15 21:17:21 -07:00
..
build ci: Add Dockerfile for openj9 on Ubuntu 2023-04-15 21:17:21 -07:00
ci ci: Clean up and improve Java testing 2023-04-15 21:17:21 -07:00
nmk Fix some codespell warnings 2022-04-28 17:53:52 -07:00
crit-setup.py crit: Use same version as criu 2022-06-22 10:20:33 -07:00
criu-ns criu-ns: capture controlling tty 2023-04-15 21:17:21 -07:00
fake-restore.sh zdtm: check an exit code of a straced restore 2018-05-12 11:45:31 +03:00
feature-tests.mak criu: fix conflicting headers 2023-04-15 21:17:21 -07:00
fetch-clang-format.sh clang-format: enable AlignTrailingComments 2022-04-28 17:53:52 -07:00
flake8.cfg coredump: remove unused import 2022-04-28 17:53:52 -07:00
install-criu-image-streamer.sh scripts: run shellcheck on the scripts folder 2020-10-20 00:18:24 -07:00
install-debian-pkgs.sh scripts: run shellcheck on the scripts folder 2020-10-20 00:18:24 -07:00
magic-gen.py py: Fix tabs in code comments 2019-09-07 15:59:57 +03:00
protobuf-gen.sh scripts: run shellcheck on the scripts folder 2020-10-20 00:18:24 -07:00
systemd-autofs-restart.sh Fix some codespell warnings 2022-04-28 17:53:52 -07:00
tmp-files.sh scripts: fix shellcheck warnings 2021-09-03 10:31:00 -07:00