Systemd/src/login
Franck Bui 8246905af0 logind: fix (again) the race that might happen when logind restores VT
This patch is a new attempt to fix the race originally described in issue #9754.

The initial fix (commit ad96887a12) consisted in
spawning a sub process that became the controlling process of the VT and hence
kicked the old controlling process off to make sure that the VT wouldn't have
entered in HUP state while logind restored the VT.

But it introduced a regression (see issue #11269) and thus was reverted. But
unlike it was described in the revert commit message, commit
adb8688b3f alone doen't fix the initial race.

This patch fixes the race in a simpler way by trying to restore the VT a second
time after making sure to re-open it if the first attempt fails.

Indeed if the old controlling process dies before or during the first attempt,
logind will fail to restore the VT. At this point the VT is in HUP state but
we're sure that it won't enter in a HUP state a second time. Therefore we will
retry by re-opening the VT to clear the HUP state and by restoring the VT a
second time, which should be safe this time.

Fixes: #9754
Fixes: #13241
2019-11-12 14:53:24 +01:00
..
70-power-switch.rules Add SPDX license headers to various assorted files 2017-11-19 19:08:15 +01:00
70-uaccess.rules.m4 Re-add uaccess tag for /dev/dri/renderD* 2019-03-14 11:08:58 +01:00
71-seat.rules.in udev: tag any display devices as master-of-seat when nomodeset is used 2019-10-19 20:52:42 +02:00
73-seat-late.rules.m4 login/meson.build: require ACL for uaccess rules 2018-01-27 10:55:32 +01:00
inhibit.c logind: add missing OOM check in client tool 2019-07-23 16:08:06 +02:00
loginctl.c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
logind-acl.c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
logind-acl.h logind: replace udev_device by sd_device 2018-08-23 04:57:39 +09:00
logind-action.c Revert "logind: remove unused check" 2019-08-04 05:44:36 +09:00
logind-action.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
logind-brightness.c Fix typo in comment: overide -> override 2019-09-05 07:39:36 +09:00
logind-brightness.h logind: add SetBrightness() bus call for setting brightness of leds/backlight devices associated with a seat 2019-05-24 15:05:27 +02:00
logind-button.c tree-wide: drop input.h when missing_input.h is included 2019-11-04 00:30:32 +09:00
logind-button.h tree-wide: add whitespace between type and variable name 2018-12-04 09:29:54 +01:00
logind-core.c tree-wide: drop pwd.h and grp.h when user-util.h is included 2019-11-04 00:30:32 +09:00
logind-dbus.c tree-wide: drop pwd.h and grp.h when user-util.h is included 2019-11-04 00:30:32 +09:00
logind-dbus.h logind: split out dbus header files into their own 2019-05-24 15:05:27 +02:00
logind-device.c logind: drop {} 2019-10-21 09:33:19 +02:00
logind-device.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
logind-gperf.gperf logind: optionally, keep the user@.service instance for eached logged in user around for a while 2018-10-13 12:59:29 +02:00
logind-inhibit.c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
logind-inhibit.h logind: make id const, since it points into another buffer 2019-07-23 16:08:07 +02:00
logind-seat-dbus.c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
logind-seat-dbus.h logind: split out dbus header files into their own 2019-05-24 15:05:27 +02:00
logind-seat.c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
logind-seat.h logind: split out dbus header files into their own 2019-05-24 15:05:27 +02:00
logind-session-dbus.c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
logind-session-dbus.h logind: split out dbus header files into their own 2019-05-24 15:05:27 +02:00
logind-session-device.c tree-wide: drop input.h when missing_input.h is included 2019-11-04 00:30:32 +09:00
logind-session-device.h tree-wide: replace 'unsigned int' with 'unsigned' 2018-10-19 22:19:12 +02:00
logind-session.c logind: fix (again) the race that might happen when logind restores VT 2019-11-12 14:53:24 +01:00
logind-session.h logind: make session_prepare_vt() static 2019-10-16 10:45:25 +09:00
logind-user-dbus.c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
logind-user-dbus.h logind: split out dbus header files into their own 2019-05-24 15:05:27 +02:00
logind-user.c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
logind-user.h logind: split out dbus header files into their own 2019-05-24 15:05:27 +02:00
logind-utmp.c tree-wide: drop pwd.h and grp.h when user-util.h is included 2019-11-04 00:30:32 +09:00
logind.c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
logind.conf.in Use a dash-truncated drop-in for user-%j.slice configuration 2018-04-25 16:18:45 +02:00
logind.h logind: use newer ret var naming style 2019-09-16 09:05:42 +02:00
meson.build login: move file definitions outside of the conditionalization 2019-07-05 17:55:49 +02:00
org.freedesktop.login1.conf logind: add SetBrightness() bus call for setting brightness of leds/backlight devices associated with a seat 2019-05-24 15:05:27 +02:00
org.freedesktop.login1.policy logind: reword the polkit prompt for reboot parameter 2019-03-26 08:52:18 +01:00
org.freedesktop.login1.service Add SPDX license headers to various assorted files 2017-11-19 19:08:15 +01:00
pam_systemd.c Merge pull request #13423 from pwithnall/12035-session-time-limits 2019-10-28 14:57:00 +01:00
pam_systemd.sym logind: drop old-style header from .sym file in favour of SPDX 2019-07-04 12:35:14 +09:00
sysfs-show.c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
sysfs-show.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
systemd-user.m4 pam: include pam_keyinit.so in our PAM fragments 2016-12-13 20:59:36 +01:00
test-inhibit.c test: stop using dup() needlessly 2019-04-02 12:45:46 +02:00
test-login-shared.c Drop my copyright headers 2018-06-14 13:03:20 +02:00
test-login-tables.c Drop my copyright headers 2018-06-14 13:03:20 +02:00
user-runtime-dir.c headers: remove unneeded includes from util.h 2019-03-27 11:53:12 +01:00