]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
5 months agosystemct: show all in output of systemctl clean --what=help 37418/head
Jörg Behrmann [Tue, 13 May 2025 15:21:02 +0000 (17:21 +0200)] 
systemct: show all in output of systemctl clean --what=help

5 months agoman: note for systemctl clean --what that commas separate values
Jörg Behrmann [Tue, 13 May 2025 15:20:37 +0000 (17:20 +0200)] 
man: note for systemctl clean --what that commas separate values

5 months agoman, systemctl: document --what=help
Jörg Behrmann [Tue, 13 May 2025 15:19:39 +0000 (17:19 +0200)] 
man, systemctl: document --what=help

5 months agoman: add missing fdstore in systemctl clean --what documentation
Jörg Behrmann [Tue, 13 May 2025 15:19:02 +0000 (17:19 +0200)] 
man: add missing fdstore in systemctl clean --what documentation

5 months agohwdb: add bladeRF SDR devices (#37413)
Yu Watanabe [Tue, 13 May 2025 14:44:29 +0000 (23:44 +0900)] 
hwdb: add bladeRF SDR devices (#37413)

5 months agohwdb: append ID_SOFTWARE_RADIO to hwdb parser 37413/head
Ryan Thompson [Tue, 13 May 2025 00:37:16 +0000 (19:37 -0500)] 
hwdb: append ID_SOFTWARE_RADIO to hwdb parser

5 months agohwdb: add bladeRF SDR devices
Ryan Thompson [Mon, 12 May 2025 23:05:20 +0000 (18:05 -0500)] 
hwdb: add bladeRF SDR devices

Add hwdb entries for bladeRF 1.x, legacy 1.x, and 2.0 micro devices to
enable non-root access through preexisting ID_SOFTWARE_RADIO tag.

References #20561

5 months agomeson: Add missing conditions
Daan De Meyer [Tue, 13 May 2025 11:47:13 +0000 (13:47 +0200)] 
meson: Add missing conditions

Follow up for 6350d2dbd97746440b9c8303ddc140ffda568732

5 months agocore: introduce io.systemd.Manager.Describe method (#35098)
Daan De Meyer [Tue, 13 May 2025 09:57:58 +0000 (11:57 +0200)] 
core: introduce io.systemd.Manager.Describe method (#35098)

Let's extend pid1's varlink interface and add a Describe method to get
the global Manager object information as a JSON object
(io.systemd.Manager.Describe).

Because the new varlink interface should be available on both the user
managers and the system manager, we also make the necessary changes to
expose a varlink server on user managers.

This PR is first part of https://github.com/systemd/systemd/pull/33965
with minimal changes to address feedback.

Fixes: #22654
5 months agosd-boot: add support for a sysfail entry (#34856)
Lennart Poettering [Tue, 13 May 2025 09:23:26 +0000 (11:23 +0200)] 
sd-boot: add support for a sysfail entry (#34856)

Add support for a sysfail boot entry. Sysfail boot entries can be used
for optional tweaking the automatic selection order in case a failure
state of the system in some form is detected (boot firmware failure
etc).

The EFI variable `LoaderEntrySysFail` contains the sysfail boot loader
entry to use. It can be set using bootctl:
```
$ bootctl set-sysfail sysfail.conf
```

The `LoaderEntrySysFail` EFI variable would be unset automatically
during next boot by `systemd-boot-clear-sysfail.service` if no system
failure occured, otherwise it would be kept as it is and a system
failure reason will be saved to `LoaderSysFailReason` EFI variable.

`sysfail_check()` expected to be extented to support possibleconditions
when we should boot sysfail("recovery") boot entry.

Also add support for using a sysfail boot entry in case of UEFI firmware
capsule update failure [1]. The status of a firmware update is obtained
from the EFI System Resource Table (ESRT), which provides an optional
mechanism for identifying device and system firmware resources for the
purposes of targeting firmware updates to those resources.

Current implementation uses the value of LastAttemptStatus field from
ESRT, which describes the result of the last firmware update attempt for
the firmware resource entry. The field is updated each time an
`UpdateCapsule()` is attempted for an ESRT entry and is preserved across
reboots (non-volatile).

This can be be used in setups with support for A/B OTA updates, where
the boot firmware and Linux/RootFS might be updated synchronously.

The check is activated by adding "sysfail-firmware-upd" to loader.conf

[1]
https://uefi.org/specs/UEFI/2.10/23_Firmware_Update_and_Reporting.html

5 months agotests: tests for io.systemd.manager.Describe 35098/head
Ivan Kruglov [Thu, 6 Mar 2025 16:38:37 +0000 (08:38 -0800)] 
tests: tests for io.systemd.manager.Describe

5 months agocore: introduce io.systemd.Manager.Describe method
Ivan Kruglov [Thu, 6 Mar 2025 16:40:49 +0000 (08:40 -0800)] 
core: introduce io.systemd.Manager.Describe method

Let's extend pid1's varlink interface and add a Describe method to
get the global Manager object information as a JSON object
(io.systemd.Manager.Describe).

Because the new varlink interface should be available on both the
user managers and the system manager, we also make the necessary
changes to expose a varlink server on user managers.

5 months agoshared: watchdog_get_last_ping_as_dual_timestamp()
Ivan Kruglov [Fri, 7 Mar 2025 09:04:14 +0000 (01:04 -0800)] 
shared: watchdog_get_last_ping_as_dual_timestamp()

5 months agoshared: varlink_server_contains_socket()
Ivan Kruglov [Mon, 12 May 2025 11:18:00 +0000 (04:18 -0700)] 
shared: varlink_server_contains_socket()

5 months agosocket-util: socket_address_equal_unix()
Ivan Kruglov [Mon, 12 May 2025 11:17:38 +0000 (04:17 -0700)] 
socket-util: socket_address_equal_unix()

5 months agocore: common rlimits code and structures
Ivan Kruglov [Thu, 6 Mar 2025 16:37:10 +0000 (08:37 -0800)] 
core: common rlimits code and structures

5 months agolog: log_get_target_max_level()
Ivan Kruglov [Tue, 12 Nov 2024 12:46:20 +0000 (13:46 +0100)] 
log: log_get_target_max_level()

5 months agomeson: introduce PROJECT_VERSION_STR and use it in udev
Ivan Kruglov [Tue, 12 Nov 2024 12:53:13 +0000 (13:53 +0100)] 
meson: introduce PROJECT_VERSION_STR and use it in udev

5 months agoshell-completion: fix completion of `systemctl --user unset-environment` (#37409)
Eisuke Kawashima [Tue, 13 May 2025 00:04:52 +0000 (09:04 +0900)] 
shell-completion: fix completion of `systemctl --user unset-environment` (#37409)

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
5 months agoAdd dns0.eu in resolved.conf.in (#37404)
André Monteiro [Mon, 12 May 2025 23:36:22 +0000 (00:36 +0100)] 
Add dns0.eu in resolved.conf.in (#37404)

Add dns0.eu as a dns option in resolved.conf.in
This also adds Quad9 DNS servers as the default fallback servers.

5 months agorun0: drop -a short switch for --area=
Mike Yuan [Mon, 12 May 2025 19:47:01 +0000 (21:47 +0200)] 
run0: drop -a short switch for --area=

Follow-up for f44e7a8c11833563d558c208c76cdcc0df7de022

This breaks the rule stated at the beginning of help_sudo_mode():

> NB: Let's not go overboard with short options: we try to keep a modicum of compatibility with
> sudo's short switches, hence please do not introduce new short switches unless they have a roughly
> equivalent purpose on sudo. Use long options for everything private to run0.

5 months agocore: assorted cleanups (#37410)
Yu Watanabe [Mon, 12 May 2025 23:32:20 +0000 (08:32 +0900)] 
core: assorted cleanups (#37410)

5 months agocore/dbus-unit: remove unneeded else if 37410/head
Mike Yuan [Thu, 17 Apr 2025 15:33:50 +0000 (17:33 +0200)] 
core/dbus-unit: remove unneeded else if

5 months agocore/dbus-execute: always normalize argv[0] to "sh" on EXEC_COMMAND_VIA_SHELL
Mike Yuan [Mon, 12 May 2025 15:07:47 +0000 (17:07 +0200)] 
core/dbus-execute: always normalize argv[0] to "sh" on EXEC_COMMAND_VIA_SHELL

Addresses https://github.com/systemd/systemd/pull/37071#discussion_r2084851759

5 months agocore/slice: remove redundant assertion
Mike Yuan [Tue, 22 Apr 2025 19:01:41 +0000 (21:01 +0200)] 
core/slice: remove redundant assertion

5 months agolog: fix declaration of log_dispatch_internal()
Antonio Alvarez Feijoo [Mon, 12 May 2025 13:26:32 +0000 (15:26 +0200)] 
log: fix declaration of log_dispatch_internal()

5 months agocore: accept "|" ExecStart= prefix to spawn target user's shell; teach run0 about...
Mike Yuan [Mon, 12 May 2025 14:10:03 +0000 (16:10 +0200)] 
core: accept "|" ExecStart= prefix to spawn target user's shell; teach run0 about the new logic (#37071)

I've always been reluctant to invoke the current user's shell in another
user's context, hence was fully grounded in `sudo -i`. With this bit in
place `run0` will finally be feature-complete on my side ;-)

5 months agomeson: Various improvements (#37395)
Yu Watanabe [Mon, 12 May 2025 14:06:57 +0000 (23:06 +0900)] 
meson: Various improvements (#37395)

5 months agocore/namespace: fix issue in PrivateTmp=disconnected vs var.mount (#37271)
Yu Watanabe [Mon, 12 May 2025 14:05:24 +0000 (23:05 +0900)] 
core/namespace: fix issue in PrivateTmp=disconnected vs var.mount (#37271)

Fixes #37258.
Replaces #37259.

5 months agoudev: sort received events by their seqnum (#37314)
Yu Watanabe [Mon, 12 May 2025 14:04:49 +0000 (23:04 +0900)] 
udev: sort received events by their seqnum (#37314)

The kernel sometimes sends uevents in a random order, so previously the
received events were not sorted by their seqnum. We determine which
event is ready for processing by using the assumption that queued events
are sorted by their seqnum. Let's sort the received events before queue
them, to make events processed in a correct ordering.

5 months agosd-boot: use sysfail entry for UEFI firmware update failure 34856/head
Igor Opaniuk [Thu, 23 Jan 2025 12:31:04 +0000 (13:31 +0100)] 
sd-boot: use sysfail entry for UEFI firmware update failure

Add support for using a sysfail boot entry in case of UEFI firmware
capsule update failure [1]. The status of a firmware update is obtained from
the EFI System Resource Table (ESRT), which provides an optional mechanism
for identifying device and system firmware resources for the purposes of
targeting firmware updates to those resources.

Current implementation uses the value of LastAttemptStatus field from
ESRT, which describes the result of the last firmware update attempt for
the firmware resource entry. The field is updated each time an
UpdateCapsule() is attempted for an ESRT entry and is preserved across
reboots (non-volatile).

This can be be used in setups with support for A/B OTA updates, where
the boot firmware and Linux/RootFS might be updated synchronously.

[1] https://uefi.org/specs/UEFI/2.10/23_Firmware_Update_and_Reporting.html
Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
5 months agobootctl: configure a sysfail entry
Igor Opaniuk [Mon, 24 Mar 2025 14:33:16 +0000 (15:33 +0100)] 
bootctl: configure a sysfail entry

You can configure the sysfail boot entry using the bootctl command:
$ bootctl set-sysfail sysfail.conf

The value will be stored in the `LoaderEntrySysFail` EFI variable.

The `LoaderEntrySysFail` EFI variable would be unset automatically
during next boot by `systemd-boot-clear-sysfail.service` if no
system failure occured, otherwise it would be kept as it is and a system
failure reason will be saved to `LoaderSysFailReason` EFI variable.

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
5 months agosd-boot: add support for a sysfail entry
Igor Opaniuk [Mon, 24 Mar 2025 14:30:49 +0000 (15:30 +0100)] 
sd-boot: add support for a sysfail entry

Add support for a sysfail boot entry. Sysfail boot entries can be
used for optional tweaking the automatic selection order in case a
failure state of the system in some form is detected (boot firmware
failure etc).

The EFI variable `LoaderEntrySysFail` holds the boot loader entry to
be used in the event of a system failure. If a failure occurs, the reason
will be stored in the `LoaderSysFailReason` EFI variable.

sysfail_check() expected to be extented to support possible
conditions when we should boot sysfail("recovery") boot entry.

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
5 months agobless-boot: some fixes (#37375)
Lennart Poettering [Mon, 12 May 2025 13:11:06 +0000 (15:11 +0200)] 
bless-boot: some fixes (#37375)

This mostly makes sure we do something reasonable when our tool is
called from a boot of an entry that was already marked as definitely
"bad" on a previous boot. Such an entry we can return into a "good"
state, but we cannot return it into an "indeterminate" state, because
the status quo ante is already known.

Fixes: #37350
5 months agomeson: Don't create static library target unless option is enabled 37395/head
Daan De Meyer [Sat, 10 May 2025 20:19:22 +0000 (22:19 +0200)] 
meson: Don't create static library target unless option is enabled

While we don't build these by default, all the source files still
get added to the compile_commands.json file by meson, which can confuse
tools as they might end up analyzing the source files twice or analyzing
the wrong one.

To avoid this issue, only define the static library target if the
corresponding option is enabled.

5 months agomeson: Remove unneeded include directories
Daan De Meyer [Fri, 9 May 2025 18:48:51 +0000 (20:48 +0200)] 
meson: Remove unneeded include directories

meson by default adds the current source and build directory as include
directories. Because we structure our meson code by gathering a giant dict
of everything we want to do and then doing all the actual target generation
in the top level meson.build, this behavior does not make sense at all because
we end up adding the top level repository directory as an include directory
which is never what we want.

At the same time, let's also make sure the top level directory of the build
directory is not an include directory, by moving the version.h generation
into the src/version subdirectory and then adding the src/version subdirectory
of the build directory as an include directory instead of the top level
repository directory.

Making this change means that language servers such as clangd can't get
confused when they automatically insert an #include line and insert
"#include "src/basic/fs-util.h" instead of "#include "fs-util.h".

5 months agomeson: Extract objects instead of creating intermediate static libraries
Daan De Meyer [Wed, 7 May 2025 20:55:15 +0000 (22:55 +0200)] 
meson: Extract objects instead of creating intermediate static libraries

Currently, when we want to add unit tests for code that is compiled into
an executable, we either compile the code at least twice (once for the
executable, and once for each test that uses it) or we create a static
library which is then used by both the executable and all the tests.

Both of these options are not ideal, compiling source files more than
once slows down the build for no reason and creating the intermediate
static libraries takes a lot of boilerplate.

Instead, let's use the extract_objects() method that meson exposes on
build targets. This allows us to extract the objects corresponding to
specific source files and use them in other executables. Because we
define all executables upfront into a dictionary, we integrate this into
the dictionary approach by adding two new fields:

- 'extract' takes a list of files for which objects should be extracted.
  The extracted objects are stored in a dict keyed by the executable name
  from which they were extracted.
- 'objects' takes the name of an executable from which the extracted
  objects should be added to the current executable.

One side effect of this approach is that we can't build test executables
anymore without building the main executable, so we stop building test
executables unless we're also building the main executable. This allows
us to switch to using subdir_done() in all of these subdirectories to skip
parsing them if the corresponding component is disabled.

These changes get me down from 2439 => 2403 ninja targets on a full rebuild
from scratch.

5 months agomeson: Stop doing nested build when fuzzers are enabled
Daan De Meyer [Sun, 11 May 2025 07:42:28 +0000 (09:42 +0200)] 
meson: Stop doing nested build when fuzzers are enabled

Currently, when fuzzers are enabled, we run meson from within meson
to build the fuzzer executables with sanitizers. The idea is that
we can build the fuzzers with different kinds of sanitizers
independently from the main build.

The issue with this setup is that we don't actually make use of it.
We only build the fuzzers with one set of sanitizers (address,undefined)
so we're adding a bunch of extra complexity without any benefit as we
can just setup the top level meson build with these sanitizers and get
the same result.

The other issue with this setup is that we don't pass on all the options
passed to the top level meson build to the nested meson build. The only things
we pass on are extra compiler arguments and the value of the auto_features
option, but none of the individual feature options if overridden are passed on,
which can lead to very hard to debug issues as an option enabled in the top
level build is not enabled in the nested build.

Since we're not getting anything useful out of this setup, let's simplify
and get rid of the nested meson build. Instead, sanitizers should be enabled
for the top level meson.build. This currently didn't work as we were overriding
the sanitizers passed to the meson build with the fuzzer sanitizer, so we
fix that as well by making sure we combine the fuzzer sanitizer with the ones
passed in by the user.

We also drop support for looking up libFuzzer as a separate library as
it has been shipped builtin in clang since clang 6.0, so we can assume
that -fsanitize=fuzzer is available.

To make sure we still run the fuzzing tests, we enable the fuzz-tests option
by default now to make sure they still always run (without instrumentation unless
one of llvm-fuzz or oss-fuzz is enabled).

5 months agobless-boot: never try to rename an entry file onto itself 37375/head
Lennart Poettering [Wed, 7 May 2025 13:34:51 +0000 (15:34 +0200)] 
bless-boot: never try to rename an entry file onto itself

If we are booting a known bad entry, and we are asked to mark it as bad,
we so far would end up renaming the entry onto itself, which resulted in
EEXIST and is really borked operation. Let's catch that case and handle
it explicitly.

5 months agobless-boot: in "status" output report bad state from prev boot as "dirty"
Lennart Poettering [Wed, 7 May 2025 13:24:06 +0000 (15:24 +0200)] 
bless-boot: in "status" output report bad state from prev boot as "dirty"

The bless-boot logic currently assumes that if the name of the boot
entry reported via the EFI var matches the name on disk that the state
is "indeterminate", as we haven't counted down the counter (to mark it
bad) or drop the counter (to mark it good) yet. But there's one corner
case we so far didn't care about: what if the entry already reached 0
left tries in a previous boot, i.e. if the user invoked an entry already
known to be completely bad. In that case we'd still return
"indeterminate", but that's kinda misleading, because we *know* the
currently booted entry is bad, however we inherited that fact from a
previous boot, we didn't determine it on the current.

hence, let's introduce a new status we report in this case, that is both
distinct from "bad" (which indicates whether the *current* boot is bad)
and "indirect" (which indicates the current boot has not been decided on
yet): "dirty".

Why "dirty"? To mirror "clean" which we already have, which indicates a
boot already marked good in a previous boot, which is a relatively
symmetric state.

This is a really weak api break of sorts, because it introduces a new
state we never reported before, but I think it's fine, because the old
reporting was just wrong, and in a way this is bugfix, that we now
report correctly something where previously returned kind of rubbish
(though systematic rubbish).

Replaces:  #37350

5 months agobless-boot: switch from last_path_component() to path_find_last_component()
Lennart Poettering [Wed, 7 May 2025 13:23:00 +0000 (15:23 +0200)] 
bless-boot: switch from last_path_component() to path_find_last_component()

Using path_find_last_component() means special cases such as the root dir
and paths referencing dirs are detected and refused.

5 months agoREADME: mention explicitly that dmi-sysfs must be built-in, cannot be loaded as kmod
Lennart Poettering [Mon, 12 May 2025 08:38:15 +0000 (10:38 +0200)] 
README: mention explicitly that dmi-sysfs must be built-in, cannot be loaded as kmod

Fixes: #37391
5 months agopo: Translated using Weblate (Catalan)
naly zzwd [Sun, 11 May 2025 20:05:06 +0000 (20:05 +0000)] 
po: Translated using Weblate (Catalan)

Currently translated at 100.0% (257 of 257 strings)

po: Translated using Weblate (Catalan)

Currently translated at 79.7% (205 of 257 strings)

Co-authored-by: naly zzwd <xeanhort007@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ca/
Translation: systemd/main

5 months agoAdd netdev files associated with link to networkd JSON output (#37402)
Valentin Hăloiu [Sun, 11 May 2025 00:33:28 +0000 (01:33 +0100)] 
Add netdev files associated with link to networkd JSON output (#37402)

`networkctl status LINK` gained support for showing the netdev
configuration files associated with a link in
c9837c17d57d7e0fd9d3e2a4f2693f389ca76c24, but these netdev files were
never added to the JSON output too.

This pull-request fixes that by adding two new fields (`NetDevFile` and
`NetDevFileDropins`) to the `networkctl` (and `D-Bus`) JSON output.

5 months agoman/systemd.exec: update documents for PrivateTmp= 37271/head
Yu Watanabe [Tue, 29 Apr 2025 17:27:16 +0000 (02:27 +0900)] 
man/systemd.exec: update documents for PrivateTmp=

5 months agotest-execute: add test case for PrivateTmp=disconnected
Yu Watanabe [Mon, 28 Apr 2025 06:29:13 +0000 (15:29 +0900)] 
test-execute: add test case for PrivateTmp=disconnected

5 months agocore: disable mounting disconnected private tmpfs on /var/tmp/ when DefaultDependenci...
Yu Watanabe [Thu, 1 May 2025 11:58:18 +0000 (20:58 +0900)] 
core: disable mounting disconnected private tmpfs on /var/tmp/ when DefaultDependencies=no

If DefaultDependencies=no, /var/ may not be mounted yet when the service
is being started. Previously, In such case, if the service has
PrivateTmp=disconnected, the service manager created /var/tmp/ on the
root filesystem and mounted the disconnected private tmpfs there. That
poluted the root filesystem and disturbed gpt-auto-generator on next
boot, as /var/ would not be empty anymore. See issue #37258.

This changes PrivateTmp=disconnected as the following:
- If DefaultDependencies=no and RootDirectory=/RootImage= are not set,
  then a private tmpfs is mounted _only_ on /tmp/, and set $TMPDIR=/tmp
  environment variable to suggest the service to use /tmp/.
- If DefaultDependencies=yes and RootDirectory=/RootImage= are not set,
  then implies RequiresMountsFor=/var/, though that is typically
  redundant, but anyway. Hence, we can safely mount /var/tmp/.
- Otherwise, i.e. when one of RootDirectory=/RootImage= is set, behaves
  as the same as the previous, as the private root filesystem for the
  service is explicitly prepared by the service manager, and we can
  safely mount a private tmpfs on /var/tmp/ without any extra
  dependencies.

Fixes #37258.

Co-authored-by: Mike Yuan <me@yhndnzj.com>
5 months agocore/mount: drop unnecessary dependency generations
Yu Watanabe [Sat, 10 May 2025 18:22:04 +0000 (03:22 +0900)] 
core/mount: drop unnecessary dependency generations

When the unit is new, then mount_setup_new_unit() adds the unit to the
load queue, and the same dependencies will be anyway added.

When the unit already exists but previously failed to be loaded, then
mount_setup_existing_unit() also adds the unit to the load queue.
Hence it is not necessary to regenerate dependencies here now.

So, we need to regenerate dependencies only when things changed and
the unit has been already loaded.

No functional changes, just optimization.

5 months agocore/mount,swap: reload unit when manually mounted/started and we previously failed...
Yu Watanabe [Sat, 10 May 2025 07:11:37 +0000 (16:11 +0900)] 
core/mount,swap: reload unit when manually mounted/started and we previously failed to load

Otherwise, neither unit_patch_contexts() nor unit_add_exec_dependencies()
is called for the unit.

5 months agocore/namespace: split out append_private_tmp()
Yu Watanabe [Thu, 1 May 2025 11:06:48 +0000 (20:06 +0900)] 
core/namespace: split out append_private_tmp()

5 months agocore/namespace: introduce should_propagate_to_submounts() helper function
Yu Watanabe [Mon, 28 Apr 2025 05:45:04 +0000 (14:45 +0900)] 
core/namespace: introduce should_propagate_to_submounts() helper function

5 months agocore/unit: suffix directory paths with slash
Yu Watanabe [Thu, 1 May 2025 10:44:07 +0000 (19:44 +0900)] 
core/unit: suffix directory paths with slash

5 months agocore/unit: clean up duplicate conditions
Mike Yuan [Sat, 26 Apr 2025 14:09:48 +0000 (16:09 +0200)] 
core/unit: clean up duplicate conditions

5 months agotest: fix root check for test-bpf-foreign-programs
Luca Boccassi [Sat, 10 May 2025 11:31:19 +0000 (12:31 +0100)] 
test: fix root check for test-bpf-foreign-programs

This test requires root, but the check was mistakenly dropped, causing it
to fail with an assert when running without root:

src/test/test-bpf-foreign-programs.c:308: Assertion failed: expected "test_bpf_cgroup_programs(m, "single_prog.service", single_prog, ELEMENTSOF(single_prog))" to succeed, but got error: Operation not permitted

Restore the uid check

Follow-up for 22e2f0642897cfa7ba975527f5394bd7fcdf639b

5 months agomount-tool: honor arg_canonicalize for ACTION_UMOUNT path_is_absolute() check too...
Yu Watanabe [Fri, 9 May 2025 18:22:20 +0000 (03:22 +0900)] 
mount-tool: honor arg_canonicalize for ACTION_UMOUNT path_is_absolute() check too (#37398)

Split out from #36337

5 months agocore/bpf: drop old kernels support (#37151)
Yu Watanabe [Fri, 9 May 2025 18:13:42 +0000 (03:13 +0900)] 
core/bpf: drop old kernels support (#37151)

5 months agoudev: sort queued events by their seqnum 37314/head
Yu Watanabe [Sat, 26 Apr 2025 06:37:25 +0000 (15:37 +0900)] 
udev: sort queued events by their seqnum

Unfortunately, the kernel may send events in a random order:
```
[   25.769624] systemd-udevd[194]: sdi7: Device is queued (SEQNUM=2843, ACTION=add)
[   25.769893] systemd-udevd[194]: sda5: Device is queued (SEQNUM=2842, ACTION=add)
[   25.770517] systemd-udevd[194]: sdi8: Device is queued (SEQNUM=2844, ACTION=add)
```
As you can see, udevd receives the event with SEQNUM=2843 earlier than
one with SEQNUM=2842.

Let's make queued events sorted, as our logic of determining which event
is ready for being processed assumes that queued events are sorted.
See event_build_dependencies().

Also, refuse to queue an event if another event with the same seqnum is
already queued.

5 months agoudev: drop event_is_blocked()
Yu Watanabe [Tue, 6 May 2025 18:13:43 +0000 (03:13 +0900)] 
udev: drop event_is_blocked()

As now it is a trivial wrapper of event_build_dependencies().

5 months agoudev: refactoring for managing events for locked block devices
Yu Watanabe [Tue, 6 May 2025 16:09:09 +0000 (01:09 +0900)] 
udev: refactoring for managing events for locked block devices

Previously, when an event for block device is queued or an inotify event
for a block device is triggered, all queued events were checked by
event_queue_assume_block_device_unlocked(), and its cost may be huge
on early boot stage.

This makes locked events are managed in separated prioq and hashmap,
to reduce the cost of event_queue_assume_block_device_unlocked(),
which is now renamed to manager_requeue_locked_events_by_device().

This also changes the clockid of timer events for requeueing and
timeout of retry from CLOCK_BOOTTIME to CLOCK_MONOTONIC. Otherwise,
if the system suspend while an event is locked, the event may be
requeued immediately after come back from the suspend and timed out.

5 months agoudev: several cleanups for managing events (#37384)
Yu Watanabe [Fri, 9 May 2025 17:30:25 +0000 (02:30 +0900)] 
udev: several cleanups for managing events (#37384)

Mostly no functional changes, just refactoring.

5 months agomount-tool: honor arg_canonicalize for ACTION_UMOUNT path_is_absolute() check too 37398/head
Mike Yuan [Mon, 24 Feb 2025 17:32:58 +0000 (18:32 +0100)] 
mount-tool: honor arg_canonicalize for ACTION_UMOUNT path_is_absolute() check too

Follow-up for 4e24796b5a64064f8b21c07356eba19e9db4bb33

5 months agocore/mount: remove unused temporary variable
Mike Yuan [Sun, 6 Apr 2025 22:26:57 +0000 (00:26 +0200)] 
core/mount: remove unused temporary variable

5 months agoboot: skip shim-specific logic when running with new shim
Luca Boccassi [Wed, 7 May 2025 23:49:25 +0000 (00:49 +0100)] 
boot: skip shim-specific logic when running with new shim

Since shim 16 the plain BS->LoadImage() will just work (TM), we do not need
anymore to set up manual overrides and manually call in the shim-specific
lock protocol or to set shim-specific EFIVAR to make addons work or to load
shim-signed kernels.

Check if the new protocol added in v16 is present, and if so, skip
all that. Once versions < 16 are no longer supported/revoked, all
the code can be dropped entirely.

5 months agoudev: move error handling in event_requeue() to caller 37384/head
Yu Watanabe [Tue, 6 May 2025 17:46:11 +0000 (02:46 +0900)] 
udev: move error handling in event_requeue() to caller

Also, remove udev database on failure.

5 months agoudev: split out device_broadcast_on_error()
Yu Watanabe [Tue, 6 May 2025 17:32:56 +0000 (02:32 +0900)] 
udev: split out device_broadcast_on_error()

5 months agosd-device: rename arguments
Yu Watanabe [Tue, 6 May 2025 17:31:46 +0000 (02:31 +0900)] 
sd-device: rename arguments

To make it consistent with its declaration and other function
prototypes.

5 months agoudev: move timeout event sources from struct Event to struct Worker
Yu Watanabe [Tue, 6 May 2025 10:23:53 +0000 (19:23 +0900)] 
udev: move timeout event sources from struct Event to struct Worker

The timeout event sources are enabled only when the event is being
processed by a worker, hence they are not necessary to be owned by the
event.

No effective functional change, just refactoring.

5 months agoudev: list up all dependencies of an event when the first time it is examined
Yu Watanabe [Mon, 5 May 2025 17:25:32 +0000 (02:25 +0900)] 
udev: list up all dependencies of an event when the first time it is examined

No functional change, just refactoring.

5 months agoudev: check earlier if there is a free room for processing an event
Yu Watanabe [Mon, 5 May 2025 16:37:16 +0000 (01:37 +0900)] 
udev: check earlier if there is a free room for processing an event

5 months agoudev: cache last queued event entry
Yu Watanabe [Sat, 26 Apr 2025 06:09:12 +0000 (15:09 +0900)] 
udev: cache last queued event entry

When we have N queued events, LIST_APPEND() takes O(N).
Let's cache the last event to optimize queueing.

5 months agoudev: introduce event_freep() and use it as cleanup attribute
Yu Watanabe [Sat, 26 Apr 2025 06:37:11 +0000 (15:37 +0900)] 
udev: introduce event_freep() and use it as cleanup attribute

No functional change, just refactoring and preparation for later change.

5 months agoMore header cleanups (#37381)
Daan De Meyer [Fri, 9 May 2025 15:22:33 +0000 (17:22 +0200)] 
More header cleanups (#37381)

5 months agotest: allow to allocate test scope even running with unprivileged user 37151/head
Yu Watanabe [Wed, 16 Apr 2025 18:03:53 +0000 (03:03 +0900)] 
test: allow to allocate test scope even running with unprivileged user

5 months agocore/bpf-devices: use bpf_program_supported()
Yu Watanabe [Tue, 8 Apr 2025 08:26:58 +0000 (17:26 +0900)] 
core/bpf-devices: use bpf_program_supported()

Note, BPF_PROG_TYPE_CGROUP_DEVICE is supported since kernel v4.15.
As our baseline on the kernel is v5.4, we can assume the bpf type is
always supported.

5 months agocore/bpf-firewall: replace bpf_firewall_supported() with bpf_program_supported()
Yu Watanabe [Wed, 16 Apr 2025 17:39:08 +0000 (02:39 +0900)] 
core/bpf-firewall: replace bpf_firewall_supported() with bpf_program_supported()

Note, BPF_PROG_TYPE_CGROUP_SKB is supported since kernel v4.10, and
BPF_F_ALLOW_MULTI and program name is supported since kernel v4.15.
As our baseline on the kernel is v5.4, we can assume that the type,
flag, and naming is supported when bpf_program_supported() succeeds.

5 months agocore/cgroup: foreign bpf programs needs to pass bpf_program_supported()
Yu Watanabe [Wed, 16 Apr 2025 18:10:38 +0000 (03:10 +0900)] 
core/cgroup: foreign bpf programs needs to pass bpf_program_supported()

As CONFIG_CGROUP_BPF may be disabled on the kernel or we are running on
sanitizers. See comments in bpf_program_supported().

Follow-up for 3fcb98cbff0a5be8bf7c5deda6c1f7e8a31699bd.

5 months agobpf-program: introduce bpf_program_supported() helper function
Yu Watanabe [Wed, 16 Apr 2025 17:05:09 +0000 (02:05 +0900)] 
bpf-program: introduce bpf_program_supported() helper function

It checks if the kernel is built with CONFIG_CGROUP_BPF.
It is currently unused, but will be used later.

5 months agobpf-compat: drop unused compat_libbpf_probe_bpf_prog_type()
Yu Watanabe [Tue, 29 Apr 2025 20:20:06 +0000 (05:20 +0900)] 
bpf-compat: drop unused compat_libbpf_probe_bpf_prog_type()

5 months agocore/bpf: drop unnecessary check for probing program type
Yu Watanabe [Tue, 29 Apr 2025 20:13:26 +0000 (05:13 +0900)] 
core/bpf: drop unnecessary check for probing program type

BPF_PROG_TYPE_CGROUP_SKB is supported since kernel v4.10
(0e33661de493db325435d565a4a722120ae4cbf3) and
BPF_PROG_TYPE_CGROUP_SOCK_ADDR is supported since kernel v4.17
(4fbac77d2d092b475dda9eea66da674369665427).

Our baseline on the kernel is v5.4. The check is not necessary.

5 months agocore: replace cgroup_bpf_supported() with dlopen_bpf_full()
Yu Watanabe [Sun, 20 Apr 2025 03:14:23 +0000 (12:14 +0900)] 
core: replace cgroup_bpf_supported() with dlopen_bpf_full()

After 3988e2489aaf30034e09918890f688780c154af7, the function is a simple
wrapper of bpf_dlopen() with logging. Let's introduce dlopen_bpf_full()
that takes log level, and replace cgroup_bpf_supported() with it.

5 months agoudev: replace get_user/group_creds() with userdb/groupdb_by_name() (#37304)
Yu Watanabe [Fri, 9 May 2025 11:54:16 +0000 (20:54 +0900)] 
udev: replace get_user/group_creds() with userdb/groupdb_by_name() (#37304)

This also makes networkd not refuse User=/Group=root.

5 months agohwdb: keyboard: Add Alienware special keys
Kurt Borja [Thu, 8 May 2025 07:37:55 +0000 (04:37 -0300)] 
hwdb: keyboard: Add Alienware special keys

Add Alienware *Performance mode* toggle key and *Macro* keys.

Signed-off-by: Kurt Borja <kuurtb@gmail.com>
5 months agoAdd emulated release to G-Mode key
Marcos Alano [Thu, 8 May 2025 10:28:16 +0000 (07:28 -0300)] 
Add emulated release to G-Mode key

6 months agostrv: Move STRV_FOREACH() to strv-fundamental.h 37381/head
Daan De Meyer [Wed, 7 May 2025 19:43:39 +0000 (21:43 +0200)] 
strv: Move STRV_FOREACH() to strv-fundamental.h

6 months agoalloc-util: Remove unneeded stdlib.h include
Daan De Meyer [Tue, 6 May 2025 12:20:43 +0000 (14:20 +0200)] 
alloc-util: Remove unneeded stdlib.h include

6 months agocompress: Drop lz4 includes from compress.h
Daan De Meyer [Wed, 7 May 2025 09:43:44 +0000 (11:43 +0200)] 
compress: Drop lz4 includes from compress.h

The lz4 functions are only used in test-compress.c, so let's just
put the declarations and includes in there instead of having everyone
including compress.h pull in the lz4 headers.

6 months agoterminal-util: Move various functions to ansi-color.c
Daan De Meyer [Wed, 7 May 2025 09:26:36 +0000 (11:26 +0200)] 
terminal-util: Move various functions to ansi-color.c

6 months agobasic: Move parts of audit-util.{c,h} to libaudit-util.{c,h} in shared/
Daan De Meyer [Wed, 7 May 2025 09:15:12 +0000 (11:15 +0200)] 
basic: Move parts of audit-util.{c,h} to libaudit-util.{c,h} in shared/

6 months agomacro: Reduce transitive includes
Daan De Meyer [Mon, 5 May 2025 14:03:20 +0000 (16:03 +0200)] 
macro: Reduce transitive includes

6 months agobasic: Override glibc's sys/param.h header with an empty file
Daan De Meyer [Tue, 6 May 2025 13:39:03 +0000 (15:39 +0200)] 
basic: Override glibc's sys/param.h header with an empty file

Instead of unconditionally including sys/param.h in
macro-fundamental.h which itself includes a bunch of other unnecessary
headers, let's override it with an empty file to avoid it from overriding
our MAX() macro. We can't make including it an error as it's included (
for seemingly no good reason) by <resolv.h>.

6 months agoudevadm-info: parse all arguments before doing anything (#37292)
Yu Watanabe [Fri, 9 May 2025 05:09:45 +0000 (14:09 +0900)] 
udevadm-info: parse all arguments before doing anything (#37292)

6 months agoudevadm-info: use string table to parse query type 37292/head
David Tardon [Wed, 7 May 2025 13:05:22 +0000 (15:05 +0200)] 
udevadm-info: use string table to parse query type

6 months agoudevadm-info: drop args of stat_device()
David Tardon [Fri, 25 Apr 2025 12:56:35 +0000 (14:56 +0200)] 
udevadm-info: drop args of stat_device()

They are all static vars now, so can be used directly.

6 months agoudevadm-info: shorten the code a bit
David Tardon [Fri, 25 Apr 2025 12:36:02 +0000 (14:36 +0200)] 
udevadm-info: shorten the code a bit

6 months agoudevadm-info: reject devices passed via opts too
David Tardon [Wed, 7 May 2025 12:35:54 +0000 (14:35 +0200)] 
udevadm-info: reject devices passed via opts too

Follow-up-for a6b4b2fa010f6dc5e18f1a14d93204c6c1416278

6 months agoudevadm-info: split arg. parsing into a separate function
David Tardon [Fri, 3 Nov 2023 13:56:52 +0000 (14:56 +0100)] 
udevadm-info: split arg. parsing into a separate function

6 months agoudevadm-info: drop superfluous pager_open() call
David Tardon [Fri, 25 Apr 2025 12:42:34 +0000 (14:42 +0200)] 
udevadm-info: drop superfluous pager_open() call

It's already called in advance in info_main().

6 months agoudevadm-info: make arg_pager_flags static
David Tardon [Thu, 17 Apr 2025 08:21:41 +0000 (10:21 +0200)] 
udevadm-info: make arg_pager_flags static

6 months agoudevadm-info: move static dtor closer to args
David Tardon [Thu, 17 Apr 2025 08:20:33 +0000 (10:20 +0200)] 
udevadm-info: move static dtor closer to args

6 months agoudev: use userdb_by_name()/groupdb_by_name() 37304/head
Yu Watanabe [Wed, 30 Apr 2025 11:43:44 +0000 (20:43 +0900)] 
udev: use userdb_by_name()/groupdb_by_name()

Prompted by https://github.com/systemd/systemd/pull/37294#discussion_r2068141968.