]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 days agosd-varlink: add sd_varlink_call_and_upgradeb() + sd_varlink_call_and_upgradebo() 42974/head
Lennart Poettering [Tue, 7 Jul 2026 10:45:31 +0000 (12:45 +0200)] 
sd-varlink: add sd_varlink_call_and_upgradeb() + sd_varlink_call_and_upgradebo()

This are to the existing sd_varlink_call_and_upgrade() what
sd_varlink_callb() and sd_varlink_callbo() are to sd_varlink_call():
they put together an object on the fly, via the usual JSON builder
logic.

2 days agosd-varlink: add async server-side upgrade API
Lennart Poettering [Tue, 7 Jul 2026 08:47:46 +0000 (10:47 +0200)] 
sd-varlink: add async server-side upgrade API

2 days agosd-varlink: move varlink_handle_upgrade_fds() before sd_varlink_process()
Lennart Poettering [Tue, 7 Jul 2026 09:13:38 +0000 (11:13 +0200)] 
sd-varlink: move varlink_handle_upgrade_fds() before sd_varlink_process()

This is a simple move, in preparation for using this as part of the
sd_varlink_process() callchain.

2 days agosd-varlink: fold separate 'protocol_upgrade' flag into state machine
Lennart Poettering [Tue, 7 Jul 2026 08:59:40 +0000 (10:59 +0200)] 
sd-varlink: fold separate 'protocol_upgrade' flag into state machine

2 days agojson-stream: add helper json_stream_has_buffered_output()
Lennart Poettering [Tue, 7 Jul 2026 08:45:08 +0000 (10:45 +0200)] 
json-stream: add helper json_stream_has_buffered_output()

2 days agoAssorted basic/shared/ndisc/import hardening fixes flagged by kres (#42934)
Lennart Poettering [Sun, 12 Jul 2026 20:17:08 +0000 (22:17 +0200)] 
Assorted basic/shared/ndisc/import hardening fixes flagged by kres (#42934)

3 days agoclaude-review: downgrade effort from xhigh to high
Luca Boccassi [Sun, 12 Jul 2026 09:56:12 +0000 (10:56 +0100)] 
claude-review: downgrade effort from xhigh to high

Claude reviews keep failing due to hitting 60m timeouts, as they take
too long. Lower effort from xhigh to high to try and speed them up.

3 days agohwdb: sensor: Add Odys Windesk X10 accel mount matrix
Hans de Goede [Sun, 12 Jul 2026 11:32:02 +0000 (13:32 +0200)] 
hwdb: sensor: Add Odys Windesk X10 accel mount matrix

Add a mount matrix for the accelerometer on the Odys Windesk X10 tablet to
fix auto-rotation.

3 days agoRevert "claude-review: bump timeout from 60m to 120m"
Luca Boccassi [Sat, 11 Jul 2026 23:46:52 +0000 (00:46 +0100)] 
Revert "claude-review: bump timeout from 60m to 120m"

This reverts commit 6f04b8e5717264c2547f1c3e764ba8b000c23d0c.

3 days agoclaude-review: bump timeout from 60m to 120m
Luca Boccassi [Sat, 11 Jul 2026 18:32:59 +0000 (19:32 +0100)] 
claude-review: bump timeout from 60m to 120m

Claude got slower, but in many cases it's on the brink of finishing the
review when the timeout kicks in. Double it.

3 days agoci: check 'update-man-rules' to ensure it is not forgotten
Luca Boccassi [Sat, 11 Jul 2026 18:47:16 +0000 (19:47 +0100)] 
ci: check 'update-man-rules' to ensure it is not forgotten

We often forget to run this command when updating manpages, and notice
only much later. Add a step in the CI to flag it, as we already do for
the D-Bus docs.

4 days agonss-myhostname: keep IPv6 probe result stable 42934/head
Luca Boccassi [Wed, 8 Jul 2026 14:58:45 +0000 (15:58 +0100)] 
nss-myhostname: keep IPv6 probe result stable

Cache the IPv6 enabled state while sizing and filling NSS result
buffers, so a transient sysctl read result cannot change the tuple or
address layout after the scratch buffer size has been computed. Also
zero-initialize gaih_addrtuple records before filling IPv4 addresses.

Follow-up for e8a7a315391a6a07897122725cd707f4e9ce63d7

4 days agocreds: tolerate TPM2 seal failure in auto mode
Luca Boccassi [Wed, 8 Jul 2026 14:40:59 +0000 (15:40 +0100)] 
creds: tolerate TPM2 seal failure in auto mode

Automatic key modes tolerate a failed TPM2 sealing attempt and
fall back to a host or null key. Do not consume TPM2 blob output in
that case, tpm2_seal() leaves it empty on failure, so the fallback
path should continue without TPM2 metadata.

Follow-up for 9e4379945b74ee7920fe375be0bcb04d8ef53873

4 days agondisc: reject non-zero ICMPv6 codes in parsers
Luca Boccassi [Wed, 8 Jul 2026 13:22:41 +0000 (14:22 +0100)] 
ndisc: reject non-zero ICMPv6 codes in parsers

NDisc packets received through the socket path are filtered before
parser dispatch, but parser entry points should still reject malformed
packet bytes instead of asserting on them. Return EBADMSG for non-zero
ICMPv6 code values in RA, NA, and Redirect messages.

Follow-up for c34cb1d6451dd9fcd36e1c08c553ca7f25e9d83b
Follow-up for 696eb2b8de980a2b79c1de7fbf12195936b00441
Follow-up for 44e8cf303b1e54752637725d55d01811e05ed482

4 days agopull-oci: verify redirected manifest digest
Luca Boccassi [Wed, 8 Jul 2026 12:53:52 +0000 (13:53 +0100)] 
pull-oci: verify redirected manifest digest

An OCI index redirect already carries the digest of the selected
manifest. Store it in the expected checksum field so pull-job
verifies the downloaded manifest instead of overwriting the digest
with the computed checksum before comparison.

Follow-up for a9f6ba04969d6eb2e629e30299fab7538ef42a57

4 days agoefivars: fix concurrent growth read accounting
Luca Boccassi [Wed, 8 Jul 2026 12:07:44 +0000 (13:07 +0100)] 
efivars: fix concurrent growth read accounting

efi_get_variable() allocates one byte for probing whether efivarfs
has grown since fstat(), then three more bytes for NUL termination.
Account for both sizes separately so a full readv() result is treated
as concurrent growth and retried before the terminators are written.

Follow-up for ab69a04600fd34c152c44be6864eb3bc64568e17

4 days agonetwork: do not regenerate MAC address if already set by userspace
Shihao Ren [Fri, 10 Jul 2026 07:26:27 +0000 (15:26 +0800)] 
network: do not regenerate MAC address if already set by userspace

When MACAddress= is unspecified, a stable MAC is generated to seed a newly
created netdev. Since existing netdevs are reconfigured on reload/restart,
this seed got re-applied to an already existing interface, conflicting with
an explicit MACAddress= from the matching .network file and flipping MAC.

Now, when MACAddress= is unspecified, only generate a new address if
addr_assign_type is not NET_ADDR_SET (i.e. not already set by userspace). On
first creation the interface does not exist yet, so this is a no-op and the
address is generated as before. Mirrors src/udev/net/link-config.c.

Fixes: #42457
4 days agocreds-util: implement TPM2 SRK pinning
Popax21 [Thu, 19 Mar 2026 02:33:26 +0000 (03:33 +0100)] 
creds-util: implement TPM2 SRK pinning

Stores the TPM2 SRK within the credential header, allowing for parameter decryption to be utilized when decrypting the credential.
A new dimension is added to the credential ID matrix to encode this capability.

This also allows for usage of TPM2-bound credentials when a TPM owner password is set since `Esys_CreatePrimary` is no longer used for sealing credentials.

4 days agocreds: allow normal users to encrypt with`--with-key=null`
Michael Vogt [Fri, 10 Jul 2026 15:27:11 +0000 (17:27 +0200)] 
creds: allow normal users to encrypt with`--with-key=null`

When encrypting with the `--with-key=null` option systemd-creds
is currently doing the encryption via IPC. This is not needed
for the null key, no privs are required so we can just do the
in-process operation. So instead simply check for the null-key and
if its requested use the in-process path.

4 days agoman: run forgotten 'update-man-rules'
Lennart Poettering [Tue, 7 Jul 2026 10:58:50 +0000 (12:58 +0200)] 
man: run forgotten 'update-man-rules'

5 days agomkosi: update debian commit reference to b322b8d98e0192763aa711dc2aa2f98d8276aae3
Luca Boccassi [Fri, 10 Jul 2026 13:39:08 +0000 (14:39 +0100)] 
mkosi: update debian commit reference to b322b8d98e0192763aa711dc2aa2f98d8276aae3

b322b8d98e Install new files for upstream build
3fd1b81c94 Update changelog for 261.1-3 release
8f95f1370c Move modules-load from systemd package to udev package
bcdf90c670 debian/libpam-systemd.postinst: pam-auth-update does not use getopt
743e3399ac d/README.source: document policy for adding new binary packages
cbea74783c Install new files for upstream build
ef267b3ad6 debian/libpam-systemd.postinst: run pam-auth-update with --root=$DPKG_ROOT
54df2859b4 d/t/upstream: use mkosi from archive for Ubuntu autopkgtest
21959e8a59 Fix zsh installation path, again
f01dddb047 Fix zsh installation path
e31737edc4 Install new files for upstream build
ca0630a51e Update changelog for 261.1-2 release
1ebb987599 d/t/control: pull in cpio for upstream suite
fcf5a24f47 Two more fixups for d/copyright
6ad198086d d/t/control: pull new packages in upstream test suite
bb9fd757fd Make systemd actually temporarily depend on systemd-tpm

5 days agosysupdate: enable/disable verb for features and components (#42947)
Lennart Poettering [Fri, 10 Jul 2026 15:23:22 +0000 (17:23 +0200)] 
sysupdate: enable/disable verb for features and components (#42947)

These are the next 3 commits from #42651. Split out again, in the hope
to get a review from claude.

ptal.

full test suite and docs are in #42651. test suite passed there.

5 days agoobs: explicitly disable Ubuntu/i586 builds
Luca Boccassi [Fri, 10 Jul 2026 13:01:50 +0000 (14:01 +0100)] 
obs: explicitly disable Ubuntu/i586 builds

i586 is a partial architecture on Ubuntu, so package builds cannot
work, explicitly disable it to avoid visual clutter in the build
report page.

5 days agoman: drop '\r' from systemd-clonesetup.xml
Yu Watanabe [Fri, 10 Jul 2026 12:40:55 +0000 (21:40 +0900)] 
man: drop '\r' from systemd-clonesetup.xml

Follow-up for 104970a8bd7a3b53067f6e50283183406a579f0b.

5 days agocredentials: add policy that can allow key=null creds from the ESP (#42555)
Lennart Poettering [Fri, 10 Jul 2026 12:43:12 +0000 (14:43 +0200)] 
credentials: add policy that can allow key=null creds from the ESP (#42555)

This PR only sets the default to "relaxed" - I can change the default
to "tofu" if desired. But for that we will also need to update the NEWS
file to ensure everyone is aware of this new default.

---

This PR adds a new `systemd.credentials-boot=` kernel
commandline that allows to control if credentials with
a `null` key are accepted.

The possible options are:
* strict: always insist on tpm encryption
* tofu: allow null encryption in firstboot mode and when no tpm is
available
* relaxed: allow null encryption when sb is off, or no tpm is available
* off: allow null encryption always

The default is `relaxed` which is exactly the behavior we had before.

This replaces the initial idea of using plaintext credentials
at firstboot (thanks to Lennart for this nicer and simpler design).

---

With that we can drop `- firstboot: optionally accept credentials at
firstboot without authentication` from TODO.md

5 days agoAdd support for aarch64 CPUFeatures (#42902)
Lennart Poettering [Fri, 10 Jul 2026 12:41:01 +0000 (14:41 +0200)] 
Add support for aarch64 CPUFeatures (#42902)

Extend real_has_cpu_with_flag to support aarch64 CPU Features using
hwcaps.

With this PR, users can find out if their Arm system supports
architecture-specific features such as BTI as follows:

```
$ systemd-analyze condition 'ConditionCPUFeature=bti'
```

5 days agosysupdate: move cleanup verb up close to "vacuum" 42947/head
Lennart Poettering [Wed, 24 Jun 2026 10:52:09 +0000 (12:52 +0200)] 
sysupdate: move cleanup verb up close to "vacuum"

These are philosophically similar concepts: one deletes old versions
based on whether they are old, and the other deletes old files based on
whether they are orphaned, let's list them together.

5 days agosysupdate: tighten component_name_valid() mildly
Lennart Poettering [Fri, 10 Jul 2026 12:36:31 +0000 (14:36 +0200)] 
sysupdate: tighten component_name_valid() mildly

Let's make sure that we can still generate a component enablement
drop-in for any component that might be defined.

5 days agosysupdate: add new enable-component/disable-component verb
Lennart Poettering [Wed, 24 Jun 2026 10:50:29 +0000 (12:50 +0200)] 
sysupdate: add new enable-component/disable-component verb

This mimics the enable-feature/disable-feature verbs, but operates on
whole components, not features.

5 days agosysupdate: add enable-feature/disable-feature verbs
Lennart Poettering [Wed, 24 Jun 2026 10:35:01 +0000 (12:35 +0200)] 
sysupdate: add enable-feature/disable-feature verbs

These do what updatectl's verbs of the same name does, but are
implemented as low-level concepts in sysupdate itself.

(The idea is to eventually wrap this in Varlink IPC, and make updatectl
use them that way.)

5 days agosysupdate: generalize feature name validity check
Lennart Poettering [Fri, 10 Jul 2026 12:34:59 +0000 (14:34 +0200)] 
sysupdate: generalize feature name validity check

Let's switch to string_is_safe(), and make this available to the rest of
the sysupdate sources too.

This both relaxes and tighten the rules slightly. i.e. control character
and stuff are no longer allowed, but valid UTF-8 (as opposed to ASCII)
now is.

5 days agosysupdate: explicitly refuse --root=/--image= in conjunction with --definitions=
Lennart Poettering [Fri, 10 Jul 2026 08:53:12 +0000 (10:53 +0200)] 
sysupdate: explicitly refuse --root=/--image= in conjunction with --definitions=

This is currently effectively not supported (as we sometimes prefix the
definitions path with root and sometimes not), let's make this official
for now and refuse it. We could in theory support the combination but I
don't see the big benefit of it for now, hence let's just refuse it.

5 days agosysupdate: Evaluate all patterns before descending into a subdir
Kai Lüke [Fri, 3 Jul 2026 13:39:22 +0000 (22:39 +0900)] 
sysupdate: Evaluate all patterns before descending into a subdir

When we have two match patterns, e.g., because the repository layout
changed and we look for old and new style files, we can have the case
that one pattern suggests a descend into a subdir but the other pattern
would be a direct match. This was missed and only the descent was done.
Yet the other way round also has to be covered: We can't just use the
direct match because it might be that it's rejected if the type doesn't
fit (directory vs. regular file). In this case we should still descent.

Remember that we want to descend but continue checking the other
pattern first to maybe get a direct match. Introduce a new combined
return code YES_AND_RETRY to give the full information to the caller
which now can decide to fallback to a descent. While at it, use the
stat info for the directory check. Also add tests to ensure that the
order of patterns doesn't matter and we handle the above corner cases.

5 days agosysupdate: Support matching for filenames in subdirectories
Kai Lüke [Thu, 14 May 2026 14:28:38 +0000 (23:28 +0900)] 
sysupdate: Support matching for filenames in subdirectories

While for sysupdate it's fine to consume a large set of all possible
update payloads in a single directory this is not so handy for managing
and serving the update payloads. Since this large update folder is not
where the build output directly gets written to one has to create
copies and later possibly delete this added set of files.

Support matching for filenames in subdirectories by having a new **/
match pattern prefix which matches any number of nested subdirectories
or no subdirectory at all. For simplicity it's only allowed at the start
of a pattern and not a regular wildcard as the rest because the main
use case is to descend into subdirectories and only do the pattern
matching for the basenames. This way one can create a SHA256SUMS file
in the top folder and have it include all update payloads from the
release-specific (or arch-specific) subdirectories. Something similar
was already supported for directory sources where the match pattern can
start with a subdirectory path. Do also support this for SHA256SUMS for
parity while we are at it. Having the new wildcard makes mirroring also
easier because one does not have to follow the exact subdirectory layout
and one can filter by folder instead of by filename. It also makes it
possible to point the same transfer files with the new wildcard to
either a SHA256SUMS file that uses release-specific (or arch-specific)
subdirectories and includes all versions or to a SHA256SUMS file as
generated from mkosi that does not use subdirectories because it only
has files for a single version.
With the upcoming UAPI.16 JSON format we will also be able to encode
subdirectories and it makes sense to add this to SHA256SUMS for being
able to convert them. It also supports custom URLs for each entry which
is more powerful than the (arbitrary) subdirectory feature used here but
subdirectories have the advantage that they don't break mirroring.
This change also fixes the existing subdirectory handling bugs where
everything greater than two subdirectory levels failed to work because
rel_joined instead of de->d_name got used, symlinks were followed, and
we would continue silently on non-ENOENT errors.

5 days agoclonesetup: add support to clone devices via /etc/clonetab
Simran Singh [Wed, 10 Dec 2025 00:44:53 +0000 (06:14 +0530)] 
clonesetup: add support to clone devices via /etc/clonetab

Adds dm-clone device setup at boot via a new /etc/clonetab config file,
following the crypttab/veritytab pattern.

- Add systemd-clonesetup-generator to parse /etc/clonetab and generate units.
- Add systemd-clonesetup binary to create/remove dm-clone devices via ioctl.
- Add clonesetup.target for ordering dm-clone activation at boot.
- Add region_size= option in clonetab to configure dm-clone hydration granularity.
- Add clonetab(5) and systemd-clonesetup-generator(8) man pages.

Fixes: https://github.com/systemd/systemd/issues/39500
5 days agoudev: require exact builtin command matches
dongshengyuan [Thu, 9 Jul 2026 12:30:44 +0000 (20:30 +0800)] 
udev: require exact builtin command matches

Commit 9b917abe02505d4ad09c4963ec5a4b2744eb2fee (udev-builtin:
simplify code a bit) changed builtin lookup from copying the first
command word and comparing it with streq() to comparing only the first
command word length with strneq().

That made prefixes such as "k" or "key" resolve to the "keyboard"
builtin, depending on the builtins table order. This was not the
original behavior.

Require the matched builtin name to end at the first command word
boundary so only complete builtin names are accepted. Arguments after
the builtin name continue to work as before.

5 days agoudev: fix several reproducible command handling issues (#42958)
Yu Watanabe [Fri, 10 Jul 2026 11:04:51 +0000 (20:04 +0900)] 
udev: fix several reproducible command handling issues (#42958)

This PR fixes several independent udev command and rule handling issues.
Each commit contains the corresponding reproducer and fix details.

5 days agoman: document arm64 CPUFeatures 42902/head
Emanuele Rocca [Mon, 6 Jul 2026 12:17:37 +0000 (14:17 +0200)] 
man: document arm64 CPUFeatures

Signed-off-by: Emanuele Rocca <emanuele.rocca@arm.com>
5 days agovirt: support architecture prefixes in CPUFeature
Emanuele Rocca [Fri, 10 Jul 2026 08:26:27 +0000 (08:26 +0000)] 
virt: support architecture prefixes in CPUFeature

Extend ConditionCPUFeature to support architecture prefixes in feature names.
The goal is avoiding ambiguities on mixed-arch fleets, where CPU feature names
may potentially conflict.

With this patch, ConditionCPUFeature=arm64.bti is now equivalent to
ConditionCPUFeature=bti on arm64 systems.

Signed-off-by: Emanuele Rocca <emanuele.rocca@arm.com>
5 days agovirt: add support for aarch64 CPU Features
Emanuele Rocca [Mon, 6 Jul 2026 12:16:12 +0000 (14:16 +0200)] 
virt: add support for aarch64 CPU Features

Extend real_has_cpu_with_flag to support aarch64 CPU Features using hwcaps.

With this patch, users can find out if their Arm system supports
architecture-specific features such as BTI as follows:

$ systemd-analyze condition 'ConditionCPUFeature=bti'

Signed-off-by: Emanuele Rocca <emanuele.rocca@arm.com>
5 days agoinclude: add hwcaps missing from glibc and musl
Emanuele Rocca [Mon, 6 Jul 2026 12:13:31 +0000 (14:13 +0200)] 
include: add hwcaps missing from glibc and musl

Add an override file for all capabilities missing in glibc v2.34 and musl
1.2.6. The constant AT_HWCAP3 is also not in glibc v2.34, ship a glibc-specific
elf.h in order to provide it.

Signed-off-by: Emanuele Rocca <emanuele.rocca@arm.com>
5 days agoOptimize dlopen ELF notes via anchoring and explicitly embed them into executables...
Yu Watanabe [Fri, 10 Jul 2026 08:37:39 +0000 (17:37 +0900)] 
Optimize dlopen ELF notes via anchoring and explicitly embed them into executables (#42908)

This PR optimizes the handling of `dlopen` ELF notes and reduces binary
footprints across the tree.

By enabling compiler section-splitting
(`-ffunction-sections`/`-fdata-sections`), the linker can now accurately
garbage-collect unused code and data. To align with this,
`SD_ELF_NOTE_DLOPEN_ANCHORED()` macro is introduced, which ties `dlopen`
notes to their calling functions so that unused notes are automatically
removed by `--gc-sections`.

Additionally, this explicitly embeds required `dlopen` notes into
individual executables to fix a visibility issue where package managers
missed runtime dependencies invoked indirectly through
`libsystemd-shared.so`.

5 days agorun: recognize clock change timer properties (#42949)
DongShengyuan [Fri, 10 Jul 2026 08:35:19 +0000 (16:35 +0800)] 
run: recognize clock change timer properties (#42949)

--on-clock-change and --on-timezone-change are documented as shortcuts for
setting the corresponding timer properties with --timer-property=.

However, --timer-property= only treated the monotonic and calendar timer
settings as actual timer triggers. OnClockChange= and OnTimezoneChange=
were stored as timer properties, but arg_with_timer remained false and the
command was rejected as having no timer options.

Treat both properties as timer triggers too, matching the shortcut options
and the documented equivalent command line.

5 days agonspawn-oci: match the spec-correct "swappiness" memory field key
hanjinpeng [Wed, 8 Jul 2026 07:07:01 +0000 (03:07 -0400)] 
nspawn-oci: match the spec-correct "swappiness" memory field key

The OCI runtime specification names the memory swappiness knob
"swappiness" (memory.swappiness), but the dispatch table
in oci_cgroup_memory() registered it as "swapiness".

Since sd_json_dispatch_full() matches object keys by exact string
comparison, a spec-correct config carrying "swappiness" never hit the
intended oci_unsupported() handler and was instead routed to the
bad-field callback oci_unexpected(), which returns -EINVAL and thus
fails the whole memory cgroup section.

Register the correct key so that real OCI bundles parse, keep the
misspelt one around for compatibility, mark both as such, and drop the
now-resolved reminder from the file header TODO list.

5 days agoudevadm-info: handle missing data db cleanup 42958/head
dongshengyuan [Fri, 10 Jul 2026 08:09:34 +0000 (16:09 +0800)] 
udevadm-info: handle missing data db cleanup

udevadm info --cleanup-db cleaned links and tags by comparing them
against /run/udev/data, but asserted when that data directory was
missing.

Treat a missing data directory as an empty database, so stale link
and tag entries can be removed without aborting.

Add a database test that runs cleanup-db with links and tags present
but no data directory.

Reproducer:

$ sudo unshare --mount --propagation private sh -c '
mount -t tmpfs tmpfs /run/udev
mkdir -p /run/udev/links/foo
udevadm info --cleanup-db
'
Assertion 'datadir' failed at src/udev/udevadm-info.c:676, function cleanup_dirs_after_db_cleanup(). Aborting.
Aborted (core dumped)

The command should handle a missing /run/udev/data directory instead
of aborting.

5 days agoudevadm-control: reject oversized children-max
dongshengyuan [Fri, 10 Jul 2026 08:08:07 +0000 (16:08 +0800)] 
udevadm-control: reject oversized children-max

The --children-max= option parsed into an unsigned value and then
stored it in an int sentinel field.

Values above INT_MAX could wrap negative and make the command look as
if no control option had been specified.

Reject oversized values before assigning the parsed value.

Reproducer:

$ udevadm control --children-max=2147483648
No control command option is specified.
$ echo $?
1

The value should be rejected as out of range instead of being wrapped
into the unset sentinel value.

5 days agoudev-rules: drop truncated import output line
dongshengyuan [Fri, 10 Jul 2026 08:05:24 +0000 (16:05 +0800)] 
udev-rules: drop truncated import output line

When IMPORT{program} output was truncated, the code intended to drop
the last incomplete result line before importing properties.

It edited the command buffer instead of the output buffer, so the
incomplete line could still be parsed and imported.

Trim the result buffer and cover the behavior with the existing IMPORT
test.

Follow-up for 6b6e471a325bf149839c5c822b4ae3e66cb1d9a3.

Reproducer:

Configure an IMPORT{program} rule whose output exceeds UDEV_LINE_SIZE
and ends with an incomplete property line, for example:

TRUNCATED_OK=yes
TRUNCATED_BAD=<very long value without terminating newline>

Only TRUNCATED_OK should be imported. Before this fix, the truncation
handler edited the command buffer instead of the output buffer, so
TRUNCATED_BAD could still be parsed from the truncated result.

5 days agoudevadm-hwdb: honor root when querying
dongshengyuan [Fri, 10 Jul 2026 08:05:07 +0000 (16:05 +0800)] 
udevadm-hwdb: honor root when querying

The deprecated udevadm hwdb command parsed --root for both update and
test modes, but the test path always queried the host database.

Pass the configured root to hwdb_query() so --root affects --test in
the same way as systemd-hwdb query.

Reproducer:

$ tmp=$(mktemp -d)
$ mkdir -p "$tmp/etc/udev/hwdb.d"
$ printf 'test:codex-root-test\n ID_TEST_CODEX=from-root\n' > "$tmp/etc/udev/hwdb.d/99-codex.hwdb"
$ systemd-hwdb --root="$tmp" update
$ systemd-hwdb --root="$tmp" query test:codex-root-test
ID_TEST_CODEX=from-root
$ udevadm hwdb --root="$tmp" --test=test:codex-root-test
udevadm hwdb is deprecated. Use systemd-hwdb instead.

The last command was expected to print ID_TEST_CODEX=from-root, but
queried the host database instead.

5 days agoudev-rules: accept cvm CONST matches
dongshengyuan [Fri, 10 Jul 2026 08:04:31 +0000 (16:04 +0800)] 
udev-rules: accept cvm CONST matches

CONST{cvm} is documented and already handled when udev rules are
executed, but the parser rejected it before the rule could be used.

Include cvm in the supported CONST key list.

Follow-up for 6e2e83b48734e86992cbdbb329c48cc066cf7c96.

Reproducer:

$ printf 'CONST{cvm}=="none", NAME="x"\n' > /tmp/codex-cvm.rules
$ udevadm verify /tmp/codex-cvm.rules
/tmp/codex-cvm.rules:1 Invalid attribute for CONST.
/tmp/codex-cvm.rules: udev rules check failed.

1 udev rules files have been checked.
  Success: 0
  Fail:    1

5 days agocondition: split condition_test_list() to minimize dlopen dependencies 42908/head
Yu Watanabe [Thu, 9 Jul 2026 03:47:04 +0000 (12:47 +0900)] 
condition: split condition_test_list() to minimize dlopen dependencies

Even though systemd-networkd and systemd-udevd do not support
ConditionSecurity= in .network, .netdev, and .link files, the unified
condition_test() function maintained a function pointer table that
unconditionally referenced condition_test_security(). Consequently,
linker garbage collection (--gc-sections) could not drop the security
test code, inadvertently pulling in dlopen dependencies and ELF notes
for apparmor, audit, and tpm2 libraries into these binaries.

To resolve this, introduce condition_test_net() and condition_test_list_net(),
which utilize a trimmed-down function pointer table that excludes
security-related condition evaluators.

By migrating networkd and udevd to these new network-specific variants,
the reference to condition_test_security() is completely severed in
their dependency chains. This allows the compiler and linker to
successfully garbage-collect the unused security logic and safely drops
the unnecessary dlopen notes from those binaries.

5 days agocompress: split compress_blob() and friends to minimize dlopen dependencies
Yu Watanabe [Thu, 9 Jul 2026 02:17:56 +0000 (11:17 +0900)] 
compress: split compress_blob() and friends to minimize dlopen dependencies

Previously, even though sd-journal does not support bzip2 and gzip
compression, the dlopen ELF notes for those libraries were still being
attached to libsystemd.so and various journal-handling executables.
This occurred because the unified compression/decompression interfaces
handled all formats unconditionally, causing the compiler and linker to
pull in all associated dlopen notes across the board.

To resolve this, split these functions into generic and journal-specific
variants (e.g., introducing compress_blob_journal() and decompress_blob_journal()).
The journal-specific variants only handle formats actually supported by
the journal (LZ4, XZ, and ZSTD).

By updating sd-journal, journald, journalctl, and related utilities to
use these new `_journal` interfaces and switching them to the narrower
COMPRESS_JOURNAL_NOTE macro, we ensure that unnecessary dlopen notes
(for bzip2 and gzip) are no longer embedded into these binaries.

5 days agoci/unit-tests: enable dlopen note verification tests
Yu Watanabe [Tue, 7 Jul 2026 12:09:48 +0000 (21:09 +0900)] 
ci/unit-tests: enable dlopen note verification tests

Enable the `dlopen` unit test suite in GitHub Actions, except for the
following configurations where linker garbage collection (`--gc-sections`)
or dead-code elimination fails to drop unused dlopen symbols:

- ppc64le (both GCC and Clang)
- s390x (GCC only)
- Sanitizer-enabled setups

5 days agotest: add dlopen note checker
Yu Watanabe [Wed, 8 Jul 2026 18:48:33 +0000 (03:48 +0900)] 
test: add dlopen note checker

This introduces a test utility to validate the presence and correctness
of dlopen ELF notes.

The test extracts and compares dlopen ELF notes between the dynamic and
static versions of target binaries to catch missing entries. Furthermore,
it scans the code for dlopen_foo() invocations to ensure that no stale or
unused notes remain in the final binary, thereby verifying the linker's
garbage-collection integration.

5 days agosd-dlopen: introduce _dlopen_loader_ macro to prevent inlining and cloning
Yu Watanabe [Mon, 6 Jul 2026 22:51:50 +0000 (07:51 +0900)] 
sd-dlopen: introduce _dlopen_loader_ macro to prevent inlining and cloning

When compiler optimization or LTO (Link Time Optimization) is enabled,
dlopen helper functions (such as dlopen_libfoo()) can be aggressively
inlined into their callers or cloned for specific call sites.

While this is beneficial for production builds, it alters or completely
removes the original function symbols from the final executable.
Consequently, this breaks the test (to be added in this series) that
checks whether the dlopen_libfoo() function corresponding to a dlopen
ELF note is actually called.

To resolve this, introduce the `_dlopen_loader_` macro. Under developer
builds, it applies the `_noclone_` and `_noinline_` attributes to guarantee
that helper symbols remain intact and discoverable by the test suite. In
production builds, the macro evaluates to nothing, allowing full compiler
optimization to proceed unimpeded.

5 days agotree-wide: embed dlopen notes into individual executables
Yu Watanabe [Mon, 6 Jul 2026 13:08:46 +0000 (22:08 +0900)] 
tree-wide: embed dlopen notes into individual executables

Previously, when a library was dynamically loaded via a helper function
inside libsystemd-shared.so, the resulting dlopen ELF note was not
propagated to the invoking executable's ELF metadata.

This commit explicitly annotates each executable with the relevant
dlopen ELF notes for any optional dependencies it might potentially
load. This ensures that package managers and build systems can properly
discover runtime dependencies that are triggered indirectly.

5 days agoREADME: mention binutils requirement, bump LLVM requirement for ELF note macros
Yu Watanabe [Sat, 4 Jul 2026 20:56:20 +0000 (05:56 +0900)] 
README: mention binutils requirement, bump LLVM requirement for ELF note macros

The new SD_ELF_NOTE_DLOPEN_ANCHORED() macro utilizes the 'o' assembler
flag (SHF_LINK_ORDER), which requires binutils >= 2.35 or LLVM >= 18.
If an LLVM version older than 18 is encountered, the macro automatically
falls back to the non-anchored variant.

This non-anchored fallback relies on the 'R' (SHF_GNU_RETAIN) flag,
which requires binutils >= 2.36 or LLVM >= 13.

Since the codebase now unconditionally adopts SD_ELF_NOTE_DLOPEN_ANCHORED()
tree-wide, the effective minimum toolchain requirements become:
- binutils >= 2.35 (to support the 'o' flag)
- LLVM/Clang >= 13 (to support the 'R' flag fallback for versions < 18)

Update the minimal toolchain versions in the README to reflect these
requirements for building systemd.

5 days agodlopen-note: move all dlopen notes to dlopen-note.h
Yu Watanabe [Mon, 6 Jul 2026 03:16:41 +0000 (12:16 +0900)] 
dlopen-note: move all dlopen notes to dlopen-note.h

This also switches all these notes to be defined via SD_ELF_NOTE_DLOPEN_ANCHORED().
Consequently, any notes added within unreachable or unused functions will be
automatically garbage-collected by the linker (--gc-sections) instead of
bloating the final binary.

E.g. unused p11-kit library dependency is now dropped from
systemd-repart.standalone binary.

Before:
```
$ systemd-analyze dlopen-metadata build/systemd-repart.standalone
FEATURE    DESCRIPTION                                                SONAME                        PRIORITY
cryptsetup Support for disk encryption, integrity, and authentication libcryptsetup.so.12           recommended
blkid      Support for block device identification                    libblkid.so.1                 required
libcrypto  Support for cryptographic operations                       libcrypto.so.4 libcrypto.so.3 recommended
mount      Support for mount enumeration                              libmount.so.1                 required
fdisk      Support for reading and writing partition tables           libfdisk.so.1                 required
blkid      Support for block device identification                    libblkid.so.1                 recommended
libcrypto  Support for cryptographic operations                       libcrypto.so.4 libcrypto.so.3 suggested
cryptsetup Support for disk encryption, integrity, and authentication libcryptsetup.so.12           suggested
fdisk      Support for reading and writing partition tables           libfdisk.so.1                 suggested
idn        Support for internationalized domain names                 libidn2.so.0                  suggested
mount      Support for mount enumeration                              libmount.so.1                 recommended
selinux    Support for SELinux                                        libselinux.so.1               recommended
tpm        Support for TPM                                            libtss2-esys.so.0             suggested
tpm        Support for TPM                                            libtss2-rc.so.0               suggested
tpm        Support for TPM                                            libtss2-mu.so.0               suggested
tpm        Support for TPM                                            libtss2-tcti-device.so.0      suggested
p11-kit    Support for PKCS11 hardware tokens                         libp11-kit.so.0               suggested
```

After:
```
$ systemd-analyze dlopen-metadata build/systemd-repart.standalone
FEATURE    DESCRIPTION                                                SONAME                        PRIORITY
cryptsetup Support for disk encryption, integrity, and authentication libcryptsetup.so.12           recommended
blkid      Support for block device identification                    libblkid.so.1                 required
libcrypto  Support for cryptographic operations                       libcrypto.so.4 libcrypto.so.3 recommended
mount      Support for mount enumeration                              libmount.so.1                 required
fdisk      Support for reading and writing partition tables           libfdisk.so.1                 required
blkid      Support for block device identification                    libblkid.so.1                 recommended
libcrypto  Support for cryptographic operations                       libcrypto.so.4 libcrypto.so.3 suggested
cryptsetup Support for disk encryption, integrity, and authentication libcryptsetup.so.12           suggested
fdisk      Support for reading and writing partition tables           libfdisk.so.1                 suggested
mount      Support for mount enumeration                              libmount.so.1                 recommended
selinux    Support for SELinux                                        libselinux.so.1               recommended
tpm        Support for TPM                                            libtss2-esys.so.0             suggested
tpm        Support for TPM                                            libtss2-rc.so.0               suggested
tpm        Support for TPM                                            libtss2-mu.so.0               suggested
tpm        Support for TPM                                            libtss2-tcti-device.so.0      suggested
```

5 days agosd-dlopen: introduce SD_ELF_NOTE_DLOPEN_ANCHORED() macro
Yu Watanabe [Sat, 4 Jul 2026 20:51:27 +0000 (05:51 +0900)] 
sd-dlopen: introduce SD_ELF_NOTE_DLOPEN_ANCHORED() macro

SD_ELF_NOTE_DLOPEN_ANCHORED() emits a .note.dlopen ELF note that is
"anchored" to a dummy symbol via the SHF_LINK_ORDER ('o') section flag,
in addition to SHF_GROUP ('G') for folding identical notes together.

Unlike the plain SD_ELF_NOTE_DLOPEN() macro, this variant ties the
note's lifetime to a dummy symbol named with the specified tag: if the
linker's --gc-sections removes the function that calls the macro (e.g.
because the function is never referenced), the associated .note.dlopen
entry is garbage-collected along with it.

Currently, the new macro is unused in our code, but all dlopen notes
will be generated with this in later commits.

5 days agotest: drop explicit dlopen notes from test executables
Yu Watanabe [Tue, 7 Jul 2026 00:10:57 +0000 (09:10 +0900)] 
test: drop explicit dlopen notes from test executables

Typically, we do not explicitly set dlopen note on test binaries.

If we should set notes, let's do that consistently later.

5 days agobpf-util: merge two dlopen_bpf() declaration
Yu Watanabe [Mon, 6 Jul 2026 23:02:01 +0000 (08:02 +0900)] 
bpf-util: merge two dlopen_bpf() declaration

No functional change. Just for consistency with other dlopen_libfoo().

5 days agomeson: add -ffunction-sections and -fdata-sections to compiler flags
Yu Watanabe [Sat, 4 Jul 2026 16:32:27 +0000 (01:32 +0900)] 
meson: add -ffunction-sections and -fdata-sections to compiler flags

Enable compiler section splitting for functions and data to allow the
linker's `--gc-sections` optimization to accurately drop unused code.

Note that in highly optimized production builds with Link-Time Optimization
(LTO) enabled (such as `-Db_lto=true`), the compiler already performs
intensive dead-code elimination, resulting in negligible binary size changes
from this change.

However, explicit section splitting provides clear benefits in other areas:
1. Significant size reduction for `.standalone` executables and libraries
   in non-LTO environments.
2. Crucially, it provides the necessary infrastructure for the linker to
   garbage-collect unused `dlopen` metadata notes implemented in subsequent
   commits, ensuring precise dependency tracking regardless of the LTO state.

Below is a binary size comparison (unstripped) across different build types:
- `build-debug`: `-Dbuildtype=debug`
- `build-plain`: `-Dbuildtype=plain` (without LTO)
- `build-plain-lto`: `-Dbuildtype=plain -Db_lto=true`

Before:
```
-rwxr-xr-x 1 watanabe watanabe 6143952 Jul 10 03:10 build-debug/libsystemd.so.0.44.0
-rwxr-xr-x 1 watanabe watanabe  830224 Jul 10 03:10 build-debug/systemd-repart
-rwxr-xr-x 1 watanabe watanabe 9107880 Jul 10 03:10 build-debug/systemd-repart.standalone
-rwxr-xr-x 1 watanabe watanabe 3581856 Jul 10 03:11 build-plain-lto/libsystemd.so.0.44.0
-rwxr-xr-x 1 watanabe watanabe  515536 Jul 10 03:11 build-plain-lto/systemd-repart
-rwxr-xr-x 1 watanabe watanabe 5017000 Jul 10 03:11 build-plain-lto/systemd-repart.standalone
-rwxr-xr-x 1 watanabe watanabe 3352616 Jul 10 03:11 build-plain/libsystemd.so.0.44.0
-rwxr-xr-x 1 watanabe watanabe  515232 Jul 10 03:11 build-plain/systemd-repart
-rwxr-xr-x 1 watanabe watanabe 5103176 Jul 10 03:11 build-plain/systemd-repart.standalone
```

After:
```
-rwxr-xr-x 1 watanabe watanabe 5424064 Jul 10 03:04 build-debug/libsystemd.so.0.44.0
-rwxr-xr-x 1 watanabe watanabe  850880 Jul 10 03:04 build-debug/systemd-repart
-rwxr-xr-x 1 watanabe watanabe 7138496 Jul 10 03:04 build-debug/systemd-repart.standalone
-rwxr-xr-x 1 watanabe watanabe 3581856 Jul 10 03:06 build-plain-lto/libsystemd.so.0.44.0
-rwxr-xr-x 1 watanabe watanabe  515536 Jul 10 03:06 build-plain-lto/systemd-repart
-rwxr-xr-x 1 watanabe watanabe 5017000 Jul 10 03:06 build-plain-lto/systemd-repart.standalone
-rwxr-xr-x 1 watanabe watanabe 2321048 Jul 10 03:06 build-plain/libsystemd.so.0.44.0
-rwxr-xr-x 1 watanabe watanabe  514056 Jul 10 03:06 build-plain/systemd-repart
-rwxr-xr-x 1 watanabe watanabe 2716264 Jul 10 03:06 build-plain/systemd-repart.standalone
```

5 days agomeson: support building .standalone variants for shared modules
Yu Watanabe [Wed, 8 Jul 2026 19:30:10 +0000 (04:30 +0900)] 
meson: support building .standalone variants for shared modules

Extend the module building logic to automatically generate '.standalone'
variants for non-NSS/PAM shared modules (such as cryptsetup tokens).

Like standalone executables, these are not built by default to keep
the base build time unaffected, but can be built explicitly on demand
via `ninja <module_name>.standalone`.

5 days agomeson: automate .standalone variant generation via extended 'install' field
Yu Watanabe [Wed, 8 Jul 2026 19:16:02 +0000 (04:16 +0900)] 
meson: automate .standalone variant generation via extended 'install' field

Extend the 'install' keyword for executable definitions to accept four
modes—'yes', 'no', 'both', and 'static'—to elegantly manage the creation
and installation of both shared and statically-linked (.standalone) binaries.

- 'yes' / 'no': Standard behavior (mapped to true/false).
- 'both': Installs both the shared and static variants.
- 'static': Installs the static variant under the original name, while
  suffixing the uninstalled shared variant with '.shared'.

With this change, any arbitrary executable can now have its `.standalone`
variant built on demand simply by invoking `ninja <target>.standalone`.
For example, `varlinkctl` did not previously support a standalone variant,
but it can now be built explicitly via `ninja varlinkctl.standalone`.

These `.standalone` binaries are not built by default unless explicitly
specified as a ninja target or enabled via `-Dstandalone-binaries=true`.
Thus, the default build time should remain unaffected.

This centralisation eliminates a massive amount of boilerplate and duplicated
target declarations across almost all subdirectories (e.g., systemd-repart,
systemd-tmpfiles, systemd-shutdown, and systemd-report tools).

5 days agoimport: drop redundant oci-util.c from sources
Yu Watanabe [Mon, 6 Jul 2026 14:40:01 +0000 (23:40 +0900)] 
import: drop redundant oci-util.c from sources

It is already listed in the 'export' field.

5 days agodns-configuration: make dns_scope_free() static
Yu Watanabe [Mon, 6 Jul 2026 14:38:01 +0000 (23:38 +0900)] 
dns-configuration: make dns_scope_free() static

systemd-resolved already has a dns_scope_free() function in
resolved-dns-scope.c for DnsScope. Since the one in dns-configuration.c
is only used internally, make it static.

This is necessary to allow systemd-resolved to be statically linked
with libsystemd-shared without symbol conflicts.

5 days agocreds: Use ERRNO_IS_NEG_TPM2_UNSEAL_BAD_PCR
Kai Lüke [Mon, 6 Jul 2026 13:58:39 +0000 (22:58 +0900)] 
creds: Use ERRNO_IS_NEG_TPM2_UNSEAL_BAD_PCR

The error set was duplicated, use the macro.

5 days agocryptsetup: Give NV index missing its own error code
Kai Lüke [Mon, 6 Jul 2026 13:54:38 +0000 (22:54 +0900)] 
cryptsetup: Give NV index missing its own error code

To be able to continue trying other tokens to unlock a disk the missing
NV index case was mapped to EREMOTE (foreign TPM) which was ok because
this mostly happens when trying to unlock on another system. Still it
might be useful to deal with NV index errors differently.
Give it its own EADDRNOTAVAIL error and handle it at all call sites.

5 days agocryptsetup: Skip tokens with JSON parsing errors
Kai Lüke [Thu, 2 Jul 2026 13:49:46 +0000 (22:49 +0900)] 
cryptsetup: Skip tokens with JSON parsing errors

The plugin already continues on parsing errors but the fallback path
not. The plugin swallows ENOMEM as well which is too much, though.
Continue on JSON parsing errors by mapping them to EUCLEAN in
cryptsetup_get_token_as_json and handle that in any call site, not just
the TPM fallback path but also others.

5 days agocryptsetup: Reduce log level for TPM mismatches
Kai Lüke [Mon, 29 Jun 2026 14:26:37 +0000 (23:26 +0900)] 
cryptsetup: Reduce log level for TPM mismatches

When we iterate over tokens we should not print mismatches as errors
but rather warnings. At the end there is still a summary with the
notice level (gated by found_some) which the user can relate to the
warnings.

5 days agocryptsetup: Remap bad PCR set early to EPERM
Kai Lüke [Mon, 20 Apr 2026 14:07:13 +0000 (23:07 +0900)] 
cryptsetup: Remap bad PCR set early to EPERM

Currently libcryptsetup's look treats ENOANO special because it's used
to signal PIN requirement. But the bad PCR set can also contain ENOANO
for a mismatch from a PolicyOR branch.
To continue iterating, remap the bad PCR set to EPERM early. This would
in theory also allow us to simplify the matching for the iteration
condition but we leave this as is for now to prevent a future
regression.

5 days agoTEST-70-TPM2.cryptsetup: Make sure we iterate over foreign tokens
Kai Lüke [Mon, 20 Apr 2026 13:38:13 +0000 (22:38 +0900)] 
TEST-70-TPM2.cryptsetup: Make sure we iterate over foreign tokens

When we enroll two UKIs with different PCR pub keys into one LUKS slot/
token each, we can encounter the wrong one and should not give up
but continue iterating.

5 days agotpm2-util: Also report EREMOTE if key is for different parent template
Kai Lüke [Mon, 20 Apr 2026 13:22:16 +0000 (22:22 +0900)] 
tpm2-util: Also report EREMOTE if key is for different parent template

We already report foreign TPM keys (wrapped for different parent) but
this is not enough because when also a different template was used, we
don't get TPM2_RC_INTEGRITY but TPM2_RC_SIZE.
Also cover TPM2_RC_SIZE to report EREMOTE so that we can continue to
iterate over LUKS tokens instead of giving up.

5 days agotpm2-util: For NV index errors report EREMOTE to be able to continue
Kai Lüke [Mon, 20 Apr 2026 11:27:59 +0000 (20:27 +0900)] 
tpm2-util: For NV index errors report EREMOTE to be able to continue

When we have many LUKS slots and not all are for our TPM, we can get an
NV index error when it's missing or has wrong content.
Instead of fully erroring out, map these encounters to EREMOTE like we
do for a foreign TPM key.

5 days agotpm2-util: Align tpm2_import with tpm2_load to report on foreign keys
Kai Lüke [Mon, 20 Apr 2026 09:45:22 +0000 (18:45 +0900)] 
tpm2-util: Align tpm2_import with tpm2_load to report on foreign keys

When we encounter a key for a foreign TPM we report that as EREMOTE in
tpm2_load but not yet in tpm2_import. This causes cryptsetup to give up
on using the TPM instead of being able to continue with out tokens.
Do the same mapping as in tpm2_load in tpm2_import to report EREMOTE on
foreign keys.

5 days agocryptsetup/cryptenroll: Iterate over TPM tokens when they don't match
Kai Lüke [Mon, 20 Apr 2026 06:55:57 +0000 (15:55 +0900)] 
cryptsetup/cryptenroll: Iterate over TPM tokens when they don't match

When we enroll two UKIs with different PCR pub keys into one LUKS slot/
token each, then we can encounter the wrong one and should not give up
but continue iterating instead of requiring the passphrase. Similarly,
a pcrlock token might be for another UKI and we should continue the
search. Same for a token that is meant for another TPM (e.g., external
storage). While this is mainly about cryptsetup's automatic unlocking
from the initrd, it also matters for usage in the system, e.g., for
other storage and when cryptenroll should unlock using the TPM.
There are two code paths, one is the libcryptsetup plugin and the other
is the fallback when that's not available.
To let the libcryptsetup loop continue to iterate, remap the above
error conditions to EPERM. For the fallback path check all of them (no
remapping) and continue iteration. For better log output, include the
token ID to be able understand which token fails.

5 days agocryptsetup: Report mismatching TPM token error separately
Kai Lüke [Mon, 20 Apr 2026 06:47:45 +0000 (15:47 +0900)] 
cryptsetup: Report mismatching TPM token error separately

When we enroll two UKIs with different PCR pub keys into one LUKS slot/
token each, then we can encounter the wrong one and should report it
with a clearer error than the generic "Failed to unseal secret using
TPM2".
So when we don't have the right signature, report this as separate
error.

5 days agostub: Set up all detected consoles
Kai Lüke [Thu, 9 Jul 2026 08:35:42 +0000 (17:35 +0900)] 
stub: Set up all detected consoles

With no console= given the kernel will use the graphical console and if
we give one console= then that will be used instead. But sometimes we
want both a serial console and a graphical one to work. This would be
consistent with the EFI menu and sd-boot showing on both already. It
also makes the impact of a wrongly detected-but-missing VirtIO console
lower when we emit it alongside of the other consoles we detect.

Collect all detected consoles and emit them via console= with the same
priority we used before to select them. This means for the main console
there is no change but we get additional ones enabled. This helps with
boot output and having a login presented, yet the main console is still
special and gets the emergency output at boot (we should somehow surface
that on the additional consoles but that's another topic). If we only
see the graphical console (or none), we don't need to emit anything a
the kernel already selects it itself. This also avoids suppressing the
non-x86 kernel serial console detection. As mentioned above, the VirtIO
console being wrongly added is now also less impactful. But for non-x86
ACPI case we could detect the serial so that console=hvc0 won't stop the
kernel serial auto-detection.

5 days agomount-util/sysext: Clone sub mounts as private to preserve nested ones
Kai Lüke [Wed, 29 Apr 2026 14:53:40 +0000 (23:53 +0900)] 
mount-util/sysext: Clone sub mounts as private to preserve nested ones

When nested mounts appear under a sysext hierarchy like this:
  mkdir -p /opt/trigger/
  mount -t tmpfs tmpfs /opt/trigger
  mkdir -p /opt/trigger/inner
  mount -t tmpfs tmpfs /opt/trigger/inner
Then systemd-sysext merge will lose the inner mount because it uses a
regular bind mount with propagation and then unmounts the source,
unmounting all children with it which propagates (as found out in
https://github.com/flatcar/Flatcar/issues/2111).
To solve this, clone the sub mount with MS_PRIVATE to decouple sub
mounts from the original mount. Then attach the cloned mount instead of
doing regular bind mounts. For old kernels we still attach the cloned
mount but we fallback to cloning without MS_PRIVATE. This change also
affects mount_private_apivfs which is used for private /proc, /sys, and
cgroupfs but I think it makes sense there, too, instead of only doing
mount_setattr for sysext alone because, e.g., a container and the host
should not be leaking mount actions into each other for these mounts.

5 days agomount-util: Compact list of sub mounts after dropping
Kai Lüke [Wed, 29 Apr 2026 13:04:51 +0000 (22:04 +0900)] 
mount-util: Compact list of sub mounts after dropping

When nested mounts appear under a sysext hierarchy like this:
  mkdir -p /opt/trigger/
  mount -t tmpfs tmpfs /opt/trigger
  mkdir -p /opt/trigger/inner
  mount -t tmpfs tmpfs /opt/trigger/inner
Then systemd-sysext merge hit an assertion reported in
https://github.com/flatcar/Flatcar/issues/2111 because when it iterates
over the list of sub mounts it doesn't expect entries with NULL in the
path from the dropped entries.
Instead of having to deal with entries with path NULL, better sort the
holes from dropping to the end and then reduce the array length.

5 days agoTranslations update from Fedora Weblate (#42956)
Luca Boccassi [Thu, 9 Jul 2026 20:09:47 +0000 (21:09 +0100)] 
Translations update from Fedora Weblate (#42956)

Translations update from [Fedora
Weblate](https://translate.fedoraproject.org) for
[systemd/main](https://translate.fedoraproject.org/projects/systemd/main/).

Current translation status:

![Weblate translation
status](https://translate.fedoraproject.org/widget/systemd/main/matrix-auto.svg)

5 days agopo: Translated using Weblate (Serbian) 42956/head
Марко Костић (Marko Kostić) [Thu, 9 Jul 2026 19:17:57 +0000 (19:17 +0000)] 
po: Translated using Weblate (Serbian)

Currently translated at 100.0% (286 of 286 strings)

Co-authored-by: Марко Костић (Marko Kostić) <marko.m.kostic@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/sr/
Translation: systemd/main

5 days agopo: Translated using Weblate (Portuguese (Brazil))
Rafael Fontenelle [Thu, 9 Jul 2026 19:17:57 +0000 (19:17 +0000)] 
po: Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (286 of 286 strings)

Co-authored-by: Rafael Fontenelle <rafaelff@gnome.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/pt_BR/
Translation: systemd/main

5 days agopo: Translated using Weblate (Czech)
Pavel Borecki [Thu, 9 Jul 2026 19:17:57 +0000 (19:17 +0000)] 
po: Translated using Weblate (Czech)

Currently translated at 100.0% (286 of 286 strings)

Co-authored-by: Pavel Borecki <pavel.borecki@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/cs/
Translation: systemd/main

5 days agopo: Translated using Weblate (Czech)
Honza Hejzl [Thu, 9 Jul 2026 19:17:56 +0000 (19:17 +0000)] 
po: Translated using Weblate (Czech)

Currently translated at 100.0% (286 of 286 strings)

Co-authored-by: Honza Hejzl <jan.hejzl@posteo.net>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/cs/
Translation: systemd/main

6 days agobasic: update in_first_boot() to return an error 42555/head
Michael Vogt [Fri, 3 Jul 2026 15:28:45 +0000 (17:28 +0200)] 
basic: update in_first_boot() to return an error

This commit tweaks the in_first_boot() code to make it
a proper shared helper. It tweaks the comments about the
caching policy. This is important because while this is
simialr to `in_initrd()` there is a suble difference:
we never cache the result of access() because other parts
of systemd will use this file to signal if anything about
firstboot changes.

This also tweaks it to return an int instead of a bool.
So any error is returned as -errno. This allows other
parts of systemd (like the random-seed) that need to make
decisions about "unknown" first-boot state.

This also means that the consumers need to get updated
and we can now also use the new helper in random-seed-tool.c
and have only a single helper to check for first-boot.

6 days agocore: make `/run/systemd/first-boot` available earlier
Michael Vogt [Fri, 3 Jul 2026 15:37:31 +0000 (17:37 +0200)] 
core: make `/run/systemd/first-boot` available earlier

For the new systemd.credentials_boot_policy= setting we need
to be able to differenciate if its a firstboot or not early.

But `manager_set_first_boot` is run after `initialize_runtime()`
which imports the credentials. So we need to touch the file
so that the credentials_boot_policy setting can work.

Unfortunately we cannot just move manager_set_first_boot() earlier
because there is no manager yet at this point.

6 days agocredentials: add policy that can allow key=null creds from the ESP
Michael Vogt [Wed, 10 Jun 2026 11:02:01 +0000 (13:02 +0200)] 
credentials: add policy that can allow key=null creds from the ESP

This commit adds a new `systemd.credentials_boot_policy=` kernel
commandline that allows to control if credentials with
a `null` key are accepted.

The possible options are:
* strict: always insist on tpm encryption
* tofu: allow null encryption in firstboot mode and when no tpm is available
* relaxed: allow null encryption when sb is off, or no tpm is available
* off: allow null encryption always

The default is currently `relaxed` which is the same behavior
as before.

This replaces the initial idea of using plaintext credentials
at firstboot (thanks to Lennart for this nicer and simpler design).

Note that this also moves `in_first_boot()` to `basic/initrd-util`
which is a better fit now.

6 days agosysupdate: handle slashes after pattern fields
dongshengyuan [Mon, 6 Jul 2026 05:40:26 +0000 (13:40 +0800)] 
sysupdate: handle slashes after pattern fields

Patterns such as foo_@v/bar.efi are documented to
match files in versioned subdirectories,
but pattern_match() assumed that a field is
always followed by a literal when another element exists.

Handle a following slash as a delimiter too,
and request another recursion step
when the current path ends before that slash.

Fixes #42895.
Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
6 days agotree-wide: fix some double word errors like "the the"
Michael Vogt [Thu, 9 Jul 2026 10:34:01 +0000 (12:34 +0200)] 
tree-wide: fix some double word errors like "the the"

By chance (because I had this mistake in my own commit) I noticed
that there are a bunch of duplicated works like "the the" in the
code and man-pages.

This commit fixes them and some similar issues with "and and" etc.

6 days agocore: connect to sockets in credential directories
dongshengyuan [Mon, 6 Jul 2026 06:05:28 +0000 (14:05 +0800)] 
core: connect to sockets in credential directories

Recursive credential directory loading intentionally
includes socket entries, but load_credential()
only enabled AF_UNIX socket handling for absolute paths.

Let the recursive directory path request socket
connections explicitly, and update the stale comment for directory-fd reads.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
6 days agounits: properly wait for swtpm to finish before the initrd transition
Lennart Poettering [Thu, 9 Jul 2026 09:26:36 +0000 (11:26 +0200)] 
units: properly wait for swtpm to finish before the initrd transition

Hopefully fixes: #42936

6 days agosysupdate: load a per-component *.component file (#42935)
Lennart Poettering [Thu, 9 Jul 2026 10:21:28 +0000 (12:21 +0200)] 
sysupdate: load a per-component *.component file (#42935)

This is split out of #42651, because for some reason Claude refuses to
review that PR, probably because it's too large. Hence let's try this
piecemeal.

This has integration tests in #42651 (which passed). And docs too.

6 days agoAssorted logind hardening fixes flagged by kres (#42879)
Lennart Poettering [Thu, 9 Jul 2026 09:07:06 +0000 (11:07 +0200)] 
Assorted logind hardening fixes flagged by kres (#42879)

6 days agopcrlock: handle piped PE input
dongshengyuan [Mon, 6 Jul 2026 04:55:40 +0000 (12:55 +0800)] 
pcrlock: handle piped PE input

When lock-pe or lock-uki read from stdin,
copy non-regular input to a seekable temporary fd before hashing it.

Fixes #42893.
Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
6 days agodissect: do not follow copy-to directory symlinks
dongshengyuan [Tue, 7 Jul 2026 11:11:06 +0000 (19:11 +0800)] 
dissect: do not follow copy-to directory symlinks

When copying a directory into an image, open an existing destination
with O_NOFOLLOW before passing it to copy_tree_at(). This rejects a
symlink used as the final destination component without a separate
stat-before-use check.

Previously the pre-opened destination followed that symlink. That
allowed --copy-to to be redirected outside the image root when the
image was a directory tree.

If the destination does not exist yet, keep delegating creation to
copy_tree_at(). Real existing directories still use COPY_MERGE through
the opened directory fd.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
6 days agoAssorted coverity fixes (#42933)
Lennart Poettering [Thu, 9 Jul 2026 09:01:03 +0000 (11:01 +0200)] 
Assorted coverity fixes (#42933)

6 days agoshared: fix DNS RR wire cache and EFI boot option bounds checks (#42926)
Lennart Poettering [Thu, 9 Jul 2026 09:00:29 +0000 (11:00 +0200)] 
shared: fix DNS RR wire cache and EFI boot option bounds checks (#42926)

Invalidate cached DNS RR wire format when
`dns_resource_record_clamp_ttl()` updates `rr->ttl` in place.
Validate each EFI `Boot####` device-path node length before reading
subtype-specific fields.

6 days agoAssorted journal/portable hardening fixes flagged by kres (#42915)
Lennart Poettering [Thu, 9 Jul 2026 08:59:02 +0000 (10:59 +0200)] 
Assorted journal/portable hardening fixes flagged by kres (#42915)

6 days agojournal-remote: do not create /var/log/journal/remote (#42937)
Lennart Poettering [Thu, 9 Jul 2026 08:55:13 +0000 (10:55 +0200)] 
journal-remote: do not create /var/log/journal/remote (#42937)

This handling with tmpfiles was dropped in
29444df23bea21c15a3284ad8acfe2f008e5dbae. So let's stop the build system
to create that directory. Actually it is create by the service just
fine, including correct access mode.

6 days agostub: Prefer graphical console over virtio detection heuristic
Kai Lüke [Wed, 8 Jul 2026 15:25:11 +0000 (00:25 +0900)] 
stub: Prefer graphical console over virtio detection heuristic

With vmspawn --console=gui and similar one has the case where the VirtIO
PCI device is present for something else than the console and the logic
in sd-stub added console=hvc0 even though it didn't exist. This caused
tty0 to be empty during boot.
Always prefer the graphical console before a potential virtio console.
The virtio console is still preferred over a serial console and we can
get the same problem there, e.g., qemu-guest-agent is used causing the
PCI device but without a virtio console and instead a serial console is
used. This is not solved here.