]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
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 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 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.

6 days agologind: set session->started before seat_read_active_vt() call
countgitmick [Thu, 9 Apr 2026 07:53:03 +0000 (00:53 -0700)] 
logind: set session->started before seat_read_active_vt() call

session_start() calls seat_read_active_vt() before setting
s->started = true. seat_read_active_vt() can reach
seat_triggered_uevents_done() synchronously via:

  seat_active_vt_changed -> seat_set_active -> seat_trigger_devices
  -> seat_triggered_uevents_done

When seat_trigger_devices() produces no pending uevents,
seat_triggered_uevents_done() runs in the same call stack as
session_start() and tests session->started before the assignment
further down. The check fails, session_device_resume_all() is
skipped, and the compositor never receives DRM master.

Set started before seat_read_active_vt() so the gate sees the
correct value, and document the ordering constraint at the call
site to prevent regression.

Reproducible with greetd plus a Wayland compositor on the same VT
on kernel 6.19+.

Fixes: #41562
Signed-off-by: countgitmick <263313427+countgitmick@users.noreply.github.com>
6 days agosysupdate: show component description and enablement in 'systemd-sysupdate components... 42935/head
Lennart Poettering [Wed, 24 Jun 2026 10:18:31 +0000 (12:18 +0200)] 
sysupdate: show component description and enablement in 'systemd-sysupdate components' call

This is losely based on the features output, but shows the new metadata
for components.

6 days agosysupdate: optionally load a per-component *.component file
Lennart Poettering [Thu, 18 Jun 2026 16:02:37 +0000 (18:02 +0200)] 
sysupdate: optionally load a per-component *.component file

This file can be used for metadata about a component. It may also be
used to "disable" a component.

This brings components as a concept to a similar conceptual level as
features: both can be enabled/disabled, and carry metadata

6 days agojournal-remote: do not create /var/log/journal/remote 42937/head
Christian Hesse [Wed, 8 Jul 2026 17:37:38 +0000 (19:37 +0200)] 
journal-remote: do not create /var/log/journal/remote

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 agomkosi: update arch commit reference to f884cb080300eeb273fb7549fd0aa19bb6142c21
Christian Hesse [Thu, 9 Jul 2026 07:08:45 +0000 (09:08 +0200)] 
mkosi: update arch commit reference to f884cb080300eeb273fb7549fd0aa19bb6142c21

6 days agoefi-api: validate boot option device path lengths 42926/head
dongshengyuan [Thu, 9 Jul 2026 00:39:03 +0000 (08:39 +0800)] 
efi-api: validate boot option device path lengths

efi_get_boot_option() validates the overall Boot#### variable size and
the advertised device-path byte count, but then walks each device-path
node without first checking that the node header and subtype payload fit
in the remaining buffer.

A malformed Boot#### variable could make the parser read past the end of
the current node, or past the available device-path data.

Limit parsing to the bytes that are actually present, and stop walking
the device path when a malformed node is encountered. This keeps the
previous best-effort behaviour for fields parsed before the anomaly while
avoiding out-of-bounds reads.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
6 days agodns-rr: invalidate wire format after changing ttl
dongshengyuan [Thu, 9 Jul 2026 00:35:03 +0000 (08:35 +0800)] 
dns-rr: invalidate wire format after changing ttl

dns_resource_record_clamp_ttl() may patch the TTL in place when the
record has a single reference. dnssec_fix_rrset_ttl() also updates TTLs
after canonical wire-format data may have been cached.

If a record already has cached wire-format data, that cache still
contains the old TTL and dns_resource_record_to_wire_format() will keep
reusing it.

Add a small helper to clear the cached wire-format state, and use it
whenever the TTL changes. This makes subsequent serialization match the
record fields.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
6 days agotmpfiles: add hardening in glob_item_recursively
Andres Beltran [Wed, 8 Jul 2026 19:06:16 +0000 (19:06 +0000)] 
tmpfiles: add hardening in glob_item_recursively

6 days agosocket-util: fix socket_xattr_supported() in initramfs
Michal Sekletar [Tue, 30 Jun 2026 13:19:27 +0000 (15:19 +0200)] 
socket-util: fix socket_xattr_supported() in initramfs

Don't test xattr support on socket created in filesystem. This doesn't
work in initramfs when /tmp doesn't have tmpfs mounted inside as
initramfs doesn't have xattr support. Setting socket xattr falls back to
parent directory xattr handlers when we work with FS based socket.

Let's test sockfs based socket instead so that the check is generic and
works in all environments.

6 days agoresolved: honour per-link DNSOverTLS=yes for certificate verification
Luca Boccassi [Fri, 24 Apr 2026 21:03:17 +0000 (22:03 +0100)] 
resolved: honour per-link DNSOverTLS=yes for certificate verification

dnstls_stream_connect_tls() reads the manager-wide dns_over_tls_mode
field directly, so when the global mode was 'no' or 'opportunistic' but
a link was configured with strict DNSOverTLS=yes, the DoT connection
was established without SSL_VERIFY_PEER or hostname/IP checks.
Use dns_server_get_dns_over_tls_mode() which honours the per-link
override.

6 days agopcrlock: add vl method for list-components
Luca Boccassi [Mon, 6 Jul 2026 18:52:13 +0000 (19:52 +0100)] 
pcrlock: add vl method for list-components

Add varlink method wrapper for list-components verb.

6 days agosd-event: use CLOCK_BOOTTIME for rate limits
Frantisek Sumsal [Tue, 7 Jul 2026 15:22:49 +0000 (17:22 +0200)] 
sd-event: use CLOCK_BOOTTIME for rate limits

When a rate limit is armed, for example via StartLimitInterval=, and the
machine is suspended, the rate limit's "clock" is suspended as well,
since the elapse checks use CLOCK_MONOTONIC. This then causes unexpected
situations where a rate limit armed via StartLimitInterval=1h, followed
by a 10 hour suspend, would elapse after 11 hours total.

Let's avoid this by switching the rate limits to CLOCK_BOOTTIME, which
works the same as CLOCK_MONOTONIC, but accounts for the time spent in
suspend as well.

There's one slight concern when it comes to upgrade path - the old
"begin" value of the rate limit is stored as CLOCK_MONOTONIC, but after
upgrading systemd and serializing/deserializing the state it will be
suddenly compared against now(CLOCK_BOOTTIME), which might cause some
rate limits to elapse "prematurely". But this is just a one-time thing,
after which the rate limit timers should re-assess themselves.

Resolves: #42912

6 days agocreds-util: log when we remove a secret from a different machine
Lương Việt Hoàng [Tue, 7 Jul 2026 06:38:13 +0000 (13:38 +0700)] 
creds-util: log when we remove a secret from a different machine

7 days agosd-device: check fd validity before using in sendmsg in test 42933/head
Luca Boccassi [Wed, 8 Jul 2026 09:57:39 +0000 (10:57 +0100)] 
sd-device: check fd validity before using in sendmsg in test

CID#1663676

Follow-up for 7003a9bf098869e5622fe5d863199910afcdda6d

7 days agodns-rr: fix SOA JSON fields
dongshengyuan [Wed, 8 Jul 2026 06:03:15 +0000 (14:03 +0800)] 
dns-rr: fix SOA JSON fields

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
7 days agofsck: don't apply invalid mode or repair values
dongshengyuan [Wed, 8 Jul 2026 08:53:30 +0000 (16:53 +0800)] 
fsck: don't apply invalid mode or repair values

fsck_mode_from_string() and fsck_repair_from_string() return -EINVAL
on a bad value. Store the result in a local variable first, and only
update the global state on success.

Otherwise an invalid value is logged as ignored, but still leaves a
negative enum value behind. In the fsck.repair case that makes
fsck_repair_option_to_string() return NULL and truncates the fsck
command line.

Follow-up for a85428b1d325654dc7e1afbabf4b689bd31116f5
Follow-up for 059afcadfd89c6c302f20c9ac1a1c44592b716df

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
7 days agobootctl: Fix prepend when installing systemd-boot for the first time
Elliot Berman [Tue, 7 Jul 2026 23:28:10 +0000 (16:28 -0700)] 
bootctl: Fix prepend when installing systemd-boot for the first time

In commit 38433a6d06ef ("bootctl: rework bootctl-install.c in preparation of varlinkification"),
the `first` argument of install_boot_option() was reworked to use the
new InstallContext struct/InstallOperation. `first` was intended to
indicate if we were on the install path, so the check should be
== INSTALL_NEW, not != INSTALL_NEW.

Fixes: 38433a6d06ef ("bootctl: rework bootctl-install.c in preparation of varlinkification")
7 days agosd-bus: voidify bus_match_remove call
Luca Boccassi [Wed, 8 Jul 2026 09:54:00 +0000 (10:54 +0100)] 
sd-bus: voidify bus_match_remove call

It cannot fail, just returns 0 or 1 for not found/found

CID#1663675

7 days agomeasure-smbios: bound type 1 length before zeroing wake-up type
Syed Mohammed Nayyar [Sun, 5 Jul 2026 08:09:51 +0000 (13:39 +0530)] 
measure-smbios: bound type 1 length before zeroing wake-up type

The structure length comes from the firmware SMBIOS table and the only
bound before the fixed-offset wake_up_type write was an assert(), which
is a no-op in release sd-boot builds.

Whether the field is present is governed by the formatted-area length
header->length, not the total size which also covers the trailing string
set. A too-short record (an old SMBIOS 2.0 one, or a crafted 6-byte
header) makes the offset-24 write land past the xmemdup() copy; a record
with a short formatted area but long string set instead gets a stable
string byte zeroed in the copy. Key the guard off header->length and the
field offset, matching get_smbios_table(), and measure such records
as-is. Zero only the part of the field that lies within the formatted
area, and collapse the two measure_smbios_raw() call sites by selecting
what to measure via a pointer.

Signed-off-by: Syed Mohammed Nayyar <jmestwa@gmail.com>
7 days agocore: support stdio fd passing in io.systemd.Unit.StartTransient
Lars Sjöstrom [Thu, 2 Jul 2026 08:08:03 +0000 (10:08 +0200)] 
core: support stdio fd passing in io.systemd.Unit.StartTransient

Add StandardInputFileDescriptor, StandardOutputFileDescriptor and
StandardErrorFileDescriptor to the Service context of the Varlink
StartTransient() method. Each carries the push-order index of a file descriptor
passed along with the method call (via SCM_RIGHTS), and connects it to the
transient service's standard input/output/error. This is the Varlink equivalent
of the StandardInputFileDescriptor= / StandardOutputFileDescriptor= /
StandardErrorFileDescriptor= D-Bus transient properties behind
"systemd-run --pipe", which had no Varlink counterpart.

The manager Varlink server now enables SD_VARLINK_SERVER_ALLOW_FD_PASSING_INPUT
so clients may attach descriptors to their method calls, matching other
fd-accepting Varlink services (mountfsd, networkd, vmspawn, ...). The indices are
resolved with sd_varlink_peek_dup_fd() after the polkit authorization check and
stored on the Service exactly like the D-Bus path
(bus_set_transient_exec_context_fd()): the fds land in stdin_fd/stdout_fd/
stderr_fd and exec_context.stdio_as_fds is set, so the existing exec-invoke
plumbing wires them to the spawned process unchanged. Unsuitable fds (bad
index, wrong access mode) are rejected as InvalidParameter, other resolution
failures propagate as raw errnos.

Add coverage to TEST-74-AUX-UTILS.varlinkctl-unit.sh, passing regular files as
the stdout/stderr fds and asserting the unit's output lands on them.

7 days agosysinstall: Disable timeout for connection with repart
Julian Sparber [Tue, 7 Jul 2026 16:12:44 +0000 (18:12 +0200)] 
sysinstall: Disable timeout for connection with repart

The repart connection was timeing out when fetching candidate devices.
Therfore disable the timeout and keep the connection open till the user
disconnects.

7 days agogitignore: add .envrc, .direnv
Paul Meyer [Tue, 7 Jul 2026 16:31:53 +0000 (18:31 +0200)] 
gitignore: add .envrc, .direnv

Signed-off-by: Paul Meyer <katexochen0@gmail.com>
7 days agoAdjust naming of meson variables and allow systemd-report* binaries to be built stand...
Zbigniew Jędrzejewski-Szmek [Tue, 7 Jul 2026 19:35:41 +0000 (21:35 +0200)] 
Adjust naming of meson variables and allow systemd-report* binaries to be built standalone (#42874)

7 days agoportable: fix marker_matches_images() and propagate errors correctly 42915/head
Luca Boccassi [Tue, 7 Jul 2026 10:16:42 +0000 (11:16 +0100)] 
portable: fix marker_matches_images() and propagate errors correctly

marker_matches_images() was declared to return bool, but several of its
paths return a negative errno (OOM, parse errors, etc.). A negative int
coerces to true, so every such failure was reported as a "match".

Return int with the tristate semantics the callers already expect.

When detaching by image name instead of the original path, path_pick() may
not resolve a concrete path (e.g. a runtime overlay). Keep comparing the
caller-provided image name, and use the picked path only as an additional
canonical match when it exists.

Follow-up for 907952bbc92dd6656807d9b2eb0d0c94a4c9e865

7 days agojournald: replace existing syslog event source before reopening
Luca Boccassi [Tue, 7 Jul 2026 13:11:25 +0000 (14:11 +0100)] 
journald: replace existing syslog event source before reopening

manager_open_syslog_socket() may be called again with an already open
syslog fd. In that case the old syslog event source still watches the
fd, so adding a new IO source for the same fd fails with -EEXIST and
leaves the old source installed.

Disable and unref the old event source before adding the replacement.
This keeps reopening idempotent and avoids leaving a stale event source
around.

Follow-up for f9a810bedacf1da7c505c1786a2416d592665926

7 days agojournald: pin the sending client's context across native message dispatch
Luca Boccassi [Tue, 7 Jul 2026 10:58:14 +0000 (11:58 +0100)] 
journald: pin the sending client's context across native message dispatch

manager_process_native_message() looks up the sender's ClientContext with
client_context_get(), which does not pin it.

A native message may carry an OBJECT_PID=, which makes
manager_dispatch_message_real() perform a nested client_context_get() for that
PID. On a cache miss this runs client_context_try_shrink_to(), whose pid-flush
branch frees every unpinned cache entry whose PID has already been reaped,
including the borrowed sender context. manager_dispatch_message_real() then keeps
using it (it reads c->uid, and the built iovecs still alias the context's
fields).

Pin the sender context with client_context_acquire() for the duration of the
dispatch and release it afterwards, mirroring what the stdout stream path
already does.

Follow-up for 22e3a02b9d618bbebcf987bc1411acda367271ec

7 days agoportable: detect drop-in-only attachments
dongshengyuan [Sat, 4 Jul 2026 09:05:33 +0000 (17:05 +0800)] 
portable: detect drop-in-only attachments

Commit edea370222 (portable: remove drop-in configs even if the main unit file does not exist)
taught detach to handle leftover .service.d directories
after the main unit symlink was removed.

portable_get_state_internal() still had the same blind
spot: it only considered regular unit entries, so portablectl
is-attached could report detached while a portable drop-in directory was still present.

Handle those drop-in-only entries like detach does, preserve
the existing unit-file based enabled checks when the
main unit file is still present, and add TEST-29 coverage.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
7 days agosbsign: write unaligned signature size into WIN_CERTIFICATE header
Vsevolod Kozlov [Mon, 6 Jul 2026 10:40:53 +0000 (13:40 +0300)] 
sbsign: write unaligned signature size into WIN_CERTIFICATE header

The inclusion of padding bytes in the signature size can lead to the signature
being rejected by strict PKCS7 parsers. Meanwhile, according to [1], the parser
of the WIN_CERTIFICATE structure is expected to round up the value of dwLength
to an 8-byte multiple. This also matches the behaviour of the sbsign tool from
sbsigntools.

Fixes #42884

[1] https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#the-attribute-certificate-table-image-only

Signed-off-by: Vsevolod Kozlov <zaba@mm.st>
7 days agopull: honor sync for OCI artifacts
dongshengyuan [Fri, 3 Jul 2026 07:17:53 +0000 (15:17 +0800)] 
pull: honor sync for OCI artifacts

Synchronize OCI layer directories and generated metadata
when IMPORT_SYNC is enabled, matching the raw and tar pull paths.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
7 days agocopy: keep replaced target after publish errors
dongshengyuan [Fri, 3 Jul 2026 06:44:40 +0000 (14:44 +0800)] 
copy: keep replaced target after publish errors

Once link_tmpfile_at() succeeds, the target path
has been published. Avoid unlinking it on later
close or parent fsync failures when COPY_REPLACE
was used, as that can remove the replaced target.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
7 days agomkosi: update fedora commit reference to 57cbcf979ce2dd872a871c59e87d2c65dfa996e6 42874/head
Zbigniew Jędrzejewski-Szmek [Tue, 7 Jul 2026 16:37:12 +0000 (18:37 +0200)] 
mkosi: update fedora commit reference to 57cbcf979ce2dd872a871c59e87d2c65dfa996e6

57cbcf979c Also enable report-standalone for OBS builds
d69c17b165 Enable report-standalone for upstream builds

8 days agomeson: use modern syntax for dict checks
Zbigniew Jędrzejewski-Szmek [Fri, 3 Jul 2026 13:32:02 +0000 (15:32 +0200)] 
meson: use modern syntax for dict checks

8 days agomeson: build .standalone versions of the report binaries
Zbigniew Jędrzejewski-Szmek [Fri, 3 Jul 2026 11:28:36 +0000 (13:28 +0200)] 
meson: build .standalone versions of the report binaries

The goal is to be allow the use of those binaries on systemd with older
systemd. The report stuff is generally independent of the running systemd
version.

When built with -Dinstall-tests=true -Dstandalone-binaries=true
-Dbuildtype=release -Db_lto=true, gcc-16.1.1-2.fc44.x86_64, the sizes
are quite reasonable:

$ ls -lG build-lto/*.standalone
-rwxr-xr-x 1 zbyszek  713200 Jul  3 13:16 build-lto/systemd-report.standalone
-rwxr-xr-x 1 zbyszek  662936 Jul  3 13:16 build-lto/systemd-report-basic.standalone
-rwxr-xr-x 1 zbyszek  567424 Jul  3 13:16 build-lto/systemd-report-cgroup.standalone
-rwxr-xr-x 1 zbyszek  592856 Jul  3 13:16 build-lto/systemd-report-files.standalone
-rwxr-xr-x 1 zbyszek  589864 Jul  3 13:16 build-lto/systemd-report-sign-plain.standalone
-rwxr-xr-x 1 zbyszek  548624 Jul  3 13:16 build-lto/systemd-report-sign-tsm.standalone

8 days agomeson: adjust naming of '*extract*' variables
Zbigniew Jędrzejewski-Szmek [Fri, 3 Jul 2026 11:41:53 +0000 (13:41 +0200)] 
meson: adjust naming of '*extract*' variables

8 days agomeson: rename extract+objects to export+import
Zbigniew Jędrzejewski-Szmek [Fri, 3 Jul 2026 10:30:09 +0000 (12:30 +0200)] 
meson: rename extract+objects to export+import

We have two concepts: a list of files that should be extracted from an
intermediate build artifact to be used in a later build artifact, and for a
given artifact, a list "donors". The first list was called "extract", because
it is passed to the .extract_objects() meson function, and the second was
called "objects", because that is the meson parameter to specify pre-built
objects files (6350d2dbd97746440b9c8303ddc140ffda568732). But this naming is
confusing: we don't care about the 'extract' step, this is something internal
to the build machinery. And 'objects' is a very generic term.

Let's use 'export' for the stuff that is "exported" for other binaries to use,
and 'import' to say where to import from. Those terms are symmetrical and the
association between them should be intuitive. (If you think the terms are
actually assymetrical, there are precedents for confusing the import with the
import sources. E.g. in modern English, turkeys are called so because they were
imported from the Americas and guineafowls were imported from Africa via
Türkiye and all that foreign stuff is alike.)

8 days agomeson: move 'conditions' to the end
Zbigniew Jędrzejewski-Szmek [Fri, 3 Jul 2026 10:07:02 +0000 (12:07 +0200)] 
meson: move 'conditions' to the end

8 days agomkosi: update fedora commit reference to 45c16dd369c961b70664e473552def34d5469664
Zbigniew Jędrzejewski-Szmek [Tue, 7 Jul 2026 10:18:28 +0000 (12:18 +0200)] 
mkosi: update fedora commit reference to 45c16dd369c961b70664e473552def34d5469664

45c16dd369 Use uniform format for %rhel conditionals
034fa693f2 Print the build status also in %build
3cc7e03365 Restore definitions of helper macros
2382c910b7 Disable the standalone report yet again
2d6fd95c70 Restore explicit requires for Centos Stream 9 and 10
521ab0fb09 test: skip the integration test suite on Fedora ELN (for now)
453447b79b rpminspect: ignore test-coredump-stacktrace in annocheck
9d4edaa576 test: work around a kernel bug in virtio/vsock
c53b2fb307 test: cap the number of parallel tests
9bd26bb71f Fix ntpvendor for ELN
de7b685908 Disable reqs for dlopen'ed libraries on CentOS
4830641844 Move portabled to systemd-container subpackage
893fcd9978 Add missing conditionalization and more debugging
c783e74791 split-files: improve error message
ee2dff42d6 Add systemd-report-standalone
9c87a3f8ad Load libssl.so.4 rather than libssl.so.3
714b0799d2 Version 261.1
054158500a Update to load openssl-4 rather than openssl-3
5a3e750ef8 Version 261
4faee7ab7d Version 261~rc4
8ff635a921 Rebuilt for openssl 4.0
0064f73d97 Rebuilt for openssl 4.0
14a9aac87e Use dlopen notes again
720fa8259a Do not check ownership of /var/lib/systemd/timesync/ in rpm -V
06bd9926f2 Version 261~rc3
6ddbd499e8 Drop unused tree build dependency
bd81a14bfc Version 261~rc2

8 days agoAssorted libsystemd/network hardening fixes flagged by kres (#42865)
Zbigniew Jędrzejewski-Szmek [Tue, 7 Jul 2026 11:27:57 +0000 (13:27 +0200)] 
Assorted libsystemd/network hardening fixes flagged by kres (#42865)

8 days agohwdb: add MSI Claw 8 EX AI+ CG3EM to keyboard hwdb list
Matthew Schwartz [Tue, 23 Jun 2026 23:54:51 +0000 (16:54 -0700)] 
hwdb: add MSI Claw 8 EX AI+ CG3EM to keyboard hwdb list

8 days agojournalctl: add follow mode to the varlink method
Michael Vogt [Thu, 2 Jul 2026 13:27:06 +0000 (15:27 +0200)] 
journalctl: add follow mode to the varlink method

This commit implements `journalctl -f` like behavior for the
varlink API of journalctl. It is used via:
```
$ varlinkctl call -E \
    /run/systemd/io.systemd.JournalAccess \
    io.systemd.JournalAccess.GetEntries '{"follow": true, "limit": 10}'
```
This gives the last 10 message and then it keeps the connection
open and output each new log line that matches the set filters.

The code is modeled after `journalctl -f`. It seems there is little
to extract into shared code here so I left it for now.

8 days agovmspawn: discover firmware descriptors, opt-in secure boot support for coco (#42876)
Lennart Poettering [Tue, 7 Jul 2026 06:55:10 +0000 (08:55 +0200)] 
vmspawn: discover firmware descriptors, opt-in secure boot support for coco (#42876)

9 days agoresolve: anchor the service browser from mDNS maintenance queries 42865/head
Luca Boccassi [Thu, 2 Jul 2026 21:20:31 +0000 (22:20 +0100)] 
resolve: anchor the service browser from mDNS maintenance queries

mdns_maintenance_query() takes a ref on the browser's varlink link but
never installs itself as that link's userdata. dns_query_free() then
unconditionally runs sd_varlink_set_userdata(varlink_request, NULL),
so freeing any maintenance query wipes the browse query's registration
on the shared sb->link slot, disabling the abort paths in
vl_on_disconnect() and dns_service_browser_free(). The maintenance
query also never takes a reference on the DnsServiceBrowser, so a client
disconnect could free the browser while a maintenance query was still
in flight, leaving the per-service schedule_event timer and the raw
service->service_browser back-pointer dangling (use-after-free on the
next timer tick or query completion).

Take a service_browser_request reference instead, matching the browse
query path. dns_query_free() already drops it. The browser now outlives
its in-flight maintenance queries.

Follow-up for 8458b7fb91ea5e5109b6f3c94f8a781a120c798b

9 days agonetwork: implement refcounting for SR-IOV objects
Luca Boccassi [Thu, 2 Jul 2026 21:06:25 +0000 (22:06 +0100)] 
network: implement refcounting for SR-IOV objects

link_request_sr_iov_vfs() queued each request with a raw SRIOV* as
userdata and a NULL free_func, so the request did not own the object.
The SRIOV is owned by link->network->sr_iov_by_section, which is freed
by network_free() on reload while the RTM_SETLINK reply may still be in
flight (the floating netlink slot keeps the request alive but does not
keep the userdata alive). A later reply, or the 25s netlink timeout,
then dispatches sr_iov_handler() which reads the freed SRIOV.

Follow-up for cb8453cc51a9d49e094e746af2e074669a71cc4a

9 days agoudev: clear event back-pointer when freeing a worker
Luca Boccassi [Thu, 2 Jul 2026 19:55:53 +0000 (20:55 +0100)] 
udev: clear event back-pointer when freeing a worker

worker_free() did not clear worker->event->worker, leaving an event
that was still attached to a worker pointing at freed memory once the
worker was gone. manager_free() frees the workers (hashmap_free())
before it walks manager->events to process them, and event_free() then
writes event->worker->event = NULL into the already-freed worker.

Clear the back-pointer in worker_free(), mirroring event_free() which
already clears the worker's pointer. The link used to be torn down by
the event_free(worker->event) call in worker_free(), which was dropped
when events became reference counted.

The Event and Worker definitions move to udev-manager.h (next to
Manager) so the unit test can construct and free a bound worker/event
pair.

Follow-up for cb16d47f30cc0d848ca6868c39b844810520d713

9 days agosd-bus: drop half-registered vtable members on failure
Luca Boccassi [Thu, 2 Jul 2026 19:08:14 +0000 (20:08 +0100)] 
sd-bus: drop half-registered vtable members on failure

add_object_vtable_internal() inserts BusVTableMember entries into the
global vtable_methods/vtable_properties sets as it walks the vtable, but
only sets node_vtable.node (which gates the disconnect-time cleanup)
after the loop. A failure mid-loop thus left the already-inserted
members behind, dangling once the slot's interface string and the node's
path were freed, so a later registration reading those keys hit a
use-after-free. Remove this slot's members on the fail path.

The test asserts the failed registration leaves no member behind.

Follow-up for 19befb2d5fc087f96e40ddc432b2cc9385666209