Systemd/src
Lennart Poettering 4b58153dd2 core: add "invocation ID" concept to service manager
This adds a new invocation ID concept to the service manager. The invocation ID
identifies each runtime cycle of a unit uniquely. A new randomized 128bit ID is
generated each time a unit moves from and inactive to an activating or active
state.

The primary usecase for this concept is to connect the runtime data PID 1
maintains about a service with the offline data the journal stores about it.
Previously we'd use the unit name plus start/stop times, which however is
highly racy since the journal will generally process log data after the service
already ended.

The "invocation ID" kinda matches the "boot ID" concept of the Linux kernel,
except that it applies to an individual unit instead of the whole system.

The invocation ID is passed to the activated processes as environment variable.
It is additionally stored as extended attribute on the cgroup of the unit. The
latter is used by journald to automatically retrieve it for each log logged
message and attach it to the log entry. The environment variable is very easily
accessible, even for unprivileged services. OTOH the extended attribute is only
accessible to privileged processes (this is because cgroupfs only supports the
"trusted." xattr namespace, not "user."). The environment variable may be
altered by services, the extended attribute may not be, hence is the better
choice for the journal.

Note that reading the invocation ID off the extended attribute from journald is
racy, similar to the way reading the unit name for a logging process is.

This patch adds APIs to read the invocation ID to sd-id128:
sd_id128_get_invocation() may be used in a similar fashion to
sd_id128_get_boot().

PID1's own logging is updated to always include the invocation ID when it logs
information about a unit.

A new bus call GetUnitByInvocationID() is added that allows retrieving a bus
path to a unit by its invocation ID. The bus path is built using the invocation
ID, thus providing a path for referring to a unit that is valid only for the
current runtime cycleof it.

Outlook for the future: should the kernel eventually allow passing of cgroup
information along AF_UNIX/SOCK_DGRAM messages via a unique cgroup id, then we
can alter the invocation ID to be generated as hash from that rather than
entirely randomly. This way we can derive the invocation race-freely from the
messages.
2016-10-07 20:14:38 +02:00
..
ac-power
activate activate: improve SIGCHLD handler 2016-04-05 14:34:04 +00:00
analyze analyze-verify: honour $SYSTEMD_UNIT_PATH, allow system paths to be ignored 2016-10-01 22:53:17 +02:00
ask-password ask-password: add option --no-output to not print password to stdout 2016-03-01 19:02:11 +01:00
backlight systemctl,networkctl,busctl,backlight: use STRPTR_IN_SET 2016-09-24 20:22:05 -04:00
basic core: add "invocation ID" concept to service manager 2016-10-07 20:14:38 +02:00
binfmt
boot bootctl: properly skip duplicate entries (#4048) 2016-08-30 16:50:19 +02:00
cgls core: rename cg_unified() to cg_all_unified() 2016-08-15 18:13:36 -04:00
cgroups-agent tree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhere 2016-05-05 22:24:36 +02:00
cgtop core: rename cg_unified() to cg_all_unified() 2016-08-15 18:13:36 -04:00
core core: add "invocation ID" concept to service manager 2016-10-07 20:14:38 +02:00
coredump coredump,catalog: give better notice when a core file is truncated 2016-09-28 23:50:29 +02:00
cryptsetup cryptsetup: do not 'fail' if trying to detach a nonexistent device 2016-04-01 20:51:20 +02:00
dbus1-generator Ensure kdbus isn't used (#3501) 2016-06-18 17:24:23 -04:00
debug-generator
delta tree-wide: rename draw_special_char to special_glyph 2016-05-09 15:17:57 -04:00
detect-virt
escape
firstboot tree-wide: use sd_id128_is_null() instead of sd_id128_equal where appropriate 2016-07-22 12:38:08 +02:00
fsck tree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhere 2016-05-05 22:24:36 +02:00
fstab-generator Use "return log_error_errno" in more places" 2016-07-22 21:25:09 -04:00
getty-generator
gpt-auto-generator Merge pull request #3757 from poettering/efi-search 2016-07-25 16:34:18 -04:00
hibernate-resume
hostname tree-wide: remove consecutive duplicate words in comments 2016-10-04 17:06:25 +02:00
hwdb hwdb: store file-name and file-number with properties 2016-09-21 15:18:28 +02:00
import importd/export-raw: needs missing.h for O_TMPFILE 2016-08-29 12:40:22 +02:00
initctl tree-wide: make ++/-- usage consistent WRT spacing 2016-02-22 20:32:04 -08:00
journal core: add "invocation ID" concept to service manager 2016-10-07 20:14:38 +02:00
journal-remote journal-remote: fix error format string 2016-09-24 21:46:48 -04:00
kernel-install kernel-install: allow plugins to terminate the procedure (#4174) 2016-09-24 09:03:54 -04:00
libsystemd core: add "invocation ID" concept to service manager 2016-10-07 20:14:38 +02:00
libsystemd-network Various fixes for typos found by lintian (#3705) 2016-07-12 12:52:11 +02:00
libudev libudev: fix typo in comment 2016-08-19 11:43:58 +10:00
locale tree-wide: use %m in calls to sd_bus_error_set_errnof 2016-09-13 20:10:57 -04:00
login tree-wide: remove consecutive duplicate words in comments 2016-10-04 17:06:25 +02:00
machine bus-util: generalize helper for ID128 prpoerties 2016-10-07 20:14:38 +02:00
machine-id-setup machine-id-setup: add new --print switch 2016-07-22 12:59:36 +02:00
modules-load
mount mount-tool: return 0 instead of NULL in the acquire_description() (#4009) 2016-08-22 02:14:23 -04:00
network core: add "invocation ID" concept to service manager 2016-10-07 20:14:38 +02:00
notify
nspawn tree-wide: drop some misleading compiler warnings 2016-10-06 19:04:10 +02:00
nss-myhostname treewide: fix typos and remove accidental repetition of words 2016-07-11 16:18:43 +02:00
nss-mymachines nss-mymachines: avoid connecting to dbus from inside dbus-daemon 2016-08-19 00:52:00 +02:00
nss-resolve nss-resolve: return NOTFOUND instead of UNAVAIL on resolution errors 2016-10-01 16:59:06 +02:00
nss-systemd core: bypass dynamic user lookups from dbus-daemon 2016-08-19 00:50:24 +02:00
path
quotacheck
random-seed
rc-local-generator tree-wide: make more global variables static 2016-02-13 12:28:28 +01:00
remount-fs
reply-password tree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhere 2016-05-05 22:24:36 +02:00
resolve tree-wide: drop some misleading compiler warnings 2016-10-06 19:04:10 +02:00
rfkill
run execute: move suppression of HOME=/ and SHELL=/bin/nologin into user-util.c 2016-09-25 10:18:57 +02:00
shared core: add "invocation ID" concept to service manager 2016-10-07 20:14:38 +02:00
sleep
socket-proxy tree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhere 2016-05-05 22:24:36 +02:00
stdio-bridge stdio-bridge: Correctly propagate error 2016-02-29 10:45:34 +01:00
sysctl sysctl: configure kernel parameters in the order they occur in each sysctl configuration files (#4205) 2016-09-24 08:56:07 -04:00
system-update-generator
systemctl systemctl: Add --wait option to wait until started units terminate again 2016-10-01 17:58:59 +02:00
systemd core: add "invocation ID" concept to service manager 2016-10-07 20:14:38 +02:00
sysusers sysusers: move various user credential validity checks to src/basic/ 2016-07-22 15:53:45 +02:00
sysv-generator sysv-generator: better error reporting (#3977) 2016-08-17 20:11:27 +02:00
test strv: fix STRV_FOREACH_BACKWARDS() to be a single statement only 2016-10-07 20:14:38 +02:00
timedate Add enable_disable() helper 2016-07-31 22:48:22 -04:00
timesync tree-wide: rename config_parse_many to …_nulstr 2016-09-16 10:32:03 -04:00
tmpfiles Use "return log_error_errno" in more places" 2016-07-22 21:25:09 -04:00
tty-ask-password-agent ask-password: ask for passphrases not only on the first console of /dev/console 2016-05-24 11:57:27 +02:00
udev sd-device/networkd: unify code to get a socket for issuing netdev ioctls on 2016-10-06 19:04:01 +02:00
update-done update-done, condition: write the timestamp to the file as well and use it to prevent false-positives 2016-09-15 06:36:42 +03:00
update-utmp
user-sessions selinux: always try to load the full selinux db 2016-03-01 20:39:30 -05:00
vconsole treewide: fix typos (#4217) 2016-09-26 11:32:47 +02:00
.gitignore
Makefile