Systemd/src/nspawn
Lennart Poettering 335d2eadca nspawn: don't become TTY controller just to undo it later again
Instead of first becoming a controlling process of the payload pty
as side effect of opening it (without O_NOCTTY), and then possibly
dropping it again, let's do it cleanly an reverse the logic: let's open
the pty without becoming its controller first. Only after everything
went the way we wanted it to go become the controller explicitly.

This has the benefit that the PID 1 stub process we run (as effect of
--as-pid2) doesn't have to lose the tty explicitly, but can just
continue running with things. And we explicitly make the tty controlling
right before invoking actual payload.

In order to make sure everything works as expected validate that the
stub PID 1 in the container really has no conrolling tty by issuing the
TIOCNOTTY tty and expecting ENOTTY, and log about it.

This shouldn't change behaviour much, it just makes thins a bit cleaner,
in particular as we'll not trigger SIGHUP on ourselves (since we are
controller and session leader) due to TIOCNOTTY which we then have to
explicitly ignore.
2020-09-17 16:39:23 +02:00
..
meson.build nspawn: add --set-credential= and --load-credential= 2020-08-25 19:45:47 +02:00
nspawn-cgroup.c tree-wide: add size limits for tmpfs mounts 2020-05-13 00:37:18 +02:00
nspawn-cgroup.h nspawn: Move cgroup mount stuff from nspawn-mount.c to nspawn-cgroup.c 2018-07-20 12:12:02 -04:00
nspawn-creds.c nspawn: add --set-credential= and --load-credential= 2020-08-25 19:45:47 +02:00
nspawn-creds.h nspawn: add --set-credential= and --load-credential= 2020-08-25 19:45:47 +02:00
nspawn-def.h nspawn: add missing spdx header 2020-07-23 18:47:38 +02:00
nspawn-expose-ports.c nspawn: some minor modernizations 2020-04-23 07:59:26 +02:00
nspawn-expose-ports.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
nspawn-gperf.gperf nspawn: add support for executing OCI runtime bundles with nspawn 2019-03-15 15:41:28 +01:00
nspawn-mount.c Rename strv_split_extract() to strv_split_full() 2020-09-09 09:34:55 +02:00
nspawn-mount.h nspawn: rework how /run/host/ is set up 2020-07-23 18:47:38 +02:00
nspawn-network.c Merge pull request #14381 from keszybz/ifindex-cleanup 2020-01-13 17:57:59 +01:00
nspawn-network.h nspawn: Move --network-interface interfaces back to the host. 2020-01-02 14:13:03 +01:00
nspawn-oci.c seccomp: add support for riscv64 2020-08-21 10:10:29 +02:00
nspawn-oci.h nspawn: add support for executing OCI runtime bundles with nspawn 2019-03-15 15:41:28 +01:00
nspawn-patch-uid.c *: convert amenable fdopendir() calls to take_fdopendir() 2020-03-31 06:48:03 -07:00
nspawn-patch-uid.h tree-wide: remove various unused functions 2018-12-02 13:35:34 +09:00
nspawn-register.c shared: actually move all BusLocator related calls to bus-locator.c 2020-06-30 15:09:19 +02:00
nspawn-register.h nspawn: when stopping the machine, just deregister the machine 2019-10-29 10:54:45 +01:00
nspawn-seccomp.c nspawn: turn on higher optimization level in seccomp 2020-08-24 20:05:25 +02:00
nspawn-seccomp.h shared/seccomp: use _cleanup_ in one more place 2020-08-19 10:57:30 +02:00
nspawn-settings.c nspawn: downgrade log level if the error will be ignored 2020-09-10 15:16:14 +09:00
nspawn-settings.h nspawn: add --set-credential= and --load-credential= 2020-08-25 19:45:47 +02:00
nspawn-setuid.c nspawn: use extract_first_word() 2020-09-09 09:34:54 +02:00
nspawn-setuid.h nspawn: refactor setuid code a bit 2019-03-15 15:33:09 +01:00
nspawn-stub-pid1.c nspawn: don't become TTY controller just to undo it later again 2020-09-17 16:39:23 +02:00
nspawn-stub-pid1.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
nspawn.c nspawn: don't become TTY controller just to undo it later again 2020-09-17 16:39:23 +02:00
test-nspawn-tables.c test-nspawn-tables: add another "tables" test 2018-05-28 10:40:00 +02:00
test-patch-uid.c util-lib: move yes_no() and friends to string-util.h 2019-09-16 18:06:20 +02:00