]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agotest: use flock when calling mkfs.btrfs 22717/head
Frantisek Sumsal [Fri, 11 Mar 2022 17:15:03 +0000 (18:15 +0100)] 
test: use flock when calling mkfs.btrfs

As stated in https://github.com/systemd/systemd/issues/21819#issuecomment-1064377645
`mkfs.btrfs` doesn't hold the lock for the whole duration of
`mkfs.btrfs`, thus causing unexpected races & test fails. Let's
wrap the `mkfs.btrfs` calls in an flock wrapper to mitigate this.

Hopefully fixes: #21819

3 years agoRevert "test: temporary workaround for #21819"
Frantisek Sumsal [Fri, 11 Mar 2022 17:17:58 +0000 (18:17 +0100)] 
Revert "test: temporary workaround for #21819"

This reverts commit 95e35511bbdb7810c00c2e4a6cbda5b187192f74.

3 years agoudev: assume block device is not locked when a new event is queued
Yu Watanabe [Thu, 24 Mar 2022 17:56:58 +0000 (02:56 +0900)] 
udev: assume block device is not locked when a new event is queued

Then, hopefully, previously requeued events are processed earlier.

3 years agoudev: split worker_lock_block_device() into two
Yu Watanabe [Thu, 24 Mar 2022 17:55:25 +0000 (02:55 +0900)] 
udev: split worker_lock_block_device() into two

This also makes return value initialized when these function return 0 to
follow our coding style.

Just a preparation for later commits.

3 years agoudev: requeue event when the corresponding block device is locked by another process
Yu Watanabe [Tue, 15 Mar 2022 04:50:06 +0000 (13:50 +0900)] 
udev: requeue event when the corresponding block device is locked by another process

Previously, if a block device is locked by another process, then the
corresponding worker skip to process the corresponding event, and does
not broadcast the uevent to libudev listners. This causes several issues:

- During a period of a device being locked by a process, if a user trigger
  an event with `udevadm trigger --settle`, then it never returned.

- When there is a delay between close and unlock in a process, then the
  synthesized events triggered by inotify may not be processed. This can
  happens easily by wrapping mkfs with flock. This causes severe issues
  e.g. new devlinks are not created, or old devlinks are not removed.

This commit makes events are requeued with a tiny delay when the corresponding
block devices are locked by other processes. With this way, the triggered
uevent may be delayed but is always processed by udevd. Hence, the above
issues can be solved. Also, it is not necessary to watch a block device
unconditionally when it is already locked. Hence, the logic is dropped.

3 years agoudev: store action in struct Event
Yu Watanabe [Thu, 24 Mar 2022 17:39:55 +0000 (02:39 +0900)] 
udev: store action in struct Event

3 years agoudev: introduce device_broadcast() helper function
Yu Watanabe [Thu, 24 Mar 2022 17:33:55 +0000 (02:33 +0900)] 
udev: introduce device_broadcast() helper function

3 years agoudev: drop unnecessary clone of received sd-device object
Yu Watanabe [Thu, 24 Mar 2022 16:13:39 +0000 (01:13 +0900)] 
udev: drop unnecessary clone of received sd-device object

As the sd-device object received through sd-device-monitor is sealed,
so the corresponding udev database or uevent file will not be read.

3 years agoinotify-util: declare iterator in FOREACH_INOTIFY_EVENT()
Yu Watanabe [Thu, 24 Mar 2022 08:58:07 +0000 (17:58 +0900)] 
inotify-util: declare iterator in FOREACH_INOTIFY_EVENT()

This also makes the macro check if the event is actually in the buffer,
and if it is not, then log about that and finish the loop.

3 years agoupdate NEWS
Luca Boccassi [Thu, 24 Mar 2022 22:46:14 +0000 (22:46 +0000)] 
update NEWS

Fix typo and list all user session settings that now are documented
to work

3 years agoupdate NEWS
Lennart Poettering [Thu, 24 Mar 2022 21:41:39 +0000 (22:41 +0100)] 
update NEWS

3 years agoMerge pull request #22855 from keszybz/test-68-reload-reload
Frantisek Sumsal [Thu, 24 Mar 2022 19:52:16 +0000 (19:52 +0000)] 
Merge pull request #22855 from keszybz/test-68-reload-reload

TEST-68: replace daemon-reload with separate handler units

3 years agoMerge pull request #22840 from poettering/efivars-tweaks
Lennart Poettering [Thu, 24 Mar 2022 17:39:46 +0000 (18:39 +0100)] 
Merge pull request #22840 from poettering/efivars-tweaks

util-lib: efi variable access refactorings

3 years agoNEWS: various tweaks
Lennart Poettering [Thu, 24 Mar 2022 16:43:10 +0000 (17:43 +0100)] 
NEWS: various tweaks

3 years agoudev: try to reload selinux label database less frequently
Yu Watanabe [Sat, 12 Mar 2022 19:45:08 +0000 (04:45 +0900)] 
udev: try to reload selinux label database less frequently

Previously, `event_run()` was called repeatedly in one `event_queue_start()`
invocation. Hence, the SELinux label database is reloaded many times needlessly.
Other settings, e.g. udev rules or hwdata, are tried to be reloaded in the
beginning of `event_queue_start()`. Let's also do so for the SELinux database.

3 years agoudev: assume there is no blocker when failed to check event dependencies
Yu Watanabe [Sat, 12 Mar 2022 11:57:15 +0000 (20:57 +0900)] 
udev: assume there is no blocker when failed to check event dependencies

Previously, if udevd failed to resolve event dependency, the event is
ignored and libudev listeners did not receive the event. This is
inconsistent with the case when a worker failed to process a event,
in that case, the original uevent sent by the kernel is broadcasted to
listeners.

3 years agoudev: only ignore ENOENT or friends which suggest the block device is not exist
Yu Watanabe [Sat, 12 Mar 2022 11:40:58 +0000 (20:40 +0900)] 
udev: only ignore ENOENT or friends which suggest the block device is not exist

The ENOENT, ENXIO, and ENODEV error can happen easily when a block
device appears and soon removed. So, it is reasonable to ignore the
error. But other errors should not occur here, and hence let's handle
them as critical.

3 years agoerrno-util: add ERRNO_IS_DEVICE_ABSENT() macro
Lennart Poettering [Thu, 24 Mar 2022 12:50:50 +0000 (13:50 +0100)] 
errno-util: add ERRNO_IS_DEVICE_ABSENT() macro

Inspired by: https://github.com/systemd/systemd/pull/22717#discussion_r834254495

3 years agoudev: remove /run/udev/queue in on_post()
Yu Watanabe [Sun, 13 Mar 2022 12:22:57 +0000 (21:22 +0900)] 
udev: remove /run/udev/queue in on_post()

When the last queued event is processed, information about subsequent
events may be already queued in the netlink socket of sd-device-monitor.
In that case, previously we once removed /run/udev/queue and touch the
file soon later, and `udevadm settle` mistakenly considered all events
are processed.

To mitigate such situation, this makes /run/udev/queue removed in on_post().

3 years agoudev: use sd_event_source_disable_unref()
Yu Watanabe [Tue, 15 Mar 2022 08:47:00 +0000 (17:47 +0900)] 
udev: use sd_event_source_disable_unref()

This should not change any behavior, as the event sources are not
shared. Just for safety.

3 years agoudev: update comment and log message
Yu Watanabe [Sat, 12 Mar 2022 11:48:36 +0000 (20:48 +0900)] 
udev: update comment and log message

3 years agoefi-loader: split efi-api.[ch] from efi-loader.[ch] 22840/head
Lennart Poettering [Wed, 23 Mar 2022 11:07:06 +0000 (12:07 +0100)] 
efi-loader: split efi-api.[ch] from efi-loader.[ch]

Some refactoring: split efi-loader.[ch] in two: isolate the calls that
implement out boot loader interface spec, and those which implement
access to upstream UEFI firmware features.

They are quite different in nature and behaviour, and even semantically
it makes to keep these two separate. At the very least because the
previous name "efi-loader.[ch]" suggests all was about loader-specific
APIs, but much of it is generic uefi stuff...

While we are at it, I renamed a bunch of return parameters to follow our
usual ret_xyz naming. But besides renaming no real code changes.

3 years agoefivars: define efi variable flags less weirdly
Lennart Poettering [Tue, 22 Mar 2022 15:43:42 +0000 (16:43 +0100)] 
efivars: define efi variable flags less weirdly

The flags are actually 32bit values, but aligned with zeroes befitting a
64bit value. Let's fix that.

3 years agoefivarfs: rename a couple of return params to ret_xyz/ret
Lennart Poettering [Tue, 22 Mar 2022 15:38:25 +0000 (16:38 +0100)] 
efivarfs: rename a couple of return params to ret_xyz/ret

3 years agoefivars: downgrade log level in systemd_efi_options_efivarfs_if_newer()
Lennart Poettering [Tue, 22 Mar 2022 15:34:39 +0000 (16:34 +0100)] 
efivars: downgrade log level in systemd_efi_options_efivarfs_if_newer()

The only caller logs anyway, let's avoid duplicate logging above
LOG_DEBUG.

3 years agoefivars: no need to convert ENOENT → ENODATA twice
Lennart Poettering [Tue, 22 Mar 2022 15:33:09 +0000 (16:33 +0100)] 
efivars: no need to convert ENOENT → ENODATA twice

read_efi_options_variable() already does this, don#t do it again.

3 years agoefivars: tweak debug log message in efi_get_secure_boot_mode()
Lennart Poettering [Tue, 22 Mar 2022 15:32:35 +0000 (16:32 +0100)] 
efivars: tweak debug log message in efi_get_secure_boot_mode()

mention what we'll do as effect of the error we are seeing and eat up.

3 years agoefivars: cache ENOENT as no efi secure boot
Lennart Poettering [Tue, 22 Mar 2022 15:30:34 +0000 (16:30 +0100)] 
efivars: cache ENOENT as no efi secure boot

On systems lacking EFI or the SecureBoot efi var the caching of this
info didn#t work, since we'd see ENOENT when reading the var, and cache
that, which we then use as reason to retry next time.

Let's fix that and convert ENOENT to "secure boot", because that's what
it really means. All other errors are left as is (and reason to retry).
But let's add some debug logging for that case.

3 years agoTEST-68: instead of calling daemon-reload, just use different cleanup units 22855/head
Zbigniew Jędrzejewski-Szmek [Thu, 24 Mar 2022 12:45:03 +0000 (13:45 +0100)] 
TEST-68: instead of calling daemon-reload, just use different cleanup units

On a very slow machine, things are executed out-of-order, and something
pins the previously-exited unit. Instead of fighting with this with daemon-reload,
let's just use a different cleanup unit.

Hopefully fixes #22755.

3 years agobpf-firewall: invert test
Lennart Poettering [Thu, 24 Mar 2022 09:46:40 +0000 (10:46 +0100)] 
bpf-firewall: invert test

Following our coding style of exiting early (instead of deep nesting),
let's invert the if check here.

Inspired by: https://github.com/systemd/systemd/pull/21602#pullrequestreview-919960060

3 years agologind-user: log about the right unit
David Tardon [Thu, 24 Mar 2022 07:55:24 +0000 (08:55 +0100)] 
logind-user: log about the right unit

3 years agojournal-remote: refuse to specify --trust option when gnutls is disabled
Yu Watanabe [Thu, 24 Mar 2022 07:58:59 +0000 (16:58 +0900)] 
journal-remote: refuse to specify --trust option when gnutls is disabled

and check_permission() should not be called in that case.

Replaces #22847.

3 years agoTEST-68: get rid of unnecessary descriptions
Zbigniew Jędrzejewski-Szmek [Thu, 24 Mar 2022 12:32:41 +0000 (13:32 +0100)] 
TEST-68: get rid of unnecessary descriptions

The name of the unit already says all, no need to duplicate this.
And the comments can easily get out of date, as they did.

3 years agocryptsetup: fix typo
Antonio Alvarez Feijoo [Thu, 24 Mar 2022 11:43:35 +0000 (12:43 +0100)] 
cryptsetup: fix typo

3 years agoupdate TODO
Lennart Poettering [Thu, 24 Mar 2022 08:44:52 +0000 (09:44 +0100)] 
update TODO

3 years agoMerge pull request #22800 from poettering/safe-ptr-sub1
Yu Watanabe [Wed, 23 Mar 2022 21:34:09 +0000 (06:34 +0900)] 
Merge pull request #22800 from poettering/safe-ptr-sub1

Add helper macro PTR_SUB1() to deal with backwards iteration through arrays without UB

3 years agonetwork: do not enable IPv4 ACD for IPv4 link-local address if ACD is disabled explicitly
Yu Watanabe [Tue, 22 Mar 2022 13:01:08 +0000 (22:01 +0900)] 
network: do not enable IPv4 ACD for IPv4 link-local address if ACD is disabled explicitly

The commit 1cf4ed142d6c1e2b9dc6a0bc74b6a83ae30b0f8e makes the IPv4 ACD
enabled unconditionally for IPv4 link-local addresses even if users
explicitly disable ACD.

This makes the IPv4 ACD is enabled by default, but honor user setting.

Fixes #22763.

3 years agolgtm: disable cpp/missing-return (again)
Frantisek Sumsal [Fri, 11 Mar 2022 08:19:29 +0000 (17:19 +0900)] 
lgtm: disable cpp/missing-return (again)

It looks like the fix for https://github.com/github/codeql/issues/8409
is not yet in production (and the respective query needs to be enabled
in both the main and the PR branch to get results for it, hence why it
passed in #22837).

3 years agomeson: Detect python instead of hard-coding python3
Heiko Becker [Mon, 21 Mar 2022 19:47:02 +0000 (20:47 +0100)] 
meson: Detect python instead of hard-coding python3

It allows to specify the desired python executable (and version) via
meson's native file if there are multiple versions available.

3 years agoRevert "lgtm: disable cpp/missing-return"
Frantisek Sumsal [Wed, 23 Mar 2022 11:47:23 +0000 (12:47 +0100)] 
Revert "lgtm: disable cpp/missing-return"

This reverts commit 6f4bffb586dfb0ce8db4e02ccb7f076a45bca419.

Should be, hopefully, fixed by https://github.com/github/codeql/issues/8409.

3 years agodns-domain: use PTR_SUB1() macro 22800/head
Yu Watanabe [Wed, 23 Mar 2022 12:56:19 +0000 (21:56 +0900)] 
dns-domain: use PTR_SUB1() macro

3 years agotest: add tests for device id
Yu Watanabe [Wed, 23 Mar 2022 05:51:22 +0000 (14:51 +0900)] 
test: add tests for device id

3 years agosd-device: use path_find_last_component() to set driver subsystem
Yu Watanabe [Wed, 23 Mar 2022 05:45:49 +0000 (14:45 +0900)] 
sd-device: use path_find_last_component() to set driver subsystem

3 years agopath-util: use PTR_SUB1() macro in path_find_last_component()
Yu Watanabe [Wed, 23 Mar 2022 04:04:57 +0000 (13:04 +0900)] 
path-util: use PTR_SUB1() macro in path_find_last_component()

3 years agocore/namespace: inline one more iterator variable
Yu Watanabe [Wed, 23 Mar 2022 05:30:24 +0000 (14:30 +0900)] 
core/namespace: inline one more iterator variable

3 years agotree-wide: use PTR_SUB1() at two places where appropriate
Lennart Poettering [Mon, 21 Mar 2022 13:24:50 +0000 (14:24 +0100)] 
tree-wide: use PTR_SUB1() at two places where appropriate

3 years agodoc: two markdown markup fixes
Lennart Poettering [Wed, 23 Mar 2022 12:47:15 +0000 (13:47 +0100)] 
doc: two markdown markup fixes

3 years agomacro: add macro that simplifies going backwards through an array via pointers
Lennart Poettering [Mon, 21 Mar 2022 13:23:38 +0000 (14:23 +0100)] 
macro: add macro that simplifies going backwards through an array via pointers

Inspired by #22797, let's avoid some UB when iterating through arrays.

3 years agovarious: inline some iterator variables
Zbigniew Jędrzejewski-Szmek [Mon, 21 Mar 2022 13:20:53 +0000 (14:20 +0100)] 
various: inline some iterator variables

3 years agodoc: add a bunch of missing <br>
Lennart Poettering [Wed, 23 Mar 2022 12:43:47 +0000 (13:43 +0100)] 
doc: add a bunch of missing <br>

3 years agoMerge pull request #22835 from keszybz/foreach_string-inline-iterator
Yu Watanabe [Wed, 23 Mar 2022 12:43:02 +0000 (21:43 +0900)] 
Merge pull request #22835 from keszybz/foreach_string-inline-iterator

Inline the iterator declaration in FOREACH_STRING

3 years agoMerge pull request #22836 from poettering/more-build-image-docs
Zbigniew Jędrzejewski-Szmek [Wed, 23 Mar 2022 11:42:47 +0000 (12:42 +0100)] 
Merge pull request #22836 from poettering/more-build-image-docs

docs: more tweaks for the image building docs

3 years agoupdate TODO
Lennart Poettering [Wed, 23 Mar 2022 11:02:43 +0000 (12:02 +0100)] 
update TODO

3 years agodocs: extend BUILDING_IMAGES with a section about IMAGE_ID=/IMAGE_VERSION= 22836/head
Lennart Poettering [Wed, 23 Mar 2022 11:24:03 +0000 (12:24 +0100)] 
docs: extend BUILDING_IMAGES with a section about IMAGE_ID=/IMAGE_VERSION=

Also, beef up links everywhere.

3 years agodocs: link up new image building docs a bit
Lennart Poettering [Wed, 23 Mar 2022 11:04:28 +0000 (12:04 +0100)] 
docs: link up new image building docs a bit

3 years agodocs: make man page links in markdown Links section use teletype font, as we usually do
Lennart Poettering [Wed, 23 Mar 2022 11:02:00 +0000 (12:02 +0100)] 
docs: make man page links in markdown Links section use teletype font, as we usually do

3 years agosystemctl: use the right name in error message 22835/head
Zbigniew Jędrzejewski-Szmek [Wed, 23 Mar 2022 09:49:04 +0000 (10:49 +0100)] 
systemctl: use the right name in error message

3 years agostrv: declare iterator of FOREACH_STRING() in the loop
Zbigniew Jędrzejewski-Szmek [Wed, 23 Mar 2022 09:48:13 +0000 (10:48 +0100)] 
strv: declare iterator of FOREACH_STRING() in the loop

Same idea as 03677889f0ef42cdc534bf3b31265a054b20a354.

No functional change intended. The type of the iterator is generally changed to
be 'const char*' instead of 'char*'. Despite the type commonly used, modifying
the string was not allowed.

I adjusted the naming of some short variables for clarity and reduced the scope
of some variable declarations in code that was being touched anyway.

3 years agoMerge pull request #22791 from keszybz/bootctl-invert-order
Lennart Poettering [Wed, 23 Mar 2022 10:39:31 +0000 (11:39 +0100)] 
Merge pull request #22791 from keszybz/bootctl-invert-order

Invert order of entries w/o sort-key in sd-boot menu

3 years agoMerge pull request #22629 from nishalkulkarni/oomd_service_result
Lennart Poettering [Wed, 23 Mar 2022 09:11:45 +0000 (10:11 +0100)] 
Merge pull request #22629 from nishalkulkarni/oomd_service_result

core/oomd: Use oom-kill ServiceResult for oomd

3 years agosysupdate: fix error handling
Yu Watanabe [Wed, 23 Mar 2022 03:26:13 +0000 (12:26 +0900)] 
sysupdate: fix error handling

3 years agoNEWS: fix typo
Yu Watanabe [Wed, 23 Mar 2022 03:22:53 +0000 (12:22 +0900)] 
NEWS: fix typo

3 years agoboot: fix typo
Yu Watanabe [Wed, 23 Mar 2022 03:21:54 +0000 (12:21 +0900)] 
boot: fix typo

3 years agofs-util: make sure openat_report_new() initializes return param also on shortcut
Lennart Poettering [Tue, 22 Mar 2022 12:32:38 +0000 (13:32 +0100)] 
fs-util: make sure openat_report_new() initializes return param also on shortcut

Our coding style dictates that return parameters should be initialized
always on success, hence do so here also in the shortcut codepath.

Issue discovered by @fbuihuu:

https://github.com/systemd/systemd/pull/22808/files/ca8503f168d0632c606110da909aba3057777395#r831911069

3 years agofs-util: fix typos in comments
Lennart Poettering [Tue, 22 Mar 2022 12:30:54 +0000 (13:30 +0100)] 
fs-util: fix typos in comments

3 years agomeson: replace sh+find with an internal glob in the python helper
Zbigniew Jędrzejewski-Szmek [Tue, 22 Mar 2022 20:51:33 +0000 (21:51 +0100)] 
meson: replace sh+find with an internal glob in the python helper

As suggested in https://github.com/systemd/systemd/pull/22810#discussion_r831708052

This makes the whole thing simpler. A glob is passed to helper which then resolves
it on its own. This way it's trivial to call the helper with a different
set of files for testing.

3 years agoMerge pull request #22825 from keszybz/assorted-cleanups
Yu Watanabe [Wed, 23 Mar 2022 02:34:46 +0000 (11:34 +0900)] 
Merge pull request #22825 from keszybz/assorted-cleanups

Assorted cleanups

3 years agoNEWS: adjust MONITOR_ env vars paragraph
Luca Boccassi [Tue, 22 Mar 2022 23:03:23 +0000 (23:03 +0000)] 
NEWS: adjust MONITOR_ env vars paragraph

This actually never shipped in a release, so it's not a backward-incompatible
change. Move it down and reword it.

3 years agoNEWS: initial writeup for v251
Zbigniew Jędrzejewski-Szmek [Tue, 22 Mar 2022 20:07:41 +0000 (21:07 +0100)] 
NEWS: initial writeup for v251

3 years agoMerge pull request #22821 from poettering/udev-tweaklets
Luca Boccassi [Tue, 22 Mar 2022 20:17:38 +0000 (20:17 +0000)] 
Merge pull request #22821 from poettering/udev-tweaklets

Udev tweaklets

3 years agodocs: add some docs about building OS images
Lennart Poettering [Tue, 22 Mar 2022 10:00:11 +0000 (11:00 +0100)] 
docs: add some docs about building OS images

It's not trivial to know what to reset how. Let's document this a bit.

3 years agohomework: s/EWOULDBLOCK/EAGAIN/ 22825/head
Zbigniew Jędrzejewski-Szmek [Tue, 22 Mar 2022 13:05:37 +0000 (14:05 +0100)] 
homework: s/EWOULDBLOCK/EAGAIN/

C.f. 012d7b4217420163db5752a63da6cab39d25edf3ff55c3c7327e6ad8ab139aef52d498386d4f4a72,
ca2031fcc863fcdd4dd1594709918cb60cfd0e1b.

3 years agoerrno-to-awk: simplify expression
Zbigniew Jędrzejewski-Szmek [Tue, 22 Mar 2022 13:02:47 +0000 (14:02 +0100)] 
errno-to-awk: simplify expression

No functional change.

3 years agosd-bus: use _cleanup_ in one more place
Zbigniew Jędrzejewski-Szmek [Tue, 22 Mar 2022 09:43:03 +0000 (10:43 +0100)] 
sd-bus: use _cleanup_ in one more place

3 years agotools/dbus_exporter: deblackify and shorten code a bit
Zbigniew Jędrzejewski-Szmek [Tue, 22 Mar 2022 09:10:39 +0000 (10:10 +0100)] 
tools/dbus_exporter: deblackify and shorten code a bit

When we do mkdir, we should just use 0o777 and let the umask take care of the
rest. Specifying an explicit mode is inappropriate. And when touching the code,
let's replace black madness with normal python style.

3 years agoman: clarify that options set the message fields and are not derived from them
Zbigniew Jędrzejewski-Szmek [Tue, 22 Mar 2022 07:44:44 +0000 (08:44 +0100)] 
man: clarify that options set the message fields and are not derived from them

3 years agoMerge pull request #22778 from poettering/kernel-install-layout-rework
Zbigniew Jędrzejewski-Szmek [Tue, 22 Mar 2022 12:57:28 +0000 (13:57 +0100)] 
Merge pull request #22778 from poettering/kernel-install-layout-rework

kernel-install/bootctl: layout fixes

3 years agoman: Mention systemd-oomd now follows OOMPolicy 22629/head
Nishal Kulkarni [Sun, 13 Mar 2022 19:11:11 +0000 (00:41 +0530)] 
man: Mention systemd-oomd now follows OOMPolicy

3 years agotest/oomd: Add test for new oomd_ooms xattr
Nishal Kulkarni [Mon, 14 Mar 2022 18:40:39 +0000 (00:10 +0530)] 
test/oomd: Add test for new oomd_ooms xattr

Check if `user.oomd_ooms` xattr is being set as part of `oomd_cgroup_kill()`
this xattr tracks OOM kills that were initiated by systemd-oomd.

3 years agocore/oomd: Use oom-kill ServiceResult for oomd
Nishal Kulkarni [Sun, 13 Mar 2022 19:05:18 +0000 (00:35 +0530)] 
core/oomd: Use oom-kill ServiceResult for oomd

To notify user of kill events from systemd-oomd we now use
`SERVICE_FAILURE_OOM_KILL` as the failure result.

`unit_check_oomd_kill` now calls `notify_cgroup_oom` to
update the service result to `oom-kill`.

We add a new xattr `user.oomd_ooms` to keep track of the OOM kills
initiated by systemd-oomd, this helps us resolve a race between sending
SIGKILL to processes and checking for OOM kill status from the xattr.

Related to: #20649

3 years agosd-device: use path_compare() rather than strcmp() for sorting paths 22821/head
Lennart Poettering [Tue, 22 Mar 2022 11:58:55 +0000 (12:58 +0100)] 
sd-device: use path_compare() rather than strcmp() for sorting paths

When sorting paths it actually matters to use the right comparison
function. Example:

```
a/x
a-b/y
a_/z
```

I think people would probably expect this:

```
a/x
a-b/y
a_a/z
```

but if you use strcmp() instead of path_compare() you'd instead get:

```
a-b/y
a/x
a_a/z
```

That's because `/` is between `-` and `a` in the ascii table. I think
that's quite confusing, and we shouldn#t order that way hence.

As discussed: https://github.com/systemd/systemd/pull/22662#discussion_r831174776

3 years agosd-device: fix trivial typo
Lennart Poettering [Tue, 22 Mar 2022 11:58:31 +0000 (12:58 +0100)] 
sd-device: fix trivial typo

3 years agoMerge pull request #22662 from yuwata/udev-trigger-priority
Lennart Poettering [Tue, 22 Mar 2022 11:56:32 +0000 (12:56 +0100)] 
Merge pull request #22662 from yuwata/udev-trigger-priority

udevadm trigger: add --prioritized-subsystem option

3 years agorandom-util: use correct minimum pool size constant
Jason A. Donenfeld [Wed, 9 Mar 2022 16:10:05 +0000 (09:10 -0700)] 
random-util: use correct minimum pool size constant

The actual minimum size of the pool across supported kernel versions is
32 bytes. So adjust this minimum.

I've audited every single usage of random_pool_size(), and cannot see
anywhere that this would have any impact at all on anything. We could
actually just not change the constant and everything would be fine, or
we could change it here and that's fine too. From both a functionality
and crypto perspective, it doesn't really seem to make a substantive
difference any which way, so long as the value is ≥32. However, it's
better to be correct and have the function do what it says, so clamp it
to the right minimum.

3 years agoMerge pull request #22813 from poettering/sd-boot-man-fixes
Zbigniew Jędrzejewski-Szmek [Tue, 22 Mar 2022 07:26:57 +0000 (08:26 +0100)] 
Merge pull request #22813 from poettering/sd-boot-man-fixes

man: some sd-boot doc tweaks

3 years agoudevadm: trigger: implement --initialized-match/nomatch arguments 22662/head
Danilo Krummrich [Mon, 14 Jun 2021 15:46:00 +0000 (17:46 +0200)] 
udevadm: trigger: implement --initialized-match/nomatch arguments

systemd-udev-trigger.service by default triggeres all devices regardless
of whether they were already recognized by systemd-udevd.

There are machines (especially in embedded environments) where
systemd-udev-trigger.service is configured to run at a later stage of
the boot sequence, which can lead to quite a lot of devices being
triggered although they were already recognized by systemd-udevd.

Re-triggering a lot of devices is a relatively expensive operation and
therefore should be avoided if unnecessary.

Therefore this patch introduces --initialized-nomatch, which filters out
devices that are already present in the udev database. For consistance
reasons --initialized-match is implemented as well, which filters out devices
that are *not* already present in the udev database.

Replaces #19949.

3 years agosd-device-enumerator: support to list only initialized or uninitialized devices
Yu Watanabe [Tue, 8 Mar 2022 04:58:02 +0000 (13:58 +0900)] 
sd-device-enumerator: support to list only initialized or uninitialized devices

3 years agounit: make systemd-udev-trigger.service use --prioritized-subsystem
Yu Watanabe [Mon, 7 Mar 2022 16:33:29 +0000 (01:33 +0900)] 
unit: make systemd-udev-trigger.service use --prioritized-subsystem

Replaces #19637 and #22643.

3 years agoudevadm trigger: introduce --type=all option
Yu Watanabe [Fri, 4 Mar 2022 12:45:24 +0000 (21:45 +0900)] 
udevadm trigger: introduce --type=all option

3 years agoudevadm trigger: introduce --prioritized-subsystem option
Yu Watanabe [Fri, 4 Mar 2022 15:23:13 +0000 (00:23 +0900)] 
udevadm trigger: introduce --prioritized-subsystem option

3 years agosd-device-enumerator: introduce device_enumerator_scan_devices_and_subsystems()
Yu Watanabe [Fri, 4 Mar 2022 12:40:41 +0000 (21:40 +0900)] 
sd-device-enumerator: introduce device_enumerator_scan_devices_and_subsystems()

3 years agosd-device-enumerator: drop /sys/subsystem support
Yu Watanabe [Sat, 19 Mar 2022 00:35:32 +0000 (09:35 +0900)] 
sd-device-enumerator: drop /sys/subsystem support

This addresses the comment by Lennart
https://github.com/systemd/systemd/pull/22662#discussion_r829799863:
> /sys/subsystem is preparation for a future that never came.
> And given that the main proponent of this left Linux kernel
> development (Kay), I doubt this will ever come. So maybe we
> should start dropping references to /sys/subsystem/ given it's
> unlikely to materialize anytime soon.

3 years agosd-device-enumerator: introduce device_enumerator_add_prioritized_subsystem()
Yu Watanabe [Mon, 7 Mar 2022 16:20:42 +0000 (01:20 +0900)] 
sd-device-enumerator: introduce device_enumerator_add_prioritized_subsystem()

If a subsystem is specified, then matching devices and their parents are
listed at first.

3 years agosd-device-enumerator: introduce device_enumerator_sort_devices()
Yu Watanabe [Fri, 4 Mar 2022 13:40:49 +0000 (22:40 +0900)] 
sd-device-enumerator: introduce device_enumerator_sort_devices()

and devices are sorted when the iteration started.

Previously, devices added by udev_enumerate_add_syspath() ->
device_enumerator_add_device() are not sorted. This fixes the issue.

3 years agosd-device-enumerator: introduce device_enumerator_unref_devices() helper function
Yu Watanabe [Fri, 4 Mar 2022 12:09:26 +0000 (21:09 +0900)] 
sd-device-enumerator: introduce device_enumerator_unref_devices() helper function

3 years agosd-device-enumerator: introduce sound_device_compare() and devpath_is_late_block...
Yu Watanabe [Thu, 10 Mar 2022 10:08:04 +0000 (19:08 +0900)] 
sd-device-enumerator: introduce sound_device_compare() and devpath_is_late_block() helper functions

3 years agokernel-install: check for /loader/entries.srel file as explicit marker for standards... 22778/head
Lennart Poettering [Thu, 17 Mar 2022 17:25:40 +0000 (18:25 +0100)] 
kernel-install: check for /loader/entries.srel file as explicit marker for standards compliant /loader/entries directory

3 years agobootctl: automatically write out $BOOT/entries/standard.srel
Lennart Poettering [Thu, 17 Mar 2022 17:19:57 +0000 (18:19 +0100)] 
bootctl: automatically write out $BOOT/entries/standard.srel

3 years agobootctl: generalize open_tmpfile_linkable() use a bit
Lennart Poettering [Thu, 17 Mar 2022 17:18:04 +0000 (18:18 +0100)] 
bootctl: generalize open_tmpfile_linkable() use a bit

We want FILE* here, instead of a plain fd. Let's generalize this in
tmpfile-util.c, so we can reuse it later easily.

3 years agodocs: add /loader/entries.srel to the boot loader spec
Lennart Poettering [Thu, 17 Mar 2022 17:35:53 +0000 (18:35 +0100)] 
docs: add /loader/entries.srel to the boot loader spec

This new file is supposed to address conflicts with Fedora/Grub's
frankenbootloaderspec implementation, that squatted the /loader/entries/
dir, but place incompatible files in them (that do variable expansion?).

A simple text file /loader/entries.srel shall indicate which spec is
implemented. If it contains the string "type1\n" then the
/loader/entries/ directory implements our standard spec, otherwise
something else.