]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
39 hours agoman: always prefix links to uapi specs with their UAPI.XY spec number 39867/head
Lennart Poettering [Sun, 23 Nov 2025 17:07:13 +0000 (18:07 +0100)] 
man: always prefix links to uapi specs with their UAPI.XY spec number

Let's try to establish the spec numbers, by mentioning them in most doc
links.

Follow-up for: https://github.com/uapi-group/specifications/pull/187

40 hours agodocs: reference UAPI specs by their number when linked
Lennart Poettering [Sun, 23 Nov 2025 16:16:09 +0000 (17:16 +0100)] 
docs: reference UAPI specs by their number when linked

42 hours agofirstboot: drop redundant and spurious errno check
Yu Watanabe [Sun, 23 Nov 2025 06:04:26 +0000 (15:04 +0900)] 
firstboot: drop redundant and spurious errno check

Follow-up for 2319154a6bec7b8c42e901dfacaefe95bf4e3750.

2 days agoboot: ensure profile IDs do not get leaked and overwritten when there are tries suffixes
Luca Boccassi [Sat, 22 Nov 2025 00:25:21 +0000 (00:25 +0000)] 
boot: ensure profile IDs do not get leaked and overwritten when there are tries suffixes

boot_entry_parse_tries() replaces the id, which means the id
with the profile appended is lost (leaked) and replaced by a plain filename
in case there are tries suffixes. This means the wrong order is used in
displaying the entries in the menu, as the main profile is always last
given id_without_profile has the tries suffixes and sorts higher,
while the main profile has no id_without_profile and the id sorts lower
since it does not have the tries suffix.

Follow-up for 4301ad00ef715885be5c3bdf84c152030b7d36ff

2 days agocore/selinux-setup: actually skip setup gracefully when libselinux is not available...
Yu Watanabe [Sun, 23 Nov 2025 00:11:32 +0000 (09:11 +0900)] 
core/selinux-setup: actually skip setup gracefully when libselinux is not available (#39859)

2 days agodocs: Document cast formatting rules
Daan De Meyer [Sat, 22 Nov 2025 21:50:39 +0000 (22:50 +0100)] 
docs: Document cast formatting rules

2 days agocore/selinux-setup: actually skip setup gracefully when libselinux is not available 39859/head
Mike Yuan [Thu, 20 Nov 2025 19:07:32 +0000 (20:07 +0100)] 
core/selinux-setup: actually skip setup gracefully when libselinux is not available

Follow-up for 83b6ef9b62765b11bc602eae906ff13a5464a638

2 days agocore/exec-invoke: deduplicate needs_setuid with needs_sandboxing
Mike Yuan [Thu, 20 Nov 2025 12:52:51 +0000 (13:52 +0100)] 
core/exec-invoke: deduplicate needs_setuid with needs_sandboxing

2 days agoclang-tidy: Enable misc-include-cleaner check (#39835)
Yu Watanabe [Sat, 22 Nov 2025 11:54:28 +0000 (20:54 +0900)] 
clang-tidy: Enable misc-include-cleaner check (#39835)

The previous commit fixes all remaining violations of the check for
a very specific setup (Fedora Rawhide with as many dependencies as
possible installed). The linter job in CI runs that specific setup
so we enable the check in the clang-tidy config but do not yet enable
the clang-tidy test suite in meson by default as it will very likely
still fail in different setups than the one in CI.

2 days agoclang-tidy: Enable misc-include-cleaner check 39835/head
Daan De Meyer [Tue, 20 May 2025 10:28:15 +0000 (12:28 +0200)] 
clang-tidy: Enable misc-include-cleaner check

The previous commit fixes all remaining violations of the check for
a very specific setup (Fedora Rawhide with as many dependencies as
possible installed). The linter job in CI runs that specific setup
so we enable the check in the clang-tidy config but do not yet enable
the clang-tidy test suite in meson by default as it will very likely
still fail in different setups than the one in CI.

2 days agoclang-tidy: Fix all remaining misc-include-cleaner violations
Daan De Meyer [Fri, 23 May 2025 11:38:45 +0000 (13:38 +0200)] 
clang-tidy: Fix all remaining misc-include-cleaner violations

- Remove unused includes
- Add common false positive headers to misc-include-cleaner.IgnoreHeaders
- Add IWYU pragma keep for uncommon false positive headers

2 days agotest-journald-config: Modernize test
Daan De Meyer [Thu, 20 Nov 2025 18:15:14 +0000 (19:15 +0100)] 
test-journald-config: Modernize test

2 days agoVarious logging fixlets (#39837)
Zbigniew Jędrzejewski-Szmek [Sat, 22 Nov 2025 09:14:10 +0000 (10:14 +0100)] 
Various logging fixlets (#39837)

3 days agoNEWS: drop one sentence
Yu Watanabe [Sat, 22 Nov 2025 01:43:14 +0000 (10:43 +0900)] 
NEWS: drop one sentence

We have agreed the bump.

3 days agoUse SD_JSON_BUILD_PAIR_* macros if possible in shared/core/home (#39845)
Yu Watanabe [Sat, 22 Nov 2025 01:04:02 +0000 (10:04 +0900)] 
Use SD_JSON_BUILD_PAIR_* macros if possible in shared/core/home (#39845)

3 days agopam-systemd-home: various logging cleanups 39837/head
Yu Watanabe [Fri, 21 Nov 2025 00:51:29 +0000 (09:51 +0900)] 
pam-systemd-home: various logging cleanups

3 days agopam-systemd-loadkey: append full stop
Yu Watanabe [Fri, 21 Nov 2025 00:31:36 +0000 (09:31 +0900)] 
pam-systemd-loadkey: append full stop

3 days agopam-systemd: various fixlets for logging
Yu Watanabe [Fri, 21 Nov 2025 00:23:11 +0000 (09:23 +0900)] 
pam-systemd: various fixlets for logging

- Do not use '%m' when errno is not set.
- Do not use pam_syslog_errno() when errno is not set.
- Use pam_debug_syslog_errno() rather than log_debug_errno().
- Use 0 rather than PAM_SUCCESS in the function that returns negative
  errno, though PAM_SUCCESS == 0, hence that does not change any
  behavior.
- Append missing full stop in the log message.

3 days agopam-util: make pam_debug_syslog_errno() returns pam error
Yu Watanabe [Fri, 21 Nov 2025 00:21:25 +0000 (09:21 +0900)] 
pam-util: make pam_debug_syslog_errno() returns pam error

Currently, the result of pam_debug_syslog_errno() is unused, hence this
does not change anything and may be slightly redundant. But let's follow
our usual coding style.

3 days agopam-util: use correct errno
Yu Watanabe [Fri, 21 Nov 2025 00:11:34 +0000 (09:11 +0900)] 
pam-util: use correct errno

- pam_log_oom() passes ENOMEM rather than -ENOMEM, hence previously
  pam_log_oom() did not return PAM_BUF_ERR.
- We may (mistakenly) pass SYNTHETIC_ERRNO(). Let's gracefully handle that.
- Introduce errno_to_pam_error() helper function.

3 days agoapparmor: update log message
Yu Watanabe [Thu, 20 Nov 2025 23:40:17 +0000 (08:40 +0900)] 
apparmor: update log message

Follow-up for c3b3eea2e56d7904ace7dd72c8520933ebef843e.
Addresses https://github.com/systemd/systemd/pull/39826#discussion_r2547327325.

3 days agotest: skip test-reread-partition-table if missing privileges
Nick Rosbrook [Fri, 21 Nov 2025 17:49:37 +0000 (12:49 -0500)] 
test: skip test-reread-partition-table if missing privileges

Right now, this test runs inside unprivileged chroots, despite the
running_in_chroot() check. This is because running_in_chroot() fails
with -EACCES, which is ignored.

Hence, check for privileges before calling running_in_chroot(),
otherwise call is inconclusive. Note, the test will fail later on if
running without privileges anyways.

3 days agotest: check for all errors in test-reread-partition-table
Luca Boccassi [Fri, 21 Nov 2025 17:53:46 +0000 (17:53 +0000)] 
test: check for all errors in test-reread-partition-table

Otherwise if opening the loop dev fails, the test segfaults
dereferencing a NULL variable later

Follow-up for 757887d01dd96125be1774f4b23b12f2fbda9a8b

3 days agoresolve: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR() 39845/head
Jelle van der Waa [Fri, 21 Nov 2025 16:07:45 +0000 (17:07 +0100)] 
resolve: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR()

No functional change, just refactoring.

3 days agohome: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR()
Jelle van der Waa [Fri, 21 Nov 2025 16:01:54 +0000 (17:01 +0100)] 
home: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR()

No functional change, just refactoring.

3 days agoshared: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR()
Jelle van der Waa [Fri, 21 Nov 2025 15:59:30 +0000 (16:59 +0100)] 
shared: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR()

No functional change, just refactoring.

3 days agonspawn: Fix broken host links for container journals (#39727)
Chris Down [Fri, 21 Nov 2025 15:42:23 +0000 (23:42 +0800)] 
nspawn: Fix broken host links for container journals (#39727)

Commit 88252ca changed nspawn to always run from a temporary mount
directory (e.g., /tmp/nspawn-root-XXXXXX). This was a good
simplification for mount logic, but it unintentionally broke the
--link-journal feature.

The setup_journal() helper was subsequently passed this ephemeral path
instead of the persistent machine path (from --directory= or --image=).
This caused the host to create broken symlinks pointing to a temporary
directory that would soon be gone.

Fix this by storing the original path and plumbing it through to
setup_journal().

All other mount-related logic in outer_child() continues to use the
temporary `directory` variable.

Fixes: #39472
3 days agonspawn: Add integration test for --link-journal 39727/head
Chris Down [Fri, 14 Nov 2025 08:46:08 +0000 (16:46 +0800)] 
nspawn: Add integration test for --link-journal

3 days agonspawn: Fix broken host links for container journals
Chris Down [Fri, 14 Nov 2025 08:44:49 +0000 (16:44 +0800)] 
nspawn: Fix broken host links for container journals

Commit 88252ca changed nspawn to always run from a temporary mount
directory (e.g., /tmp/nspawn-root-XXXXXX). This was a good
simplification for mount logic, but it unintentionally broke the
--link-journal feature.

The setup_journal() helper was subsequently passed this ephemeral path
instead of the persistent machine path (from --directory= or --image=).
This caused the host to create broken symlinks pointing to a temporary
directory that would soon be gone.

Fix this by storing the original path and plumbing it through to
setup_journal().

All other mount-related logic in outer_child() continues to use the
temporary `directory` variable.

Fixes: #39472
3 days agorun0: Add note about processes having privileges over --empower sessions
Daan De Meyer [Fri, 21 Nov 2025 10:44:30 +0000 (11:44 +0100)] 
run0: Add note about processes having privileges over --empower sessions

3 days agosd-bus: Exit event loop with error code instead of EXIT_FAILURE
Daan De Meyer [Thu, 13 Nov 2025 20:59:18 +0000 (21:59 +0100)] 
sd-bus: Exit event loop with error code instead of EXIT_FAILURE

Instead of failing the event loop with a generic EXIT_FAILURE
error code when exit-on-disconnect is used, let's propagate the
error code instead of swallowing it.

Whereas previously sd_event_loop() would always fail with exit code
'1' when exit-on-disconnect is used with an sd-bus instance registered
with the event loop that encounters a failure, now we'll correctly
propagate the error to sd_event_loop() that caused sd-bus to fail and
exit the event loop. Additionally, the error is now also properly
propagated to outstanding reply callbacks for async dbus calls started
with sd_bus_call_async() and friends, whereas before we always used
ETIMEDOUT for these calls which is extremely confusing for users.

Why is this confusing? We always start sd-bus instances asynchronously,
in other words, sd_bus_start() will not actually wait until the bus instance
is connected, but it'll happen in the background, either driven by the first
sd_bus_call() when there is no event loop or by sd-event when there is an
event loop attached to the sd-bus instance. Assuming an event loop is attached,
when we fail to connect to the bus, the sd-bus instance will close down and the
first async method call we queued will fail with ETIMEDOUT. Nowhere in this process
do we inform the user that we failed to connect to the bus because of e.g. a permission
error, except for a debug log message.

By propagating the error to sd_event_exit() if exit-on-disconnect is enabled
and always propagating it to outstanding reply callbacks, debugging failures
becomes much easier as users will now get the actual error code causing the
bus instance to close down instead of ETIMEDOUT and 1 respectively.

4 days agotest: skip test-loop-block udev part in chroot too
Luca Boccassi [Thu, 20 Nov 2025 14:33:30 +0000 (14:33 +0000)] 
test: skip test-loop-block udev part in chroot too

Same reason as containers, need full udev/uevent machinery for this

4 days agooomd: check if a cgroup can be killed before attempting to kill it
Matteo Croce [Mon, 17 Nov 2025 16:30:34 +0000 (17:30 +0100)] 
oomd: check if a cgroup can be killed before attempting to kill it

On OOM event, oomd tries to kill a cgroup until it succeedes.
The kill can fail with EPERM in case a pid is not killed, this leaves
the cgroup with only half of the processed killed.
This is unlikely but theoretically possible in a user namespace,
where systemd run as root inside the container and tries to kill a
cgroup with some PID from the host namespace.

To address this, send the SIG0 signal to all the processes to check
that we have privileges to kill them.

4 days agoapparmor: move dlopen() into mac_apparmor_use() check (#39826)
Zbigniew Jędrzejewski-Szmek [Thu, 20 Nov 2025 19:10:44 +0000 (20:10 +0100)] 
apparmor: move dlopen() into mac_apparmor_use() check (#39826)

This mirrors what we do for mac_selinux_use(), which also loads
libselinux.

4 days agovirt: debug log when inode_same() fails
Luca Boccassi [Thu, 20 Nov 2025 15:36:39 +0000 (15:36 +0000)] 
virt: debug log when inode_same() fails

If this fails with an error there's no log messages and tests
typically don't log it either as they just check, so add a
message to aid in debugging

4 days agomkosi: Drop IWYU
Daan De Meyer [Thu, 20 Nov 2025 12:18:30 +0000 (13:18 +0100)] 
mkosi: Drop IWYU

We use clang-tidy's include checker, so let's stop installing IWYU.

4 days agoman: fix typo
Christoph Anton Mitterer [Thu, 20 Nov 2025 15:17:45 +0000 (16:17 +0100)] 
man: fix typo

4 days agomkosi: update fedora commit reference to 12f95f807fef5075a8842dd107f83b4c41d5ac26
Daan De Meyer [Thu, 20 Nov 2025 14:08:15 +0000 (15:08 +0100)] 
mkosi: update fedora commit reference to 12f95f807fef5075a8842dd107f83b4c41d5ac26

12f95f807f Wrap %autosetup in %_build_in_place check
f9916b6fd1 Revert "Use %autosetup -C"
044cff4700 Allow empower group
a0acca210d Version 259~rc1
e455d82fd8 Add various extra explicit Requires
1a7506a105 Version 258.2
256463d690 Restore runlevelX.target units
b17d9c3474 Use %autosetup -C
fe18084a05 Remove hack to stop systemd-networkd-resolve-hook.socket

4 days agolabeler: shell-completion -> "shell completion"
Mike Yuan [Thu, 20 Nov 2025 13:01:31 +0000 (14:01 +0100)] 
labeler: shell-completion -> "shell completion"

The latter is what we actually use. We didn't observe the issue
because the rule was effectively inactive before
bcf95c41161fb4d541002777bd6ab3374d72fe39.

4 days agopam_systemd: fix OSC write failure message appearing in error logs (#39791)
Yu Watanabe [Thu, 20 Nov 2025 14:07:00 +0000 (23:07 +0900)] 
pam_systemd: fix OSC write failure message appearing in error logs (#39791)

4 days agoapparmor-util: shortcut mac_apparmor_use() if compile-time disabled 39826/head
Lennart Poettering [Thu, 20 Nov 2025 13:20:37 +0000 (14:20 +0100)] 
apparmor-util: shortcut mac_apparmor_use() if compile-time disabled

4 days agoapparmor: move dlopen() into mac_apparmor_use() check
Lennart Poettering [Thu, 20 Nov 2025 13:09:15 +0000 (14:09 +0100)] 
apparmor: move dlopen() into mac_apparmor_use() check

This mirrors what we do for mac_selinux_use(), which also loads
libselinux.

4 days agomkosi: Install valgrind in tools tree
Daan De Meyer [Thu, 20 Nov 2025 10:36:30 +0000 (11:36 +0100)] 
mkosi: Install valgrind in tools tree

4 days agopam_systemd: fix OSC write failure message appearing in error logs 39791/head
val4oss [Wed, 19 Nov 2025 09:18:30 +0000 (10:18 +0100)] 
pam_systemd: fix OSC write failure message appearing in error logs

Create and use new function pam_debug_syslog_errno() instead to ensure the
message only appears when debug mode is enabled. Pass the debug flag to
open_osc_context() and close_osc_context() to support this change.

4 days agopam-util: fix pam_syslog_errno() ignoring the level parameter
val4oss [Wed, 19 Nov 2025 09:18:41 +0000 (10:18 +0100)] 
pam-util: fix pam_syslog_errno() ignoring the level parameter

The function accepts a level parameter but was always logging at
LOG_ERR. Fix by passing the level parameter to sym_pam_vsyslog()
instead of hardcoding LOG_ERR.

This caused debug and warning messages to incorrectly appear in error
logs.

4 days agoMake file-hierarchy.7 link to two online docs and drop most of the contents (#39412)
Daan De Meyer [Thu, 20 Nov 2025 08:56:41 +0000 (09:56 +0100)] 
Make file-hierarchy.7 link to two online docs and drop most of the contents (#39412)

4 days agoman: improve BindsTo= documentation
Christoph Anton Mitterer [Sat, 18 Oct 2025 03:30:12 +0000 (05:30 +0200)] 
man: improve BindsTo= documentation

Make “effect” plural to indicate that BindsTo= also includes the other effects
of Requires= (like starting the listed units).

The documentation of Requires= already describes that the configuring unit is
stopped/restarted if any of the list units is explicitly stopped/restarted.
This made the previous wording “in addition to the effect of Requires, it
declares that if the unit bound to is stopped, this unit will be stopped too.”
ambiguous – this is no in addition, Requires= already does that, at least for
some (namely the explicit) cases.
Resolve this by making it clear what the actual difference to Requires= is and
further mention that this also includes failed units.

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
4 days agotimer: rebase last_trigger timestamp if needed
Frantisek Sumsal [Wed, 19 Nov 2025 13:44:13 +0000 (14:44 +0100)] 
timer: rebase last_trigger timestamp if needed

After bdb8e584f4509de0daebbe2357d23156160c3a90 we stopped rebasing the
next elapse timestamp unconditionally and the only case where we'd do
that was when both last trigger and last inactive timestamps were empty.
This covered timer units during boot just fine, since they would have
neither of those timestamps set. However, persistent timers
(Persistent=yes) store their last trigger timestamp on a persistent
storage and load it back after reboot, so the rebasing was skipped in
this case.

To mitigate this, check the last_trigger timestamp is older than the
current machine boot - if so, that means that it came from a stamp file
of a persistent timer unit and we need to rebase it to make
RandomizedDelaySec= work properly.

Follow-up for bdb8e584f4509de0daebbe2357d23156160c3a90.

Resolves: #39739

5 days agomeson: sort shell completions and exit earlier when shell completion is disabled...
Zbigniew Jędrzejewski-Szmek [Thu, 20 Nov 2025 07:35:21 +0000 (08:35 +0100)] 
meson: sort shell completions and exit earlier when shell completion is disabled (#39816)

5 days agoAvoid multiple evaluations in STRERROR_XYZ() macros (#39794)
Zbigniew Jędrzejewski-Szmek [Thu, 20 Nov 2025 07:29:32 +0000 (08:29 +0100)] 
Avoid multiple evaluations in STRERROR_XYZ() macros (#39794)

5 days agomeson: exit earlier from the subdirectory when bash/zshcompletiondir is 'no' 39816/head
Yu Watanabe [Thu, 20 Nov 2025 05:46:18 +0000 (14:46 +0900)] 
meson: exit earlier from the subdirectory when bash/zshcompletiondir is 'no'

5 days agomeson: sort shell completions
Yu Watanabe [Thu, 20 Nov 2025 05:39:13 +0000 (14:39 +0900)] 
meson: sort shell completions

5 days agoshell-completion: add bash script for varlinkctl
Luca Boccassi [Thu, 20 Nov 2025 02:09:48 +0000 (02:09 +0000)] 
shell-completion: add bash script for varlinkctl

5 days agocore: SMACK label to Unix socket path and FD (#39772)
Yu Watanabe [Thu, 20 Nov 2025 04:23:51 +0000 (13:23 +0900)] 
core: SMACK label to Unix socket path and FD (#39772)

Currently, when a socket unit specifies SmackLabel=,
the label is not applied to the underlying Unix socket file or its file
descriptor.

This change ensures that the SMACK label is applied both to the
Unix socket path on the filesystem and to all associated socket FDs
when the socket is created.

Testing:

- Tested on Fedora 43 with kernel 6.17.7 with SMACK enabled.
- Created a systemd socket unit:

    [Unit]
    Description=UNIX socket

    [Socket]
    ListenStream=/run/test.sock
    SmackLabel=label

    [Install]
    WantedBy=sockets.target

- Created a corresponding service:

    [Unit]
    Description=UNIX socket service
    Requires=test.socket

    [Service]
    ExecStart=/usr/bin/socat -v - -
    StandardInput=socket

    [Install]
    WantedBy=multi-user.target

- Verified SMACK labels using getfattr:

  - Without SmackLabel:
    ```
    # file: run/test.sock
    security.SMACK64="_"
    # file: proc/<pid>/fd/*
    security.SMACK64="*"
    ```
  - With SmackLabel=label:
    ```
    # file: run/test.sock
    security.SMACK64="label"
    # file: proc/<pid>/fd/*
    security.SMACK64="label"
    ```

5 days agoSimplify source lists in meson config (#39811)
Yu Watanabe [Thu, 20 Nov 2025 04:20:41 +0000 (13:20 +0900)] 
Simplify source lists in meson config (#39811)

5 days agoNEWS: fix typo
Yu Watanabe [Thu, 20 Nov 2025 01:08:38 +0000 (10:08 +0900)] 
NEWS: fix typo

5 days agomeson: automatically add 'extract' to 'sources' 39811/head
Zbigniew Jędrzejewski-Szmek [Wed, 19 Nov 2025 10:20:18 +0000 (11:20 +0100)] 
meson: automatically add 'extract' to 'sources'

In all cases, everything that we list in 'extract', we also list in
'sources'. We can simplify things by automatically appending the first
list to the second.

In the listings, move 'extract' key right below 'sources', since now
they are both "sources", just with slightly different meanings.

5 days agosocket-label: apply SMACK label to socket and its file descriptor 39772/head
Marc-Antoine Riou [Thu, 6 Nov 2025 10:21:12 +0000 (10:21 +0000)] 
socket-label: apply SMACK label to socket and its file descriptor

When a socket unit specifies SmackLabel=, the label was previously
not applied to the underlying Unix socket file or its file descriptor.
This change ensures that the SMACK label is applied both to the
socket path on the filesystem and to the opened socket FD.

5 days agosocket-label: move prototype of socket_address_listen() and string table for SocketAd...
Yu Watanabe [Thu, 20 Nov 2025 00:39:32 +0000 (09:39 +0900)] 
socket-label: move prototype of socket_address_listen() and string table for SocketAddressBindIPv6Only

The function socket_address_listen() is declared at shared/socket-label.c,
however its prototype was in basic/socket-util.h. This moves the
prototype to shared/socket-label.h.

Also, enum SocketAddressBindIPv6Only is not used anymore in basic/*.[ch].
Let's move the definition and its string table to shared/socket-label.[ch].

Follow-up for b25a930f0e2ebe77bc8b0f0acfac8a3b27ef1f0a.

5 days agouser-util: avoid double evaluation in STRERROR_USER/GROUP() 39794/head
Yu Watanabe [Tue, 18 Nov 2025 20:10:44 +0000 (05:10 +0900)] 
user-util: avoid double evaluation in STRERROR_USER/GROUP()

Follow-up for 6e6e96f628d352b56fd396cffb311f16839f78fb.

5 days agoerrno-util: avoid double evaluation in STRERROR_OR_EOF()
Yu Watanabe [Tue, 18 Nov 2025 20:09:02 +0000 (05:09 +0900)] 
errno-util: avoid double evaluation in STRERROR_OR_EOF()

Follow-up for f69ae8585f5ce6cd8d1e6f3ccd6c9c2cf153e846.

5 days agotest: fix tested function name
Yu Watanabe [Tue, 18 Nov 2025 19:46:25 +0000 (04:46 +0900)] 
test: fix tested function name

The test tests STRERROR_OR_EOF(), but logged as STRERROR_OR_ELSE.

5 days agocore: Verify inherited FDs are writable for stdout/stderr (#39674)
Yu Watanabe [Wed, 19 Nov 2025 23:19:46 +0000 (08:19 +0900)] 
core: Verify inherited FDs are writable for stdout/stderr (#39674)

When inheriting file descriptors for stdout/stderr (either from stdin or
when making stderr inherit from stdout), we previously just assumed they
would be writable and dup'd them. This could lead to broken setups if
the inherited FD was actually opened read-only.

Before dup'ing any inherited FDs to stdout/stderr, verify they are
actually writable using the new fd_is_writable() helper. If not, fall
back to /dev/null (or reopen the terminal in the TTY case) with a
warning, rather than silently creating a broken setup where output
operations would fail.

5 days agonetwork: clear existing routes if Gateway= is empty in [Network]
Quentin Deslandes [Tue, 18 Nov 2025 20:36:49 +0000 (21:36 +0100)] 
network: clear existing routes if Gateway= is empty in [Network]

Add support for an empty Gateway= in [Network] to clear the existing
routes. This change will allow users to remove the default route from a
drop-in file.

5 days agoman: add 'testing' as one of the suggestions for DEPLOYMENT=
Zbigniew Jędrzejewski-Szmek [Wed, 19 Nov 2025 15:19:16 +0000 (16:19 +0100)] 
man: add 'testing' as one of the suggestions for DEPLOYMENT=

Looking at the list, "test" or "testing" seems to be a fairly generic entry
that is missing from the list of suggestions. I went with "testing" because it
fits better with the other item, e.g. "staging".

In https://github.com/systemd/systemd/issues/38743 "laboratory" was also
suggested. I didn't include this because that is more about the location, not
deployment type. Any of the other deployments could be in a "laboratory".

Closes https://github.com/systemd/systemd/issues/38743.

5 days agotests: ASSERT_SIGNAL: Prevent hallucinating parent as child and confusing exit codes...
Chris Down [Wed, 19 Nov 2025 19:52:02 +0000 (03:52 +0800)] 
tests: ASSERT_SIGNAL: Prevent hallucinating parent as child and confusing exit codes with signals (#39807)

This series fixes two distinct, pretty bad bugs in `ASSERT_SIGNAL`.
These bugs can allow failing tests to pass, and can also cause the test
runner to silently terminate prematurely in a way that looks like
success.

This is not theoretical, see
https://github.com/systemd/systemd/pull/39674#discussion_r2540552699 for
a real case of this happening.

---

Bug 1: Parent process hallucinates it is the child and re-executes the
expression being tested

Previously, assert_signal_internal() returned 0 in two mutually
exclusive states:

1. We are the child process (immediately after fork()).
2. We are the parent process, and the child exited normally (status 0).

The macro failed to distinguish these cases. If a child failed to crash
as expected, the parent received 0, incorrectly interpreted it as it
being the child, and re-executed the test expression inside the parent
process.

This can cause tests to falsely pass. The parent would successfully run
the expression (which wasn't supposed to crash in the parent), succeed,
and call _exit(EXIT_SUCCESS).

The second consequence is silent truncation. When the parent called
_exit(), it terminated the entire test runner immediately. Any
subsequent tests in the same binary were never executed.

---

Bug 2: Conflation of exit codes and signals

The harness returned the raw si_status without checking si_code. This
meant that an exit code was indistinguishable from a signal number. For
example, if a child process failed and called exit(6), the harness
reported it as having been killed by SIGABRT (signal 6).

---

This PR both fixes the bugs and reworks the ASSERT_SIGNAL infrastructure
to ensure this is very unlikely to regress:

- assert_signal_internal now returns an explicit control flow enum
(FORK_CHILD / FORK_PARENT) separate from the status data. This makes it
structurally impossible for the parent to hallucinate that it is the
child.
- The output parameter is only populated with a signal number if si_code
confirms the process was killed by a signal. Normal exits return 0.

5 days agodocs: elf metadata specs have moved to uapi-group
Luca Boccassi [Wed, 19 Nov 2025 17:30:24 +0000 (17:30 +0000)] 
docs: elf metadata specs have moved to uapi-group

5 days agotests: ASSERT_SIGNAL: Do not allow parent to hallucinate it is the child 39807/head
Chris Down [Wed, 19 Nov 2025 14:06:03 +0000 (22:06 +0800)] 
tests: ASSERT_SIGNAL: Do not allow parent to hallucinate it is the child

assert_signal_internal() returns 0 in two distinct cases:

1. In the child process (immediately after fork returns 0).
2. In the parent process, if the child exited normally (no signal).

ASSERT_SIGNAL fails to distinguish these cases. When a child exited
normally (case 2), the parent process receives 0, incorrectly interprets
it as meaning it is the child, and re-executes the test expression
inside the parent process. Goodness gracious!

This causes two severe test integrity issues:

1. False positives. The parent can run the expression, succeed, and call
   _exit(EXIT_SUCCESS), causing the test to pass even though no signal
   was raised.
2. Silent truncation. The _exit() call in the parent terminates the test
   runner prematurely, preventing subsequent tests in the same file from
   running.

Example of the bug in action, from #39674:

    ASSERT_SIGNAL(fd_is_writable(closed_fd), SIGABRT)

This test should fail (fd_is_writable does not SIGABRT here), but with
the bug, the parent hallucinated being the child, re-ran the expression
successfully, and exited with success.

Fix this by refactoring assert_signal_internal() to be much more strict
about separating control flow from data.

The signal status is now returned via a strictly typed output parameter,
guaranteeing that determining whether we are the child is never
conflated with whether the child exited cleanly.

5 days agotests: ASSERT_SIGNAL: Ensure sanitisers do not mask expected signals
Chris Down [Wed, 19 Nov 2025 13:45:40 +0000 (21:45 +0800)] 
tests: ASSERT_SIGNAL: Ensure sanitisers do not mask expected signals

ASAN installs signal handlers to catch crashes like SIGSEGV or SIGILL.
When these signals are raised, ASAN traps them, prints an error report,
and then typically terminates the process with a different signal (often
SIGABRT) or a non-zero exit code.

This interferes with ASSERT_SIGNAL when checking for specific crash
signals (for example, checking that a function raises SIGSEGV). In such
a case, the test harness sees the ASAN termination signal rather than
the expected signal, causing the test to fail.

Fix this by resetting the signal handler to SIG_DFL in the child process
immediately before executing the test expression. This ensures the
kernel kills the process directly with the expected signal, bypassing
ASAN's interceptors.

5 days agotests: ASSERT_SIGNAL: Stop exit codes from masquerading as signals
Chris Down [Wed, 19 Nov 2025 08:50:38 +0000 (16:50 +0800)] 
tests: ASSERT_SIGNAL: Stop exit codes from masquerading as signals

When a child process exits normally (si_code == CLD_EXITED),
siginfo.si_status contains the exit code. When it is killed by a signal
(si_code == CLD_KILLED or CLD_DUMPED), si_status contains the signal
number.  However, assert_signal_internal() returns si_status blindly.
This causes exit codes to be misinterpreted as signal numbers.

This allows failing tests to silently pass if their exit code
numerically coincides with the expected signal. For example, a test
expecting SIGABRT (6) would incorrectly pass if the child simply exited
with status 6 instead of being killed by a signal.

Fix this by checking si_code. Only return si_status as a signal number
if the child was actually killed by a signal (CLD_KILLED or CLD_DUMPED).
If the child exited normally (CLD_EXITED), return 0 to indicate that no
signal occurred.

5 days agocore: Verify inherited FDs are writable for stdout/stderr 39674/head
Chris Down [Mon, 10 Nov 2025 20:26:10 +0000 (04:26 +0800)] 
core: Verify inherited FDs are writable for stdout/stderr

When inheriting file descriptors for stdout/stderr (either from stdin
or when making stderr inherit from stdout), we previously just assumed
they would be writable and dup'd them. This could lead to broken setups
if the inherited FD was actually opened read-only.

Before dup'ing any inherited FDs to stdout/stderr, verify they are
actually writable using the new fd_is_writable() helper. If not, fall
back to /dev/null (or reopen the terminal in the TTY case) with a
warning, rather than silently creating a broken setup where output
operations would fail.

5 days agofd-util: Add fd_is_writable() to check if FD is opened for writing
Chris Down [Mon, 17 Nov 2025 03:05:09 +0000 (11:05 +0800)] 
fd-util: Add fd_is_writable() to check if FD is opened for writing

This checks whether a file descriptor is valid and opened in a mode that
allows writing (O_WRONLY or O_RDWR). This is useful when we want to
verify that inherited FDs can actually be used for output operations
before dup'ing them.

The helper explicitly handles O_PATH file descriptors, which cannot be
used for I/O operations and thus are never writable.

5 days agocore/socket: do not log failure in setting socket option with number
Yu Watanabe [Tue, 18 Nov 2025 19:01:17 +0000 (04:01 +0900)] 
core/socket: do not log failure in setting socket option with number

This also downgrade to the debug level when the option is simply not
supported.

Follow-up for b81a14b91efea17631d634f5dbd69314780815ab.
Fixes #39792.

5 days agotest/TEST-74-AUX-UTILS: fix racy check
Zbigniew Jędrzejewski-Szmek [Wed, 19 Nov 2025 14:57:29 +0000 (15:57 +0100)] 
test/TEST-74-AUX-UTILS: fix racy check

We were getting a list of invocation IDs, picking one at random,
and then querying the unit. This is obviously racy.

TEST-74-AUX-UTILS.sh[2873]: + varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List
                              '{"invocationID": "2052c9a5-7983-4f72-9910-c49e38c91dab"}'
TEST-74-AUX-UTILS.sh[3707]: Method call io.systemd.Unit.List() failed: io.systemd.Unit.NoSuchUnit

The complicated varlink + jq callout is replaced by a simple systemctl call.
I think that's better to avoid a complicated jq expression.

Fixes https://github.com/systemd/systemd/issues/38647.

5 days agomeson: drop unnessary variable
Zbigniew Jędrzejewski-Szmek [Wed, 19 Nov 2025 10:21:37 +0000 (11:21 +0100)] 
meson: drop unnessary variable

5 days agocryptsetup: fix wrong argument order for mechanism vs. name
Martin Hundebøll [Wed, 19 Nov 2025 11:52:25 +0000 (12:52 +0100)] 
cryptsetup: fix wrong argument order for mechanism vs. name

Fixes: https://github.com/systemd/systemd/issues/39655
5 days agoDeduplicate and improve messages from ssh-generator (#39785)
Zbigniew Jędrzejewski-Szmek [Wed, 19 Nov 2025 15:00:34 +0000 (16:00 +0100)] 
Deduplicate and improve messages from ssh-generator (#39785)

5 days agotests: Avoid variable shadowing in ASSERT_SIGNAL
Chris Down [Wed, 19 Nov 2025 08:49:22 +0000 (16:49 +0800)] 
tests: Avoid variable shadowing in ASSERT_SIGNAL

The ASSERT_SIGNAL macro uses a fixed variable name, `_r`. This prevents
nesting the macro (like ASSERT_SIGNAL(ASSERT_SIGNAL(...))), as the inner
instance would shadow the outer instance's variable.

Switch to using the UNIQ_T helper to generate unique variable names at
each expansion level. This allows the macro to be used recursively,
which is required for upcoming regression tests regarding signal
handling logic.

5 days agotools: Add script to detect unused symbols in libshared
Daan De Meyer [Wed, 19 Nov 2025 09:30:01 +0000 (10:30 +0100)] 
tools: Add script to detect unused symbols in libshared

Symbols exported by libshared can't get pruned by the linker, so
every unused exported symbol is effectively dead code we ship to users
for no good reason. Let's add a script to analyze how many such symbols
we have.

We also add a meson test to run the script on all of our binaries.
Since it detects unused symbols and still has a few false positives,
don't enable the test by default similar to the clang-tidy tests.

The script was 100% vibe coded by Github Copilot with Claude Sonnet 4.5
as the model.

Current results are (without the unused symbols list):

Analysis of libsystemd-shared-259.so
======================================================================
Total exported symbols: 4830
  (excluding public API symbols starting with 'sd_')
Used symbols: 4672
Unused symbols: 158
Usage rate: 96.7%

5 days agolibudev: Don't pull in libshared_static
Daan De Meyer [Wed, 19 Nov 2025 08:59:19 +0000 (09:59 +0100)] 
libudev: Don't pull in libshared_static

- Move devices-nodes.c to src/basic as it's super trivial anyway
- Duplicate udev_queue_is_empty() in libudev-util.c as it's trivial
  anyway.

5 days agossh-generator: suppress error message for vsock EADDRNOTAVAIL 39785/head
Zbigniew Jędrzejewski-Szmek [Tue, 18 Nov 2025 10:37:59 +0000 (11:37 +0100)] 
ssh-generator: suppress error message for vsock EADDRNOTAVAIL

In logs in the Fedora OpenQA CI:
Nov 17 22:20:06 fedora systemd-ssh-generator[4117]: Failed to query local AF_VSOCK CID: Cannot assign requested address
Nov 17 22:20:06 fedora (generato[4088]: /usr/lib/systemd/system-generators/systemd-ssh-generator failed with exit status 1.
Nov 17 22:20:06 fedora systemd[1]: sshd-vsock.socket: Unit configuration changed while unit was running, and no socket file descriptors are open. Unit not functional until restarted.

AF_VSOCK is not configured there and systemd-ssh-generator should just exit
quietly. vsock_get_local_cid() already does some logging at debug level, so we
don't need to.

There is also a second bug, we report modifications to the unit have just
created. I think we have an issue open for this somewhere, but cannot find it.

5 days agossh-generator: split out one more helper function
Zbigniew Jędrzejewski-Szmek [Tue, 18 Nov 2025 10:34:37 +0000 (11:34 +0100)] 
ssh-generator: split out one more helper function

5 days agossh-generator: split out common helper function
Zbigniew Jędrzejewski-Szmek [Tue, 18 Nov 2025 10:19:41 +0000 (11:19 +0100)] 
ssh-generator: split out common helper function

6 days agoman: use prefix number that matches the general suggestion
Christoph Anton Mitterer [Wed, 19 Nov 2025 04:54:40 +0000 (05:54 +0100)] 
man: use prefix number that matches the general suggestion

`systemd.network(5)` recommends “that each filename is prefixed with a number
smaller than "70" (e.g.  10-eth0.network)”.

Reduce that used by the example accordingly, but stay above the number (`50`)
used in the earlier example for static configuration, so that would take
precedence over the dynamic one if both match for the same network.

6 days agoImprove systemd-analyze man page and bash completion (#39778)
Luca Boccassi [Tue, 18 Nov 2025 22:54:01 +0000 (22:54 +0000)] 
Improve systemd-analyze man page and bash completion (#39778)

This updates example output in systemd-analyze's man page after the
tool's output was changed in a previous commit.

Additionally bash completion is added for `systemd-analyze filesystems`
and improved for `systemd-analyze calendar`.

6 days agoshell-completion: bash: Add systemd-analyze calendar options 39778/head
Simon Barth [Tue, 11 Nov 2025 19:59:30 +0000 (20:59 +0100)] 
shell-completion: bash: Add systemd-analyze calendar options

Add completion for the systemd-analyze calendar options --iterations and
--base-time.

6 days agoUser and group error messages (#39783)
Zbigniew Jędrzejewski-Szmek [Tue, 18 Nov 2025 18:39:57 +0000 (19:39 +0100)] 
User and group error messages (#39783)

I'm using separate commit here because this changes are a bit finicky.

6 days agonetworkd: use STRERROR_{USER,GROUP} 39783/head
Zbigniew Jędrzejewski-Szmek [Tue, 18 Nov 2025 11:41:45 +0000 (12:41 +0100)] 
networkd: use STRERROR_{USER,GROUP}

6 days agonspawn,vmspawn: improve errors for unknown users and groups
Zbigniew Jędrzejewski-Szmek [Tue, 18 Nov 2025 09:29:40 +0000 (10:29 +0100)] 
nspawn,vmspawn: improve errors for unknown users and groups

6 days agologin: use STREROR_USER helper
Zbigniew Jędrzejewski-Szmek [Tue, 18 Nov 2025 09:28:53 +0000 (10:28 +0100)] 
login: use STREROR_USER helper

6 days agocreds: improve message about unknown user
Zbigniew Jędrzejewski-Szmek [Tue, 18 Nov 2025 09:18:25 +0000 (10:18 +0100)] 
creds: improve message about unknown user

Before:
$ build/systemd-creds --uid=asdf
Failed to resolve user 'asdf': No such process
Now:
$ build/systemd-creds --uid=asdf
Failed to resolve user 'asdf': Unknown user

6 days agocore: improve messages about unknown users and groups
Zbigniew Jędrzejewski-Szmek [Tue, 18 Nov 2025 09:08:41 +0000 (10:08 +0100)] 
core: improve messages about unknown users and groups

$ sudo build/systemd-run --uid=asdf whoami
$ journalctl -e
(whoami)[1007784]: run-p1007782-i5200512.service: Failed to determine user credentials: No such process
(whoami)[1007784]: run-p1007782-i5200512.service: Failed at step USER spawning /usr/sbin/whoami: No such process
systemd[1]: run-p1007782-i5200512.service: Main process exited, code=exited, status=217/USER
systemd[1]: run-p1007782-i5200512.service: Failed with result 'exit-code'.

Now:
(whoami)[1013204]: run-p1013202-i5205932.service: Failed to determine credentials for user 'asdf': Unknown user
(whoami)[1013204]: run-p1013202-i5205932.service: Failed at step USER spawning /usr/sbin/whoami: Invalid argument
systemd[1]: run-p1013202-i5205932.service: Main process exited, code=exited, status=217/USER
systemd[1]: run-p1013202-i5205932.service: Failed with result 'exit-code'.

6 days agorun: improve log message for unknown user/group
Zbigniew Jędrzejewski-Szmek [Tue, 18 Nov 2025 08:26:49 +0000 (09:26 +0100)] 
run: improve log message for unknown user/group

Before:
$ sudo build/systemd-run --scope --uid=asdf whoami
Failed to resolve user asdf: No such process
Now:
$ sudo build/systemd-run --scope --uid=asdf whoami
Failed to resolve user 'asdf': Unknown user

6 days agotmpfiles: improve error message for missing user/group
Zbigniew Jędrzejewski-Szmek [Tue, 18 Nov 2025 08:21:02 +0000 (09:21 +0100)] 
tmpfiles: improve error message for missing user/group

From a boot with a dracut initrd:
systemd-tmpfiles[242]: /usr/lib/tmpfiles.d/tpm2-tss-fapi.conf:2: Failed to resolve user 'tss': No such process
systemd-tmpfiles[242]: Failed to parse ACL "default:group:tss:rwx", ignoring: Invalid argument
systemd-tmpfiles[242]: /usr/lib/tmpfiles.d/tpm2-tss-fapi.conf:4: Failed to resolve user 'tss': No such process
systemd-tmpfiles[242]: Failed to parse ACL "default:group:tss:rwx", ignoring: Invalid argument
systemd-tmpfiles[242]: /usr/lib/tmpfiles.d/tpm2-tss-fapi.conf:6: Failed to resolve group 'tss': No such process
systemd-tmpfiles[242]: /usr/lib/tmpfiles.d/tpm2-tss-fapi.conf:7: Failed to resolve group 'tss': No such process

6 days agoudev: define a generic helper to print messages about unknown users and groups
Zbigniew Jędrzejewski-Szmek [Tue, 18 Nov 2025 08:47:51 +0000 (09:47 +0100)] 
udev: define a generic helper to print messages about unknown users and groups

We cannot just use %m, because strerror returns a confusing error message
for ESRCH or ENOEXEC. udev code was doing a good job, but the error handling
was very verbose. Let's encapsulate the customized error messages in a
helper.

No functional change, except that the error messages have a slightly different
form now. The old messages were a bit better, but we don't have as much
flexibility in the new scheme. "Failed to resolve user 'foo': Unknown user"
should be good enough.

6 days agotest: wait for a process ID instead of job ID
Frantisek Sumsal [Tue, 18 Nov 2025 12:49:03 +0000 (13:49 +0100)] 
test: wait for a process ID instead of job ID

Since depending on job control turned out to be flaky [0], let's just
explicitly wait for a process ID instead.

Follow-up for 3849b0701a7713c147400f205e7ddb3e3f93ad26.
Resolves: #39543

[0] https://github.com/systemd/systemd/issues/39543#issuecomment-3529418583

6 days agomkosi: Add sanitizer libraries to the CentOS/Fedora tools tree
Daan De Meyer [Fri, 14 Nov 2025 20:21:16 +0000 (21:21 +0100)] 
mkosi: Add sanitizer libraries to the CentOS/Fedora tools tree

6 days agoNEWS: fix typo
Armin Brauns [Tue, 18 Nov 2025 12:54:11 +0000 (12:54 +0000)] 
NEWS: fix typo

6 days agodocs/MOUNT_REQUIREMENTS: also link to LFHS 39412/head
Zbigniew Jędrzejewski-Szmek [Wed, 22 Oct 2025 14:18:14 +0000 (16:18 +0200)] 
docs/MOUNT_REQUIREMENTS: also link to LFHS

This document doesn't really without the basis of the other one.

6 days agoman/file-hierarchy: refer to LFSH and MOUNT_REQUIREMENTS
Zbigniew Jędrzejewski-Szmek [Wed, 22 Oct 2025 14:13:17 +0000 (16:13 +0200)] 
man/file-hierarchy: refer to LFSH and MOUNT_REQUIREMENTS

The contents of file-hierarchy.7 have been copied over to the new page in
uapi-docs, and are already going stale here, since a bunch of additions and
improvements has been made there. OTOH, a commit was made here, but not there.
https://github.com/uapi-group/specifications/pull/172 updates the other doc.
OTOH, a reader should also read MOUNT_REQUIREMENTS if they care about what
systemd cares about. Thus, replace most of the text in our man page by a
reference to those two pages. In case we later want to list some disagreements
or differences wrt. LFSH, we can always add a paragraph or two here,
but having two documents with almost the same content is not going to work.