1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00
systemd/src
Simon McVittie 71161305f1 logind: save /run/systemd/users/UID before starting user@.service
Previously, this had a race condition during a user's first login.
Some component calls CreateSession (most likely by a PAM service
other than 'systemd-user' running pam_systemd), with the following
results:

- logind:
  * create the user's XDG_RUNTIME_DIR
  * tell pid 1 to create user-UID.slice
  * tell pid 1 to start user@UID.service

Then these two processes race:

- logind:
  * save information including XDG_RUNTIME_DIR to /run/systemd/users/UID

- the subprocess of pid 1 responsible for user@service:
  * start a 'systemd-user' PAM session, which reads XDG_RUNTIME_DIR
    and puts it in the environment
  * run systemd --user, which requires XDG_RUNTIME_DIR in the
    environment

If logind wins the race, which usually happens, everything is fine;
but if the subprocesses of pid 1 win the race, which can happen
under load, then systemd --user exits unsuccessfully.

To avoid this race, we have to write out /run/systemd/users/UID
even though the service has not "officially" started yet;
previously this did an early-return without saving anything.
Record its state as OPENING in this case.

Bug: https://github.com/systemd/systemd/issues/232
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
2015-06-17 17:04:26 +01:00
..
ac-power treewide: no need to negate errno for log_*_errno() 2014-11-28 13:29:21 +01:00
activate tree-wide: whenever we fork off a foreign child process reset signal mask/handlers 2015-06-10 01:28:58 +02:00
analyze core: rename SystemdRunningAs to ManagerRunningAs 2015-05-11 22:51:49 +02:00
ask-password remove unused includes 2015-02-23 23:53:42 +01:00
backlight backlight: let udev properties override clamping 2015-02-02 17:18:40 +01:00
basic Merge pull request #246 from smcv/xpg-not-xdg 2015-06-17 13:08:15 +02:00
binfmt remove unused includes 2015-02-23 23:53:42 +01:00
boot bootctl: fix an error check 2015-05-23 13:03:30 +02:00
bootchart systemd-bootchart: Trivial typo fix in warning 2015-06-05 18:42:36 +02:00
bus-proxyd bus-proxy: fix GetConnectionSELinuxSecurityContext() return value 2015-05-21 21:24:55 +02:00
cgls remove unused includes 2015-02-23 23:53:42 +01:00
cgroups-agent treewide: no need to negate errno for log_*_errno() 2014-11-28 13:29:21 +01:00
cgtop cgtop: IO readings are valid if any data is available, even if unchanged since last tick 2015-06-10 18:06:28 -05:00
compat-libs #pragma once here and there 2015-01-23 09:30:44 -05:00
console everywhere: port everything to sigprocmask_many() and friends 2015-06-15 20:13:23 +02:00
core core: execute: fix regression in pam_setup() 2015-06-17 14:43:11 +02:00
cryptsetup cryptsetup: craft a unique ID with the source device 2015-06-09 10:17:55 +02:00
dbus1-generator bus: don't switch to kdbus if not requested 2015-05-06 18:21:51 +02:00
debug-generator core: rework unit name validation and manipulation logic 2015-05-05 15:06:42 -07:00
delta tree-wide: whenever we fork off a foreign child process reset signal mask/handlers 2015-06-10 01:28:58 +02:00
detect-virt remove unused includes 2015-02-23 23:53:42 +01:00
efi-boot-generator path-util: Change path_is_mount_point() symlink arg from bool to flags 2015-05-29 17:42:44 +02:00
escape core: rework unit name validation and manipulation logic 2015-05-05 15:06:42 -07:00
firstboot util: split all hostname related calls into hostname-util.c 2015-05-18 17:10:07 +02:00
fsck tree-wide: whenever we fork off a foreign child process reset signal mask/handlers 2015-06-10 01:28:58 +02:00
fstab-generator swap: use swapon -o 2015-05-25 17:06:15 +02:00
getty-generator core: rework unit name validation and manipulation logic 2015-05-05 15:06:42 -07:00
gpt-auto-generator path-util: Change path_is_mount_point() symlink arg from bool to flags 2015-05-29 17:42:44 +02:00
hibernate-resume core: rework unit name validation and manipulation logic 2015-05-05 15:06:42 -07:00
hostname hostname: Allow comments in /etc/hostname 2015-05-19 12:18:08 +02:00
hwdb Revert "hwdb: actually search /run/udev/hwdb.d" 2015-06-09 11:26:06 +02:00
import Merge pull request #214 from poettering/signal-rework-2 2015-06-15 20:35:18 +02:00
initctl shared: add formats-util.h 2015-04-10 23:54:48 +02:00
journal Merge pull request #214 from poettering/signal-rework-2 2015-06-15 20:35:18 +02:00
journal-remote everywhere: port everything to sigprocmask_many() and friends 2015-06-15 20:13:23 +02:00
kernel-install 90-loaderentry.install: fixup BOOT_OPTIONS 2015-06-02 16:10:06 +02:00
libsystemd Merge pull request #246 from smcv/xpg-not-xdg 2015-06-17 13:08:15 +02:00
libsystemd-network sd-netlink: rename from sd-rtnl 2015-06-13 19:52:54 +02:00
libsystemd-terminal everywhere: port everything to sigprocmask_many() and friends 2015-06-15 20:13:23 +02:00
libudev libudev: enumerate - accept NULL parameters in add_match() 2015-06-03 22:08:46 +02:00
locale tree-wide: fix memory leaks in users of bus_map_all_properties() 2015-06-14 15:08:52 +02:00
login logind: save /run/systemd/users/UID before starting user@.service 2015-06-17 17:04:26 +01:00
machine Stop talking about the "XDG" version of basename() 2015-06-17 11:23:46 +01:00
machine-id-commit machine-id-commit: simplifications 2015-03-10 18:56:56 +01:00
machine-id-setup remove unused includes 2015-02-23 23:53:42 +01:00
modules-load modules-load: fix memory leak 2015-05-13 14:07:26 +02:00
network everywhere: port everything to sigprocmask_many() and friends 2015-06-15 20:13:23 +02:00
notify shared: add formats-util.h 2015-04-10 23:54:48 +02:00
nspawn nspawn: check if kernel supports userns as early as possible 2015-06-16 17:30:45 +01:00
nss-myhostname util: split all hostname related calls into hostname-util.c 2015-05-18 17:10:07 +02:00
nss-mymachines
nss-resolve tree-wide: remove spurious space 2015-06-08 23:11:26 +02:00
path tree-wide: there is no ENOTSUP on linux 2015-03-13 14:10:39 +01:00
python-systemd remove gudev and gtk-doc 2015-06-03 00:22:53 +02:00
quotacheck tree-wide: whenever we fork off a foreign child process reset signal mask/handlers 2015-06-10 01:28:58 +02:00
random-seed random-seed: minor cleanups, in particular when it comes to logging 2015-04-21 18:08:09 +02:00
rc-local-generator treewide: use log_*_errno whenever %m is in the format string 2014-11-28 19:49:27 +01:00
remount-fs tree-wide: whenever we fork off a foreign child process reset signal mask/handlers 2015-06-10 01:28:58 +02:00
reply-password remove unused includes 2015-02-23 23:53:42 +01:00
resolve everywhere: port everything to sigprocmask_many() and friends 2015-06-15 20:13:23 +02:00
resolve-host remove unused includes 2015-02-23 23:53:42 +01:00
rfkill rfkill: rework how we generate file names from rfkill devices 2014-12-03 02:04:55 +01:00
run everywhere: port everything to sigprocmask_many() and friends 2015-06-15 20:13:23 +02:00
shared Merge pull request #214 from poettering/signal-rework-2 2015-06-15 20:35:18 +02:00
sleep remove unused includes 2015-02-23 23:53:42 +01:00
socket-proxy remove unused includes 2015-02-23 23:53:42 +01:00
sysctl sysctl: don't propagate ENOENT sysctl options 2015-04-24 19:56:47 +02:00
system-update-generator remove unused includes 2015-02-23 23:53:42 +01:00
systemctl everywhere: actually make use of DUAL_TIMESTAMP_NULL macro 2015-06-16 01:08:12 +02:00
systemd sd-netlink: message - split up source file 2015-06-13 21:11:01 +02:00
sysusers util: add generic calls for prefixing a root directory to a path 2015-05-13 17:42:10 +02:00
sysv-generator core: rename SystemdRunningAs to ManagerRunningAs 2015-05-11 22:51:49 +02:00
test Merge pull request #176 from filbranden/test_cgroup_mask1 2015-06-17 15:19:12 +02:00
timedate tree-wide: fix memory leaks in users of bus_map_all_properties() 2015-06-14 15:08:52 +02:00
timesync everywhere: port everything to sigprocmask_many() and friends 2015-06-15 20:13:23 +02:00
tmpfiles tmpfiles: only root-owned aquota.* files are special 2015-06-17 15:46:32 +02:00
tty-ask-password-agent everywhere: port everything to sigprocmask_many() and friends 2015-06-15 20:13:23 +02:00
udev udev: don't close FDs before dropping them from epoll 2015-06-17 00:31:57 +02:00
update-done update-done: ignore nanosecond file timestamp components, they are not reliable 2015-04-27 17:25:57 +02:00
update-utmp shared: add formats-util.h 2015-04-10 23:54:48 +02:00
user-sessions user-sessions: move into own subdir and build independently of logind 2015-02-27 17:28:03 -05:00
vconsole tree-wide: whenever we fork off a foreign child process reset signal mask/handlers 2015-06-10 01:28:58 +02:00
.gitignore
Makefile