]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agotest: add tests for worker error code 22871/head
Yu Watanabe [Tue, 29 Mar 2022 05:58:58 +0000 (14:58 +0900)] 
test: add tests for worker error code

3 years agoudev: append error code in broadcasted message
Yu Watanabe [Fri, 25 Mar 2022 17:01:42 +0000 (02:01 +0900)] 
udev: append error code in broadcasted message

So, libudev listners can easily detect errors.

Addresses https://github.com/systemd/systemd/pull/22717#discussion_r834420878.

3 years agosd-device: introduce device_add_propertyf()
Yu Watanabe [Fri, 25 Mar 2022 17:00:02 +0000 (02:00 +0900)] 
sd-device: introduce device_add_propertyf()

3 years agoNEWS: mention kernel requirement change 3.13 -> 3.15
Luca Boccassi [Tue, 29 Mar 2022 16:22:08 +0000 (17:22 +0100)] 
NEWS: mention kernel requirement change 3.13 -> 3.15

3 years agoMerge pull request #22894 from keszybz/hwdb-update
Zbigniew Jędrzejewski-Szmek [Tue, 29 Mar 2022 16:17:32 +0000 (18:17 +0200)] 
Merge pull request #22894 from keszybz/hwdb-update

Update hwdb again

3 years agohwdb: update autosuspend entries 22894/head
Zbigniew Jędrzejewski-Szmek [Tue, 29 Mar 2022 10:22:21 +0000 (12:22 +0200)] 
hwdb: update autosuspend entries

3 years agohwdb: update for v251
Zbigniew Jędrzejewski-Szmek [Thu, 9 Dec 2021 10:05:15 +0000 (11:05 +0100)] 
hwdb: update for v251

As usual, there are mostly additions of new entries, and some spelling
correction and company renames, no big removals.

3 years agohwdb: fix parser to work with newer pyparsing
Zbigniew Jędrzejewski-Szmek [Tue, 29 Mar 2022 10:17:51 +0000 (12:17 +0200)] 
hwdb: fix parser to work with newer pyparsing

The handling of whitespace in pyparsing is a bother. There's some
global state, and per-element state, and it's hard to get a handle on
things. With python3-pyparsing-2.4.7-10.fc36.noarch the grammar would
not match. After handling of tabs was fixed to not accept duplicate tabs,
the grammar passes.

It seems that the entry for usb:v8087p8087*
was generated incorrectly because we treated the interface line
(with two TABs) as a device line (with one TAB).

3 years agocryptsetup: shorten message a bit
Zbigniew Jędrzejewski-Szmek [Fri, 25 Mar 2022 09:54:39 +0000 (10:54 +0100)] 
cryptsetup: shorten message a bit

If it is reported as missing, we don't need to say that we assume
it is missing.

3 years agoMerge pull request #22843 from poettering/bootspec-json
Zbigniew Jędrzejewski-Szmek [Tue, 29 Mar 2022 16:11:32 +0000 (18:11 +0200)] 
Merge pull request #22843 from poettering/bootspec-json

bootctl: bootspec improvements and clean-ups

3 years agoportable: allow reattaching when one image has a version and the other does not
Luca Boccassi [Wed, 23 Mar 2022 21:29:04 +0000 (21:29 +0000)] 
portable: allow reattaching when one image has a version and the other does not

A reattach might go from img.raw to img_0.1.raw or viceversa, but this is
not allowed right now as we try to match the full name.

Also take into account that running strcspn(a, '/') on an image name, without
leading path, will return the length of the full string, but the versions
might be different so they won't match, eg:

img_0.1.raw -> 12
img_0.1.1.raw -> 14

So adjust the check to take that into account, and skip it if we are not
dealing with directories

3 years agohwdb: Add mic mute key mapping for HP Elite x360
Andy Chi [Tue, 29 Mar 2022 07:36:13 +0000 (15:36 +0800)] 
hwdb: Add mic mute key mapping for HP Elite x360

On the new Elite x360 2 in 1 HP laptops, the microphone mute hotkey is "Fn+F8" and
the scancode for this hotkey is 0x81, but this scancode was mapped to
fn_esc in the HP generic keymap section. To fix this problem, we add
a machine specific keymap section to add the correct keymap rule.

3 years agoudev: do not call sd_event_source_disable_unref() in workers for event sources create...
Yu Watanabe [Tue, 29 Mar 2022 03:14:40 +0000 (12:14 +0900)] 
udev: do not call sd_event_source_disable_unref() in workers for event sources created by the main process

Fixes a bug introduced by 9612da361a825d70a9fd392f3ee5a53bf8896887.

3 years agoinotify-util: fix wrong warnings in FOREACH_INOTIFY_EVENT()
Yu Watanabe [Fri, 25 Mar 2022 06:34:29 +0000 (15:34 +0900)] 
inotify-util: fix wrong warnings in FOREACH_INOTIFY_EVENT()

Follow-up for 00adc340bb15bc9d634db6caa48f1c964b99f79a.

This fixes the wrong "Received invalid inotify event, ignoring." warnings
caused by the missing curly brackets and the priorities of `&&` and `?:`.

This also replaces the ternary operators with `||`.

3 years agobuild: include status of TPM2 in the feature string show by --version
Franck Bui [Mon, 28 Mar 2022 12:59:59 +0000 (14:59 +0200)] 
build: include status of TPM2 in the feature string show by --version

3 years agoMerge pull request #22885 from poettering/kill-clock-boottime-or-monotonic
Yu Watanabe [Mon, 28 Mar 2022 18:06:54 +0000 (03:06 +0900)] 
Merge pull request #22885 from poettering/kill-clock-boottime-or-monotonic

time-util: assume CLOCK_BOOTTIME always exists

3 years agoveritysetup: fix typo (#22886)
Gaël PORTAY [Mon, 28 Mar 2022 17:09:36 +0000 (13:09 -0400)] 
veritysetup: fix typo (#22886)

3 years agofix typo
Yu Watanabe [Mon, 28 Mar 2022 16:21:51 +0000 (01:21 +0900)] 
fix typo

3 years agoUpdate NEWS
Yu Watanabe [Mon, 28 Mar 2022 16:19:13 +0000 (01:19 +0900)] 
Update NEWS

- categorize entries
- add several news for networkd and udevd

3 years agotime-util: assume CLOCK_BOOTTIME always exists 22885/head
Lennart Poettering [Mon, 28 Mar 2022 14:41:10 +0000 (16:41 +0200)] 
time-util: assume CLOCK_BOOTTIME always exists

Let's raise our supported baseline a bit: CLOCK_BOOTTIME started to work
with timerfd in kernel 3.15 (i.e. back in 2014), let's require support
for it now.

This will raise our baseline only modestly from 3.13 → 3.15.

3 years agonetwork: rename netdev kind virtual-wlan -> wlan
Yu Watanabe [Mon, 28 Mar 2022 07:23:19 +0000 (16:23 +0900)] 
network: rename netdev kind virtual-wlan -> wlan

The Kind= setting in [Match] section of .network files takes "wlan".
This makes the same setting in .netdev files matches the one in .network
files.

3 years agobootspec: normalize function names/parameter lists 22843/head
Lennart Poettering [Thu, 24 Mar 2022 16:15:50 +0000 (17:15 +0100)] 
bootspec: normalize function names/parameter lists

This normalizes naming of functions operating on BootConfig objects.
Let's always call them boot_config_xyz(), like our usual way to name
stuff.

moreover, move the BootConfig parameter to the beginning, as it's not a
return value (which we typically move to the end of the parameter list),
but simply an object, that even happens to be initialized already.

With these changes the functions are more like our usual way to call
things, and less surprises are good.

3 years agobootspec: don't needlessly inline boot_config_find_entry()
Lennart Poettering [Thu, 24 Mar 2022 16:08:09 +0000 (17:08 +0100)] 
bootspec: don't needlessly inline boot_config_find_entry()

the function contains a loop and if expressions and whatnot. Let's
define it as regular function, to make the header easier to read and let
the compiler more freedom on whether to inline this or not.

3 years agobootctl: use boot_config_default_entry() where appropriate
Lennart Poettering [Thu, 24 Mar 2022 16:06:16 +0000 (17:06 +0100)] 
bootctl: use boot_config_default_entry() where appropriate

3 years agobootspec: assess default/selected entries *after* we augmented entry list with entrie...
Lennart Poettering [Wed, 23 Mar 2022 16:28:44 +0000 (17:28 +0100)] 
bootspec: assess default/selected entries *after* we augmented entry list with entries from loader

Fixes: #22580
3 years agobootspec: normalize oom handling in boot_load_efi_entry_pointers()
Lennart Poettering [Wed, 23 Mar 2022 16:15:23 +0000 (17:15 +0100)] 
bootspec: normalize oom handling in boot_load_efi_entry_pointers()

OOM should usually be fatal, hence make it so here, too.

3 years agobootspec: rename type1 parsers to say "type1" explicitly in the name
Lennart Poettering [Wed, 23 Mar 2022 16:06:50 +0000 (17:06 +0100)] 
bootspec: rename type1 parsers to say "type1" explicitly in the name

This just got too confusing for me. With this change we'll now have
_unified as common suffix for stuff loading unified kernels (i.e. type
1), and _type1 as common suffix for type1 entries.

Just some renaming.

3 years agobootspec: try harder to suppress duplicate enumerated entries
Lennart Poettering [Wed, 23 Mar 2022 16:00:24 +0000 (17:00 +0100)] 
bootspec: try harder to suppress duplicate enumerated entries

For testing purposes I run one of my system symlinking /boot/loader/ to
/efi/loader/. This triggers annoying behaviour in boot entry
enumeration: the code ends up iterating through the 'entries' subdir of
both, thinking one was actually in the ESP and the other in XBOOTLDR,
and thus distinct. This would result in duplicate entries.

Let's address that, and filter out duplicates via their inode numbers:
never process the same inode twice. This should protect us from any
confusion effectively, regardless which inodes are symlinked (or even
bind mounted).

3 years agobootspec: pass around BootConfig struct instead of entries/n_entries fields only
Lennart Poettering [Wed, 23 Mar 2022 15:19:07 +0000 (16:19 +0100)] 
bootspec: pass around BootConfig struct instead of entries/n_entries fields only

This simplifies the parameter lists quite a bit, at zero change in
behaviour.

3 years agobootspec: don't use conf_files_list() for finding type #1 entries
Lennart Poettering [Wed, 23 Mar 2022 15:09:08 +0000 (16:09 +0100)] 
bootspec: don't use conf_files_list() for finding type #1 entries

We can't really use conf_files_list() for finding type #1 entries, since
it is case-sensitive, but type #1 entries are typically placed on VFAT,
i.e. are case-insensitive.

hence, use readdir_all() instead, which is quite similar, but gives us
all files, and allows us to do a case-insensitive check.

While we are at it, use openat() on the open dir to open the file, and
pass that around, to make things a tiny bit more race-free.

3 years agobootctl: optionally, output entries in JSON format
Lennart Poettering [Wed, 23 Mar 2022 15:08:36 +0000 (16:08 +0100)] 
bootctl: optionally, output entries in JSON format

Replaces: #18387
Fixes: #18094
3 years agoUse new default-user-shell option instead of hard-coding bash in nspawn and user...
наб [Thu, 24 Mar 2022 16:15:39 +0000 (17:15 +0100)] 
Use new default-user-shell option instead of hard-coding bash in nspawn and user-record

Defaults to /bin/bash, no changes in the default configuration

The fallback shell for non-root users is as-specified,
and the interactive shell for nspawn sessions is started as
  exec(default-user-shell, "-" + basename(default-user-shell), ...)
before falling through to bash and sh

3 years agodocs: use native type instead of byte stream in COREDUMP_PACKAGE_METADATA
Luca Boccassi [Mon, 28 Mar 2022 10:33:37 +0000 (11:33 +0100)] 
docs: use native type instead of byte stream in COREDUMP_PACKAGE_METADATA

The first three fields of a note are binary, so they are subject to
flipping due to endianess. Instead of a stream of bytes, just use
the native 4-bytes type so that it gets encoded automatically.

Implemented in the tools via: https://github.com/systemd/package-notes/pull/31

3 years agomissing-syscall: define MOVE_MOUNT_T_EMPTY_PATH if missing
Romain Naour [Fri, 7 Jan 2022 21:25:23 +0000 (22:25 +0100)] 
missing-syscall: define MOVE_MOUNT_T_EMPTY_PATH if missing

MOVE_MOUNT_T_EMPTY_PATH has been added to systemd 250 by [1]
but it's defined in kernel headers since version 5.2.

[1] c7bf079bbc19e3b409acc0c7acc3e14749211fe2

3 years agoMerge pull request #22834 from yuwata/network-sriov-request-queue
Luca Boccassi [Sat, 26 Mar 2022 19:12:42 +0000 (19:12 +0000)] 
Merge pull request #22834 from yuwata/network-sriov-request-queue

network: sriov: use request queue

3 years agoportable: clarify error when detach fails to match to existing unit
Luca Boccassi [Thu, 24 Mar 2022 14:47:00 +0000 (14:47 +0000)] 
portable: clarify error when detach fails to match to existing unit

Clarify that it's looking at attached units, not at units inside the referenced
image. Also take into account extensions.

3 years agoNEWS: tweaks
Zbigniew Jędrzejewski-Szmek [Fri, 25 Mar 2022 13:00:41 +0000 (14:00 +0100)] 
NEWS: tweaks

3 years agobasic: update the Arch tuples for LoongArch
Xiaotian Wu [Tue, 8 Mar 2022 03:15:25 +0000 (11:15 +0800)] 
basic: update the Arch tuples for LoongArch

3 years agoMerge pull request #22861 from poettering/journald-sigterm
Yu Watanabe [Fri, 25 Mar 2022 15:27:47 +0000 (00:27 +0900)] 
Merge pull request #22861 from poettering/journald-sigterm

journald: don't let SIGTERM starve indefinitely

3 years agoMerge pull request #22857 from poettering/journal-file-flags
Daan De Meyer [Fri, 25 Mar 2022 09:16:12 +0000 (10:16 +0100)] 
Merge pull request #22857 from poettering/journal-file-flags

journal: add flags param to journal_file_open(), replacing bools

3 years agojournal-file: if we are going down, don't use event loop to schedule post 22861/head
Lennart Poettering [Thu, 24 Mar 2022 20:24:23 +0000 (21:24 +0100)] 
journal-file: if we are going down, don't use event loop to schedule post

The event loop is already shutting down, hence no point in using it
anymore, it's not going to run any further iteration.

3 years agojournald: make sure SIGTERM handling doesn't get starved out
Lennart Poettering [Thu, 24 Mar 2022 19:37:43 +0000 (20:37 +0100)] 
journald: make sure SIGTERM handling doesn't get starved out

Fixes: #22642
3 years agojournal: don't talk about -1 in context of unsigned values 22857/head
Lennart Poettering [Thu, 24 Mar 2022 13:05:45 +0000 (14:05 +0100)] 
journal: don't talk about -1 in context of unsigned values

3 years agojournal-file: merge compress/seal bool args into a single flags param
Lennart Poettering [Thu, 24 Mar 2022 13:04:40 +0000 (14:04 +0100)] 
journal-file: merge compress/seal bool args into a single flags param

Just some modernization/refactoring.

No change in behaviour, just let's do how we do things these days: use
flags param instead of list of bools.

3 years agoMerge pull request #22717 from yuwata/udev-lock-block-device-by-main-process
Lennart Poettering [Fri, 25 Mar 2022 08:43:12 +0000 (09:43 +0100)] 
Merge pull request #22717 from yuwata/udev-lock-block-device-by-main-process

udev: do not skip events when device is already locked

3 years agojournal-remote: constify a few parameters
Lennart Poettering [Thu, 24 Mar 2022 10:20:12 +0000 (11:20 +0100)] 
journal-remote: constify a few parameters

3 years agoMerge pull request #22859 from poettering/hardware-rename
Lennart Poettering [Fri, 25 Mar 2022 08:12:14 +0000 (09:12 +0100)] 
Merge pull request #22859 from poettering/hardware-rename

machine-info: rename VENDOR=/MODEL= → HARDWARE_VENDOR=/HARDWARE_MODEL=

3 years agoxdg-autostart-service: Fix binary escaping and simplify code a bit
Benjamin Berg [Thu, 24 Mar 2022 12:00:59 +0000 (13:00 +0100)] 
xdg-autostart-service: Fix binary escaping and simplify code a bit

Instead of escaping each component separately, we can instead use
quote_command_line. Doing so simplifies the code and fixes an issue
where spaces inside the executable name were not escaped.

Co-Authored-By: David Edmundson <kde@davidedmundson.co.uk>
3 years agoefi-loader: drop harmful assertion
Yu Watanabe [Fri, 25 Mar 2022 05:29:41 +0000 (14:29 +0900)] 
efi-loader: drop harmful assertion

This fixes a bug introduced by 7be4b23649c02df33e4292f37ffc8aecf512955a.

The function `efi_loader_get_device_part_uuid()` handles NULL
gracefully, and it is called with NULL in gpt-auto-generator.

Fixes #22862.

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 agohostnamed: properly reset hw model/vendor props before re-reading them 22859/head
Lennart Poettering [Thu, 24 Mar 2022 16:50:53 +0000 (17:50 +0100)] 
hostnamed: properly reset hw model/vendor props before re-reading them

Follow-up for 4fc7e4f374bf4401330e90e267227267abf1dcac

3 years agomachine-info: rename VENDOR=/MODEL= → HARDWARE_VENDOR=/HARDWARE_MODEL=
Lennart Poettering [Thu, 24 Mar 2022 16:48:11 +0000 (17:48 +0100)] 
machine-info: rename VENDOR=/MODEL= → HARDWARE_VENDOR=/HARDWARE_MODEL=

Let's be more precise here. Otherwise people might think this describes
the software system or so. We already expose this via hostnamed as
HardwareVendor/HardwareModel hence use the exact same wording.

(Note that the relevant props on the dmi device are just VENDOR/MODEL,
but that's OK given that DMI really is about hardware anyway,
unconditionally, hence no chance of confusion there.)

Follow-up for 4fc7e4f374bf4401330e90e267227267abf1dcac

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