]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agopid1: remove dot from initial announcement 19765/head
Zbigniew Jędrzejewski-Szmek [Sun, 23 May 2021 07:20:47 +0000 (09:20 +0200)] 
pid1: remove dot from initial announcement

This line is so long, that the end is usually not visible on
the terminal. The dot looks out of place, and dropping it saves one
column for more interesting content.

3 years agotty-ask-password-agent: log when starting a query on the console
Zbigniew Jędrzejewski-Szmek [Sun, 23 May 2021 08:06:38 +0000 (10:06 +0200)] 
tty-ask-password-agent: log when starting a query on the console

When looking at logs from a boot with an encrypted device, I see
(with unrelevant messages snipped):
[    2.751692] systemd[1]: Started Dispatch Password Requests to Console.
[    7.929199] systemd-cryptsetup[258]: Set cipher aes, mode xts-plain64, key size 512 bits for device /dev/disk/by-uuid/2d9b648a-15b1-4204-988b-ec085089f8ce.
[    9.499483] systemd[1]: Finished Cryptography Setup for luks-2d9b648a-15b1-4204-988b-ec085089f8ce.

There is a hug gap in timing without any explanatory message. If I didn't type
in the password, there would be no way to figure out why things blocked from
this log, so let's log something to the log too.

3 years agotty-ask-password-agent: highlight summary in help
Zbigniew Jędrzejewski-Szmek [Sun, 23 May 2021 07:54:41 +0000 (09:54 +0200)] 
tty-ask-password-agent: highlight summary in help

3 years agotty-ask-password-agent: mention optional argument in help
Zbigniew Jędrzejewski-Szmek [Sun, 23 May 2021 07:52:56 +0000 (09:52 +0200)] 
tty-ask-password-agent: mention optional argument in help

0cf84693877f060254f04cf38120f52c2aa3059c added --console.
6af621248f2255f9ce50b0bafdde475305dc4e57 added an optional argument, but didn't
update the help texts.

Note that there is no ambiguity with the optional argument because no positional
arguments are allowed.

3 years agoMerge pull request #19759 from poettering/emoji-token-text
Yu Watanabe [Sat, 29 May 2021 04:42:48 +0000 (13:42 +0900)] 
Merge pull request #19759 from poettering/emoji-token-text

fido2: add emoji to log message whenever "up" or "uv" is requested

3 years agocryptenroll: remove a tiny bit of whitespace 19759/head
Lennart Poettering [Fri, 28 May 2021 20:46:48 +0000 (22:46 +0200)] 
cryptenroll: remove a tiny bit of whitespace

3 years agofido2: add emoji to log message whenever "up" or "uv" is requested
Lennart Poettering [Fri, 28 May 2021 16:38:42 +0000 (18:38 +0200)] 
fido2: add emoji to log message whenever "up" or "uv" is requested

Let's show the touch emoji whenever the user is likely going to have to
interact with the security token. We had this at many but not all such
messages. Let's add it everywhere.

Also, upgrade all messages where the user is supposed to do something to
LOG_NOTICE. Previously some where at LOG_NOTICE and others at LOG_INFO.
These messages are more than informational after all, they require user
action, hence deserve the higher prio, in particular as that formats
them bold with our usual log coloring.

Always use the word "test" in log messages, instead of "check".

Finally, always use the same wording: "confirm presence on security
token" for "up" and "verify user on security token" for "uv"

3 years agoMerge pull request #19756 from poettering/fido2-enroll-tweaks
Lennart Poettering [Fri, 28 May 2021 16:20:15 +0000 (18:20 +0200)] 
Merge pull request #19756 from poettering/fido2-enroll-tweaks

further tweaks to fido2 code

3 years agoman: document that FIDO2 uv/up/clientPin feature support is now handled gracefully 19756/head
Lennart Poettering [Fri, 28 May 2021 14:45:12 +0000 (16:45 +0200)] 
man: document that FIDO2 uv/up/clientPin feature support is now handled gracefully

3 years agocryptsetup: revert to systemd 248 up/pin/uv FIDO2 settings when we don't have LUKS2...
Lennart Poettering [Thu, 27 May 2021 20:55:39 +0000 (22:55 +0200)] 
cryptsetup: revert to systemd 248 up/pin/uv FIDO2 settings when we don't have LUKS2 JSON data telling us the precise configuration

Let's improve compatibility with systemd 248 enrollments of FIDO2 keys:
if we have no information about the up/uv/pin settings, let's try to
determine them automatically, i.e. use up and pin if needed.

This only has an effect on LUKS2 volumes where a FIDO2 key was enrolled
with systemd 248 and thus the JSON data lacks the up/uv/pin fields. It
also matters if the user configured FIDO2 parameters explicitly via
crypttab options, so that the JSON data is not used.

For newer enrollments we'll stick to the explicit settings, as that's
generally much safer and robust.

3 years agofido2: properly handle case when no PINs are specified during auth
Lennart Poettering [Thu, 27 May 2021 20:06:25 +0000 (22:06 +0200)] 
fido2: properly handle case when no PINs are specified during auth

Also, drop redundant check for has_client_pin, which can never happen,
since we already filtered this case a bit further up.

3 years agofido2: make misadvertised clientPin feature fatal
Lennart Poettering [Thu, 27 May 2021 20:59:18 +0000 (22:59 +0200)] 
fido2: make misadvertised clientPin feature fatal

We need really need to trust the feature set, since we are about to set
it in stone storing the result in JSON, hence react a bit more allergic
about token that misadvertise the feature.

Note that I added this to be defensive, I am not aware any token that
actually misadvertises this. hence it should be safe to make this fatal,
and should this not work we can always revisit things.

3 years agocryptenroll: handle FIDO2 tokens gracefully that lack requested features
Lennart Poettering [Thu, 27 May 2021 16:47:48 +0000 (18:47 +0200)] 
cryptenroll: handle FIDO2 tokens gracefully that lack requested features

Let's try to handle keys gracefully that do not implement all features
we ask for: simply turn the feature off, and continue.

This is in particular relevant since we enroll with PIN and UP by
default, and on devices that don't support that we should just work.

Replaces: #18509

3 years agoMerge pull request #19754 from yuwata/fix-coverity-issues-and-typo
Yu Watanabe [Fri, 28 May 2021 14:03:01 +0000 (23:03 +0900)] 
Merge pull request #19754 from yuwata/fix-coverity-issues-and-typo

Fix coverity issues and typo

3 years agotree-wide: fix typo 19754/head
Yu Watanabe [Fri, 28 May 2021 10:52:12 +0000 (19:52 +0900)] 
tree-wide: fix typo

3 years agobasic/unit-file: fix use-after-free
Yu Watanabe [Fri, 28 May 2021 10:48:33 +0000 (19:48 +0900)] 
basic/unit-file: fix use-after-free

This fixes a bug introduced by e8630e695232bdfcd16b55f3faafb4329c961104.

Fixes CID#1453292.

3 years agonetwork,sd-hwdb: voidify fchmod()
Yu Watanabe [Fri, 28 May 2021 10:41:03 +0000 (19:41 +0900)] 
network,sd-hwdb: voidify fchmod()

Fixes CID#1453294.

3 years agopath-util: add missing varargs cleanup
Yu Watanabe [Fri, 28 May 2021 10:38:34 +0000 (19:38 +0900)] 
path-util: add missing varargs cleanup

Fixes CID#1453293.

3 years agoMerge pull request #19485 from yuwata/path-util
Lennart Poettering [Fri, 28 May 2021 07:31:06 +0000 (09:31 +0200)] 
Merge pull request #19485 from yuwata/path-util

path-util: introduce several path utilities and handle "." more gracefully

3 years agopath-util: make path_simplify() use path_find_first_component() 19485/head
Yu Watanabe [Tue, 4 May 2021 07:00:41 +0000 (16:00 +0900)] 
path-util: make path_simplify() use path_find_first_component()

3 years agotree-wide: always drop unnecessary dot in path
Yu Watanabe [Sat, 8 May 2021 08:43:49 +0000 (17:43 +0900)] 
tree-wide: always drop unnecessary dot in path

3 years agopath-util: make path_extract_filename/directory() handle "." gracefully
Yu Watanabe [Tue, 4 May 2021 05:40:56 +0000 (14:40 +0900)] 
path-util: make path_extract_filename/directory() handle "." gracefully

This makes the functions handle "xx/" and "xx/." as equivalent.
Moreover, now path_extract_directory() returns normalized path, that is
no redundant "/" or "/./" are contained.

3 years agopath-util: introduce path_find_last_component()
Yu Watanabe [Mon, 3 May 2021 14:47:57 +0000 (23:47 +0900)] 
path-util: introduce path_find_last_component()

3 years agopath-util: use path_equal() in empty_or_root()
Yu Watanabe [Mon, 3 May 2021 14:46:47 +0000 (23:46 +0900)] 
path-util: use path_equal() in empty_or_root()

3 years agofs-util: make chase_symlinks() use path_find_first_component()
Yu Watanabe [Sun, 2 May 2021 16:24:11 +0000 (01:24 +0900)] 
fs-util: make chase_symlinks() use path_find_first_component()

The previous commit about path_compare() breaks chase_symlinks().
This commit fixes it.

3 years agopath-util: make path_compare() and path_hash_func() ignore "."
Yu Watanabe [Sat, 1 May 2021 21:39:55 +0000 (06:39 +0900)] 
path-util: make path_compare() and path_hash_func() ignore "."

This also makes path_compare() may return arbitrary integer as it now
simply pass the result of strcmp() or memcmp().

This changes the behavior of path_extract_filename/directory() when
e.g. "/." or "/./" are input. But the change should be desired.

3 years agopath-util: use path_find_first_component() in path_make_relative()
Yu Watanabe [Sat, 1 May 2021 20:53:14 +0000 (05:53 +0900)] 
path-util: use path_find_first_component() in path_make_relative()

This also makes the function checks the result is a valid path or not.

3 years agopath-util: use path_find_first_component() in path_startswith()
Yu Watanabe [Sat, 1 May 2021 11:17:16 +0000 (20:17 +0900)] 
path-util: use path_find_first_component() in path_startswith()

This makes path_startswith() stricter. If one of the path component in
arguments is longer than NAME_MAX, it returns NULL.

3 years agopath-util: use path_is_safe() in path_is_normalized()
Yu Watanabe [Fri, 30 Apr 2021 17:55:20 +0000 (02:55 +0900)] 
path-util: use path_is_safe() in path_is_normalized()

3 years agopath-util: introduce path_is_safe()
Yu Watanabe [Fri, 30 Apr 2021 17:37:31 +0000 (02:37 +0900)] 
path-util: introduce path_is_safe()

The function is similar to path_is_valid(), but it refuses paths which
contain ".." component.

3 years agopath-util: use path_find_first_component() in path_is_valid()
Yu Watanabe [Fri, 30 Apr 2021 17:30:15 +0000 (02:30 +0900)] 
path-util: use path_find_first_component() in path_is_valid()

3 years agopath-util: introduce path_find_first_component()
Yu Watanabe [Fri, 30 Apr 2021 16:57:28 +0000 (01:57 +0900)] 
path-util: introduce path_find_first_component()

The function may be useful to iterate on each path component.

3 years agopath-util: fix off by one issue to detect slash at the end in path_extend()
Yu Watanabe [Fri, 28 May 2021 04:38:31 +0000 (13:38 +0900)] 
path-util: fix off by one issue to detect slash at the end in path_extend()

3 years agotest/networkd-test: in bridge test, wait for online after restart systemd-networkd
Dan Streetman [Mon, 24 May 2021 23:41:25 +0000 (19:41 -0400)] 
test/networkd-test: in bridge test, wait for online after restart systemd-networkd

without waiting for online, there is a race condition between systemd-networkd
actually setting the new values and the test checking those values

This also sets the link down before restarting systemd-networkd, to avoid
the wait for online being a no-op

3 years agomeson: Correctly validate that prefix is a child of rootprefix
Peter Kjellerstedt [Thu, 27 May 2021 15:05:34 +0000 (17:05 +0200)] 
meson: Correctly validate that prefix is a child of rootprefix

In commit d895e10a a test was introduced to validate that prefix is a
child of rootprefix. However, it only works when rootprefix is "/".
Since the test is ignored when rootprefix is equal to prefix, this is
only noticed if specifying both -Drootprefix= and -Dprefix=, e.g.:

  $ meson foo -Drootprefix=/foo -Dprefix=/foo/bar
  meson.build:111:8: ERROR: Problem encountered: Prefix is not below
  root prefix (now rootprefix=/foo prefix=/foo/bar)

3 years agoMerge pull request #19749 from poettering/path-extend
Yu Watanabe [Thu, 27 May 2021 20:53:57 +0000 (05:53 +0900)] 
Merge pull request #19749 from poettering/path-extend

add path_extend() helper which is a like if path_join() and strextend() had a baby

3 years agotree-wide: make use of path_extend() at many places 19749/head
Lennart Poettering [Thu, 27 May 2021 14:27:06 +0000 (16:27 +0200)] 
tree-wide: make use of path_extend() at many places

This is not a comprehensive port, but mostly some low-hanging fruit.

3 years agopath-util: add path_extend(), inspired by strextend(), but using path_join()
Lennart Poettering [Thu, 27 May 2021 14:01:20 +0000 (16:01 +0200)] 
path-util: add path_extend(), inspired by strextend(), but using path_join()

3 years agoMerge pull request #19703 from yuwata/network-ndisc-valid-time
Yu Watanabe [Thu, 27 May 2021 09:42:31 +0000 (18:42 +0900)] 
Merge pull request #19703 from yuwata/network-ndisc-valid-time

network: ndisc: always honor valid time

3 years agoMerge pull request #19743 from yuwata/dhcpv4-static-leases
Yu Watanabe [Thu, 27 May 2021 09:41:22 +0000 (18:41 +0900)] 
Merge pull request #19743 from yuwata/dhcpv4-static-leases

network: dhcp-server:  support static lease

3 years agonetwork: ndisc: update log message 19703/head
Yu Watanabe [Thu, 20 May 2021 11:50:36 +0000 (20:50 +0900)] 
network: ndisc: update log message

3 years agonetwork: ndisc: always honor valid time
Yu Watanabe [Thu, 20 May 2021 11:49:29 +0000 (20:49 +0900)] 
network: ndisc: always honor valid time

See draft-ietf-6man-slaac-renum-02, section 4.2.
https://datatracker.ietf.org/doc/html/draft-ietf-6man-slaac-renum#section-4.2

Replaces #15260.

3 years agotest-network: add a testcase for DHCP static lease 19743/head
borna-blazevic [Thu, 27 May 2021 05:50:19 +0000 (14:50 +0900)] 
test-network: add a testcase for DHCP static lease

3 years agonetwork: dhcp-server: introduce [DHCPServerStaticLease] section
borna-blazevic [Tue, 20 Oct 2020 19:46:15 +0000 (21:46 +0200)] 
network: dhcp-server: introduce [DHCPServerStaticLease] section

3 years agosd-dhcp-server: support static address to DHCPv4 offer
borna-blazevic [Thu, 23 Apr 2020 08:23:18 +0000 (10:23 +0200)] 
sd-dhcp-server: support static address to DHCPv4 offer

3 years agoMerge pull request #19736 from poettering/udev-trigger-uuid
Yu Watanabe [Thu, 27 May 2021 04:05:00 +0000 (13:05 +0900)] 
Merge pull request #19736 from poettering/udev-trigger-uuid

sd-device: add support for triggering devices with UUID support

3 years agoman: fix tag type
Christian Hesse [Wed, 26 May 2021 20:52:47 +0000 (22:52 +0200)] 
man: fix tag type

This is an option, not a command.

3 years agohash-func: change value type of string_hash_ops_free_free to void* 19736/head
Lennart Poettering [Wed, 26 May 2021 19:40:43 +0000 (21:40 +0200)] 
hash-func: change value type of string_hash_ops_free_free to void*

The generic string_hash_ops_free_free hash operations vtable currently
assumes the data pointer is of type char*. There's really no reason to
assume that though, we regularly store non-string data as value in a
hashmap. Hence, to accomodate for that, use void* as pointer for the
value (and keep char* for the key, as that's what
string_hash_ops_free_free is for, after all).

3 years agoudevadm: make use of the new uuid-enabled triggering for "udevadm trigger"
Lennart Poettering [Wed, 26 May 2021 14:13:39 +0000 (16:13 +0200)] 
udevadm: make use of the new uuid-enabled triggering for "udevadm trigger"

This adds two things:

- A new switch --uuid is added to "udevadm trigger". If specified a
  random UUID is associated with the synthettic uevent and it is printed
  to stdout. It may then be used manually to match up uevents as they
  propagate through the system.

- The UUID logic is now implicitly enabled if "udevadm trigger --settle"
  is used, in order to wait for precisely the uevents we actually
  trigger. Fallback support is kept for pre-4.13 kernels (where the
  requests for trigger uevents with uuids results in EINVAL).

3 years agosd-device: add API for triggering synthetic uevents with UUID
Lennart Poettering [Wed, 26 May 2021 14:09:18 +0000 (16:09 +0200)] 
sd-device: add API for triggering synthetic uevents with UUID

Since kernel 4.13 the kerne allows passing a UUID to generated uevents.
Optionally do so via a new sd_device_trigger_with_uuid() call, and add
sd_device_get_trigger_uuid() as helper to retrieve the UUID from a
uevent we receive.

This is useful for tracking uevents through the udev system, and waiting
for specific triggers.

(Note that the 4.13 patch allows passing arbitrary meta-info into the
uevent as well. This does not add an API for that, because I am not
convinced it makes sense — as it conflicts with our general rule that
events are "stateless" if you so will — and it complicates the interface
quite a bit).

This replaces #13881 in a way, which added a similar infra, but which
stalled, and whose synchronous settling APIs are somewhat problematic
and probably not material to merge.

3 years agoman: document that it is guaranteed that generated ID128 are never all-zero or all-one
Lennart Poettering [Wed, 26 May 2021 14:07:55 +0000 (16:07 +0200)] 
man: document that it is guaranteed that generated ID128 are never all-zero or all-one

This is the case because the ID128 we generate are all marked as v4 UUID
which requires that some bits are zero and others are one. Let's
document this so that people can rely on SD_ID128_NULL being a special
value for "uninitialized" that is always distinguishable from generated
UUIDs.

3 years agoupdate TODO
Lennart Poettering [Wed, 26 May 2021 19:42:32 +0000 (21:42 +0200)] 
update TODO

3 years agoMerge pull request #19737 from poettering/default-specifiers-env
Lennart Poettering [Wed, 26 May 2021 19:38:38 +0000 (21:38 +0200)] 
Merge pull request #19737 from poettering/default-specifiers-env

pid1: add specifier expansion for DefaultEnvironment=

3 years agoMount all fs nosuid when NoNewPrivileges=yes
Topi Miettinen [Fri, 22 Jan 2021 15:14:50 +0000 (17:14 +0200)] 
Mount all fs nosuid when NoNewPrivileges=yes

When `NoNewPrivileges=yes`, the service shouldn't have a need for any
setuid/setgid programs, so in case there will be a new mount namespace anyway,
mount the file systems with MS_NOSUID.

3 years agoman: fix list of escaped characters in unit names
Lennart Poettering [Wed, 26 May 2021 11:55:37 +0000 (13:55 +0200)] 
man: fix list of escaped characters in unit names

The code works differently than the docs, and the code is right here.
Fix the doc hence.

See VALID_CHARS in unit-name.c for details about allowed chars in unit
names, but keep in mind that "-" and "\" are special, since generated by
the escaping logic: they are OK to show up in unit names, but need to be
escaped when converting foreign strings to unit names to make sure
things remain reversible.

Fixes: #19623
3 years agoMerge pull request #19729 from poettering/networkctl-netns-check
Lennart Poettering [Wed, 26 May 2021 15:26:34 +0000 (17:26 +0200)] 
Merge pull request #19729 from poettering/networkctl-netns-check

networkctl: check that client netns matches networkd netns

3 years agocore: support specifier expansion in DefaultEnvironment= and ManagerEnvironment= 19737/head
Lennart Poettering [Wed, 26 May 2021 15:17:11 +0000 (17:17 +0200)] 
core: support specifier expansion in DefaultEnvironment= and ManagerEnvironment=

Strictly speaking adding this is a compatibility break, given that
previously % weren't special. But I'd argue that was simply a bug, as
for the much more prominent Environment= service setting we always
resolved specifiers, and DEfaultEnvironment= is explicitly listed as
being the default for that. Hence, let's fix that.

Replaces: #16787

3 years agorepart: resolve $TMP specifiers too
Lennart Poettering [Wed, 26 May 2021 15:10:56 +0000 (17:10 +0200)] 
repart: resolve $TMP specifiers too

This might be useful for CopyFiles=, to reference some subdir of $TMP in
a generic way. This allows us to use the new common
system_and_tmp_specifier_table[].

3 years agosysusers: add a generic specifier table for common cases
Lennart Poettering [Wed, 26 May 2021 15:08:38 +0000 (17:08 +0200)] 
sysusers: add a generic specifier table for common cases

This moves the definition of the specifier table consisting only of
system and /tmp specifiers into generic code so that we can share it.
This patch only adds one user of it for now. Follow-up patches will add
more.

3 years agohexdecoct: make return parameters of unbase64mem() and unhexmem() optional
Lennart Poettering [Wed, 26 May 2021 11:32:11 +0000 (13:32 +0200)] 
hexdecoct: make return parameters of unbase64mem() and unhexmem() optional

Inspired by: #19059

3 years agotest-network: refuse RA if not necessary 19729/head
Yu Watanabe [Wed, 26 May 2021 12:22:13 +0000 (21:22 +0900)] 
test-network: refuse RA if not necessary

3 years agotest-network: wait for that the link is in configuring state at the beginning
Yu Watanabe [Wed, 26 May 2021 12:13:56 +0000 (21:13 +0900)] 
test-network: wait for that the link is in configuring state at the beginning

3 years agoman: document udevadm info output prefixes
Lennart Poettering [Wed, 26 May 2021 08:54:57 +0000 (10:54 +0200)] 
man: document udevadm info output prefixes

Fixes: #19663
3 years agoman: try to clarify that nss-mymachines does not provide name resolution outside...
Lennart Poettering [Wed, 26 May 2021 09:10:18 +0000 (11:10 +0200)] 
man: try to clarify that nss-mymachines does not provide name resolution outside its own scope

Fixes: #18229
3 years agoman: explicit say for priority/weight values whether more is more or less
Lennart Poettering [Wed, 26 May 2021 09:23:06 +0000 (11:23 +0200)] 
man: explicit say for priority/weight values whether more is more or less

Fixes: #17523
3 years agonetworkctl: politely refuse being called from a different netns than the networkd...
Lennart Poettering [Wed, 26 May 2021 08:39:33 +0000 (10:39 +0200)] 
networkctl: politely refuse being called from a different netns than the networkd instance we talk to

Otherwise things get very confusing since we mix up netens data from our
client side and from the data we retrieve from networkd.

In the long run we should teach networkctl some switch to operate safely
on other netns, and in that case also determine the right networkd
instance for that namespace.

Fixes: #19236
3 years agonetworkd: add bus property exposing network namepace ID we run in
Lennart Poettering [Wed, 26 May 2021 08:37:18 +0000 (10:37 +0200)] 
networkd: add bus property exposing network namepace ID we run in

This is useful for clients to determine whether they are running in the
same network namespace as networkd.

Note that access to /proc/$PID/ns/ is restricted and only permitted to
equally privileged programs. This new bus property is primarily a way to
work around this, so that unprivileged clients can determine the
networkd netns, too.

3 years agoREADME: drop reference to Kinvolk
Lennart Poettering [Wed, 26 May 2021 07:34:14 +0000 (09:34 +0200)] 
README: drop reference to Kinvolk

Kinvolk got bought by Microsoft recently, I doubt they'd even be open
for engineering services like this, hence let's drop the free
advertisement.

3 years agoMerge pull request #19726 from poettering/path-event-symlink
Yu Watanabe [Wed, 26 May 2021 01:51:00 +0000 (10:51 +0900)] 
Merge pull request #19726 from poettering/path-event-symlink

teach .path units to notice events on paths with components that are symlinks

3 years agoMerge pull request #19727 from poettering/pcr-comma
Yu Watanabe [Wed, 26 May 2021 01:37:24 +0000 (10:37 +0900)] 
Merge pull request #19727 from poettering/pcr-comma

Allow PCRs to be separated by "+" instead of ","

3 years agocore/service: do not set zero error to log_unit_debug_errno()
Yu Watanabe [Tue, 25 May 2021 20:02:18 +0000 (05:02 +0900)] 
core/service: do not set zero error to log_unit_debug_errno()

Fixes #19725.

3 years agodns-domain: fix build failure with libidn
Yu Watanabe [Tue, 25 May 2021 19:40:09 +0000 (04:40 +0900)] 
dns-domain: fix build failure with libidn

Follow-up for 319a4f4bc46b230fc660321e99aaac1bc449deea.

Fixes #19723.

3 years agoMerge pull request #19722 from poettering/empty-string-loginctl-man
Luca Boccassi [Tue, 25 May 2021 22:23:42 +0000 (23:23 +0100)] 
Merge pull request #19722 from poettering/empty-string-loginctl-man

document that "loginctl kill-session" takes an empty string + add the same for per-user stuff

3 years agoload-fragment: validate paths properly
Lennart Poettering [Tue, 25 May 2021 15:25:40 +0000 (17:25 +0200)] 
load-fragment: validate paths properly

The comment suggests we validate paths here, but we actually didn't, we
only validated filenames. Let' fix that.

(Note this still lets any kind of paths through, including those with
".." and stuff, this is not a normalization check after all)

3 years agotest: add simple test for PCR list parsing 19727/head
Lennart Poettering [Tue, 25 May 2021 21:40:10 +0000 (23:40 +0200)] 
test: add simple test for PCR list parsing

3 years agotpm2-util: accept empty string for empty PCR list
Lennart Poettering [Tue, 25 May 2021 21:40:01 +0000 (23:40 +0200)] 
tpm2-util: accept empty string for empty PCR list

3 years agotpm2: support "+" as separator for TPM PCR lists
Lennart Poettering [Tue, 25 May 2021 21:26:31 +0000 (23:26 +0200)] 
tpm2: support "+" as separator for TPM PCR lists

Previously, we supported only "," as separator. This adds support for
"+" and makes it the documented choice.

This is to make specifying PCRs in crypttab easier, since commas are
already used there for separating volume options, and needless escaping
sucks.

"," continues to be supported, but in order to keep things minimal not
documented.

Fixe: #19205

3 years agocore: watch paths with symlinks in .path units 19726/head
Lennart Poettering [Tue, 25 May 2021 21:10:36 +0000 (23:10 +0200)] 
core: watch paths with symlinks in .path units

When watching paths that contain symlinks in some element we so far
always only watched the inode they are pointing to, not the symlink
inode itself. Let's fix that and always watch both. We do this by simply
installing the inotify watch once with and once without IN_DONT_FOLLOW.
For non-symlink inodes this just overrides the same watch twice (where
the second one replaces the first), which is has no effect effectively.
For symlinks it means we'll watch both source and destination.

Fixes: #17727
3 years agocore: optimize loop in path_spec_fd_event()
Lennart Poettering [Tue, 25 May 2021 21:09:42 +0000 (23:09 +0200)] 
core: optimize loop in path_spec_fd_event()

Let's avoid the whole loop if it can never match

3 years agocore: log about all errors in path_spec_watch()
Lennart Poettering [Tue, 25 May 2021 21:08:50 +0000 (23:08 +0200)] 
core: log about all errors in path_spec_watch()

So far we logged about most, but not all errors. Adding log to all
errors.

3 years agocore: align path inotify mask table a bit
Lennart Poettering [Tue, 25 May 2021 21:08:26 +0000 (23:08 +0200)] 
core: align path inotify mask table a bit

3 years agoMerge pull request #19322 from poettering/dep-split
Lennart Poettering [Tue, 25 May 2021 20:07:11 +0000 (22:07 +0200)] 
Merge pull request #19322 from poettering/dep-split

core: rework dependency system to be based on atoms + add three new dep types

3 years agoman: documet that loginctl {terminate|kill}-{session|user} take the empty string... 19722/head
Lennart Poettering [Tue, 25 May 2021 15:42:34 +0000 (17:42 +0200)] 
man: documet that loginctl {terminate|kill}-{session|user} take the empty string, optionally

Fixes: #19711
3 years agologinctl: kill calling user when invoked with empty string
Lennart Poettering [Tue, 25 May 2021 15:40:54 +0000 (17:40 +0200)] 
loginctl: kill calling user when invoked with empty string

A suggested by: #19711

3 years agoMerge pull request #19705 from bluca/bpf_dlopen
Lennart Poettering [Tue, 25 May 2021 14:51:16 +0000 (16:51 +0200)] 
Merge pull request #19705 from bluca/bpf_dlopen

core: make libbpf a dlopen() dependency

3 years agotest: add test for OnSuccess= + Uphold= + PropagatesStopTo= + BindsTo= 19322/head
Lennart Poettering [Wed, 14 Apr 2021 15:34:25 +0000 (17:34 +0200)] 
test: add test for OnSuccess= + Uphold= + PropagatesStopTo= + BindsTo=

3 years agotest-engine: ensure atom bits are properly packed
Lennart Poettering [Wed, 14 Apr 2021 20:43:15 +0000 (22:43 +0200)] 
test-engine: ensure atom bits are properly packed

Let's make sure all atoms are actually used, and no holes are left.

3 years agocore: reorder where we add units to queues in unit_notify()
Lennart Poettering [Mon, 26 Apr 2021 20:07:24 +0000 (22:07 +0200)] 
core: reorder where we add units to queues in unit_notify()

This moves all calls that shall do deferred work on detecting whether to
start/stop the unit or dependent units after a unit state change to the
end of the function, to make things easier to read.

So far, these calls were spread all over the function, and
conditionalized needlessly on MANAGER_RELOADING(). This is unnecessary,
since the queues are not dispatched while reloading anyway, and
immediately before acting on a queued unit we'll check if the suggested
operation really makes sense.

The only conditionalizaiton we leave in is on checking the new unit
state itself, since we have that in a local variable anyway.

3 years agocore: change BoundBy= dependency handling to be processed by a deferred work queue
Lennart Poettering [Thu, 8 Apr 2021 20:05:15 +0000 (22:05 +0200)] 
core: change BoundBy= dependency handling to be processed by a deferred work queue

So far StopWhenUnneeded= handling and UpheldBy= handling was already
processed by a queue that is dispatched in a deferred mode of operation
instead of instantly. This changes BoundBy= handling to be processed the
same way.

This should ensure that all *event*-to-job propagation is done directly
from unit_notify(), while all *state*-to-job propagation is done from a
deferred work queue, quite systematically. The work queue is submitted
to by unit_notify() too.

Key really is the difference between event and state: some jobs shall be
queued one-time on events (think: OnFailure= + OnSuccess= and similar),
others shall be queued continuously when a specific state is in effect
(think: UpheldBy=).  The latter cases are usually effect of the
combination of states of a few units (e.g. StopWhenUnneeded= checks
wether any of the Wants=/Requires=/… deps are still up before acting),
and hence it makes sense to trigger them to be run after an individual
unit's state changed, but process them on a queue that runs whenever
there's nothing else to do that ensures the decision on them is only
taken after all jobs/queued IO events are dispatched, and things
settled, so that it makes sense to come to a combined conclusion. If
we'd dispatch this work immediately inside of unit_notify() we'd always
act instantly, even though another event from another unit that is
already queued might make the work unnecessary or invalid.

This is mostly a commit to make things philosophically clean. It does
not add features, but it should make corner cases more robust.

3 years agocore: make unneeded check a bit tighter
Lennart Poettering [Mon, 26 Apr 2021 19:02:31 +0000 (21:02 +0200)] 
core: make unneeded check a bit tighter

Let's not consider a unit unneeded while it is reloading.

Uneeded should be a pretty weak concept: if there's any doubt that
something bit be needed, then assume it is.

3 years agocore: order reverse dep table in same way as enum
Lennart Poettering [Wed, 14 Apr 2021 16:38:42 +0000 (18:38 +0200)] 
core: order reverse dep table in same way as enum

3 years agocore: implement Uphold= dependency type
Lennart Poettering [Wed, 14 Apr 2021 13:24:08 +0000 (15:24 +0200)] 
core: implement Uphold= dependency type

This is like a really strong version of Wants=, that keeps starting the
specified unit if it is ever found inactive.

This is an alternative to Restart= inside a unit, acknowledging the fact
that whether to keep restarting the unit is sometimes not a property of
the unit itself but the state of the system.

This implements a part of what #4263 requests. i.e. there's no
distinction between "always" and "opportunistic". We just dumbly
implement "always" and become active whenever we see no job queued for
an inactive unit that is supposed to be upheld.

3 years agocore: add new OnSuccess= dependency type
Lennart Poettering [Wed, 14 Apr 2021 12:36:15 +0000 (14:36 +0200)] 
core: add new OnSuccess= dependency type

This is similar to OnFailure= but is activated whenever a unit returns
into inactive state successfully.

I was always afraid of adding this, since it effectively allows building
loops and makes our engine Turing complete, but it pretty much already
was it was just hidden.

Given that we have per-unit ratelimits as well as an event loop global
ratelimit I feel safe to add this finally, given it actually is useful.

Fixes: #13386
3 years agocore: use StopPropagatedFrom= as default for .mount → .device unit dependencies
Lennart Poettering [Wed, 14 Apr 2021 09:22:44 +0000 (11:22 +0200)] 
core: use StopPropagatedFrom= as default for .mount → .device unit dependencies

Let's make use of the new dependency type for .mount/.device units,
after all we added it for this purpose.

Fixes: #9869
3 years agocore: add new PropagateStopTo= dependency (and inverse)
Lennart Poettering [Tue, 13 Apr 2021 20:30:31 +0000 (22:30 +0200)] 
core: add new PropagateStopTo= dependency (and inverse)

This takes inspiration from PropagatesReloadTo=, but propagates
stop jobs instead of restart jobs.

This is defined based on exactly two atoms: UNIT_ATOM_PROPAGATE_STOP +
UNIT_ATOM_RETROACTIVE_STOP_ON_STOP. The former ensures that when the
unit the dependency is originating from is stopped based on user
request, we'll propagate the stop job to the target unit, too. In
addition, when the originating unit suddenly stops from external causes
the stopping is propagated too. Note that this does *not* include the
UNIT_ATOM_CANNOT_BE_ACTIVE_WITHOUT atom (which is used by BoundBy=),
i.e. this dependency is purely about propagating "edges" and not
"levels", i.e. it's about propagating specific events, instead of
continious states.

This is supposed to be useful for dependencies between .mount units and
their backing .device units. So far we either placed a BindsTo= or
Requires= dependency between them. The former gave a very clear binding
of the to units together, however was problematic if users establish
mounnts manually with different block device sources than our
configuration defines, as we there might come to the conclusion that the
backing device was absent and thus we need to umount again what the user
mounted. By combining Requires= with the new StopPropagatedFrom= (i.e.
the inverse PropagateStopTo=) we can get behaviour that matches BindsTo=
in every single atom but one: UNIT_ATOM_CANNOT_BE_ACTIVE_WITHOUT is
absent, and hence the level-triggered logic doesn't apply.

Replaces: #11340

3 years agocore: add a reverse dep for OnFailure=
Lennart Poettering [Tue, 13 Apr 2021 18:50:21 +0000 (20:50 +0200)] 
core: add a reverse dep for OnFailure=

Let's add an implicit reverse dep OnFailureOf=. This is exposed via the
bus to make things more debuggable: you can now ask systemd for which
units a specific unit is the failure handler.

OnFailure= was the only dependency type that had no inverse, this fixes
that.

Now that deps are a bit cheaper, it should be OK to add deps that only
serve debug purposes.

3 years agocore: hide cgroup fields in unit_dump() for non-cgroup unit types
Lennart Poettering [Tue, 13 Apr 2021 18:24:15 +0000 (20:24 +0200)] 
core: hide cgroup fields in unit_dump() for non-cgroup unit types

A bunch of properties in the main Unit strcture only make sense for
cgroup units. Let's hide them from unit types that have no relation to
cgroups.

3 years agocore: convert Slice= into a proper dependency (and add a back dependency)
Lennart Poettering [Tue, 13 Apr 2021 16:37:25 +0000 (18:37 +0200)] 
core: convert Slice= into a proper dependency (and add a back dependency)

The slice a unit is assigned to is currently a UnitRef reference. Let's
turn it into a proper dependency, to simplify and clean up code a bit.
Now that new dep types are cheaper, deps should generally be preferable
over everything else, if the concept applies.

This brings one major benefit: we often have to iterate through all unit
a slice contains. So far we iterated through all Before= dependencies of
the slice unit to achieve that, filtering out unrelated units, and
taking benefit of the fact that slice units are implicitly ordered
Before= the units they contain. By making Slice= a proper dependency,
and having an accompanying SliceOf= dependency type, this is much
simpler and nicer as we can directly enumerate the units a slice
contains.

The forward dependency is actually called InSlice internally, since we
already used the UNIT_SLICE name as UnitType field. However, since we
don't intend to expose the dependency to users as dep anyway (we already
have the regular Slice D-Bus property for this) this shouldn't matter.
The SliceOf= implicit dependency type (the erverse of Slice=/InSlice=)
is exported over the bus, to make things a bit nicer to debug and
discoverable.

3 years agocore: add UNIT_GET_SLICE() helper
Lennart Poettering [Mon, 26 Apr 2021 16:14:07 +0000 (18:14 +0200)] 
core: add UNIT_GET_SLICE() helper

In a later commit we intend to move the slice logic to use proper
dependencies instead of a "UnitRef" object. This preparatory commit
drops direct use of the slice UnitRef object for a static inline
function UNIT_GET_SLICE() that is both easier to grok, and allows us to
easily replace its internal implementation later on.

3 years agotest-engine: extend engine test
Lennart Poettering [Tue, 13 Apr 2021 14:50:45 +0000 (16:50 +0200)] 
test-engine: extend engine test

Let's verify that the dependency type to atom mapping is consistent.

Let's also verify that dependency merging works correctly.