Commit Graph
91846 Commits
Author SHA1 Message Date
Daan De Meyer 4754cd2db6 sd-future: make sd_fiber_await() report failures rather then future results
sd_fiber_await() returned the target future's result on completion and an error
on interruption, so a negative value could mean either that the target future
resolved with an error or that the wait never finished. Most callers had to check
the target future's state afterwards to tell the two apart. Even worse, a target
resolving with -ECANCELED was indistinguishable from a cancelled wait.

Let's return 0 once the target future has resolved and a negative error only when
the wait itself did not complete. The target future's outcome stays available through
sd_future_result(), which callers have to additionally inspect now.
2026-09-25 12:57:37 +02:00
Robert Beckett 4ca7ac0275 terminal-util: don't query terminal size on virtual consoles
terminal_fix_size() queries the terminal for its dimensions with CSI 18
and DSR. On a virtual console that is pointless: the kernel renders the
screen itself, so TIOCGWINSZ is already authoritative.

It is also slow. PID 1 queries /dev/console from console_setup(), and
writes there go through redirected_tty_write(), so while plymouth holds a
TIOCCONS redirect the query never reaches the VT and no reply is ever
generated. Each query then waits out CONSOLE_ANSI_SEQUENCE_TIMEOUT_USEC.
Previously the write failed immediately with EAGAIN — the kernel forces
O_NONBLOCK on /dev/console — so the query was abandoned at no cost; since
ba10d789a8 it is retried until the timeout instead. On a Steam Deck
booting with console=tty1 and plymouth the two queries cost 667ms, about a
quarter of userspace boot time, and no log level shows it because main()
runs console_setup() between log_close() and log_open().

So skip the query on a virtual console and keep the dimensions the kernel
gave us, reporting success rather than an error: declining to ask is not a
failure, and the "dimensions already match" path below returns 0 for the
same reason.

Note this also skips the query on a /dev/ttyN that would have answered,
and does not help a serial console behind a TIOCCONS redirect.

Fixes: ba10d789a8
Fixes: d91a184509
2026-09-25 11:29:57 +02:00
Yu Watanabe 63850321af test: add missing ASSERT_OK()
Follow-up for 3f4a43f0eb.

Addresses https://github.com/systemd/systemd/pull/43733#discussion_r4087916957
2026-09-25 09:33:03 +02:00
Daan De Meyer 109d01bfb0 ci: enforce review deadlines with a hook instead of asking for tool budgets
Reviewers ignored the tool call budget in their prompt, and the budget was a
poor stand-in for what matters anyway: per-call latency varied from 25 to
85 seconds between lenses, so the same count meant 7 minutes for one and 20
for another. Two lenses hit the timeout and lost everything they had found.

Enforce the deadline itself. run_claude exports it per invocation and a
PreToolUse hook denies further tool calls once it has passed, telling the
model to return what it has. The structured output call stays allowed, so
a slow lens still produces findings. The timeout, three minutes later, only
catches a hang. Give reviewers 22 minutes and the validator 12.
2026-09-25 12:52:10 +09:00
Roy-Magne Mo f8dae4bbbe po: Added translation using Weblate (Norwegian Nynorsk)
Co-authored-by: Roy-Magne Mo <rmo@sunnmore.net>
2026-09-25 00:29:02 +02:00
Jakub Znamenáček 7abf4dbbf4 hwdb: Add Microsoft Surface Go 3 chassis quirk
The Surface Go 3 is a tablet with a detachable Type Cover keyboard,
but its firmware reports SMBIOS chassis type 9 (Laptop), so hostnamed
reports "laptop". Override it to "convertible", which is what hostnamed
already uses for SMBIOS chassis type 0x20 (Detachable).

Tested on a Surface Go 3 with the DMI modalias
dmi:bvnMicrosoftCorporation:...:svnMicrosoftCorporation:pnSurfaceGo3:...
2026-09-24 21:48:54 +02:00
Michael Vogt 1cf66d1c67 report: replace METRICS_MAX with a per source limit
The existing limit for the reports was a global METRICS_MAX cap.
However on systems with a verbose socket or with many sockets
that is easily hit and because sockets are contacted in parallel
random parts of the following report generators are skipped.

It seems better to instead make the limit per-source so that one
that is overly verbose cannot starve the others. Because we already
have METRICS_LINKS_MAX this does not add a global limit - we could add
one but it would have the same problem as METRICS_MAX before, some
report would be cut that might be important (or we need to be explicit
about ordering but even then its problematic if we have two
"important" ones and one is buggy and generates too much data).

Note that this keeps the METRICS_PER_SOURCE_MAX at 4096 because
io.systemd.Manager reports a lot, on my idle test VM already
~3k.

We also now report any issue with the metric instead of just the
first one in verb_metrics.
2026-09-24 10:59:10 +02:00
Chris Coulson 1c5783b112 report: Support signing reports with multiple TPM2 keys
In preparation for adding a varlink interface for key management, add
support for signing reports with multiple TPM2 keys. During signing,
this iterates over all *.key files in /var/lib/systemd/report.sign.tpm2,
generating a TPM signature with each one. It also looks for the
corresponding *.voucher file, containing some credential that is used to
prove that the signing key is authentic, and which is added to the
signature if it exists.

If no signing keys exist when a signature is requested, a default
signing key is still created as default.key.
2026-09-24 09:28:38 +02:00
Ayoub Zaki 2d6bc0328c resolved: add ML-DSA-44 DNSSEC verification
Classical DNSSEC algorithms such as RSA and ECDSA are vulnerable to
quantum computers. Add support for post-quantum ML-DSA-44, DNSSEC
algorithm 18.

Verify pure ML-DSA through OpenSSL. Report the algorithm as unsupported
only when it is unavailable. Treat key import and verification failures
as hard errors.

Add the draft test vector and negative tests.

https://datatracker.ietf.org/doc/draft-westerbaan-dnssec-mldsa/

Signed-off-by: Ayoub Zaki <ayoub.zaki@embetrix.com>
2026-09-24 09:23:52 +02:00
Yu Watanabe bc5de99fd0 mkosi/postmarketos: drop unnecessary musl-utils
It was installed for ldconfig.service, but it is disabled now:
https://gitlab.postmarketos.org/postmarketOS/pmaports/-/commit/131f1be52ebec9cc6697b42c226581e1322558f7
2026-09-24 09:07:38 +02:00
Yu Watanabe 35034dbdcd mkosi: update postmarketos commit reference to 07ea0bed8fbbafe06b2bf68b6bfabcf86c2e4449
* 07ea0bed8f systemd: drop unnecessary dependencies
* 45eb7f88dc systemd/systemd: upgrade to 262
* cb9121da2c systemd/systemd: upgrade to 262_rc3
* 6c223d3566 systemd: drop pre-install script, re-exec on upgrade
* 10591797ee systemd: upgrade to 262-rc2
* 7d5b4e3816 systemd/systemd: build with SELinux support
* bb647faf54 systemd: upgrade to 262-rc1
* 369c5ac3b6 extra-repos/systemd: backport timesyncd DNSSEC NTP fix
* 2bf2f3329e treewide: remove pmb:strict from options
* 9c68abf912 systemd/systemd: upgrade to 261.2
* 3004382975 systemd: remove eudev provide
* 131f1be52e systemd/systemd: disable ldconfig
* 6e90d14c4d systemd/systemd-stage0: disable unnecessary options
* a372a2f2c5 systemd/systemd: backport patch adding inhibit support to pam_systemd
* 994ed89373 systemd/systemd: add Ollie as co-maintainer
* 14897810c9 systemd: disable compat-sysv-interfaces
* 5e5a451de1 systemd: remove unnecessary provider_priority's
* 61ee5c6fe8 treewide: remove contributor comments
* f36462e85b systemd/systemd: upgrade to 261.1
* 5ff3f5ed44 systemd/systemd: adds libbz2 dependency
2026-09-24 09:07:38 +02:00
Yu Watanabe 77c51f4e97 blockdev-list: also ignore ramdisk
This renames BLOCKDEV_LIST_IGNORE_ZRAM to BLOCKDEV_LIST_IGNORE_RAMDISK,
and make it ignores both /dev/ramX and /dev/zramX.

Note, linux-stable by Alpine/postmarketOS has CONFIG_BLK_DEV_RAM=y,
hence the kernel creates /dev/ramX by default. Without this change,
the test case added by 236e7d8a4c fails,
as io.systemd.Repart.ListCandidateDevices varlink method lists the
ramdisks.
2026-09-24 09:07:09 +02:00
Totoro 3fe57d03a3 json-stream: preserve message boundaries when receiving file descriptors
An AF_UNIX stream receive can combine a message without file descriptors
with a following SCM_RIGHTS-bearing message. This associates the received
descriptors with the earlier message even when the sender uses separate
sendmsg() calls.

Use the existing boundary-limited read path whenever FD input is enabled
on stream sockets, not only for protocol upgrades. Include the buffered
delimiter suffix in the peek search so a split CRLF delimiter cannot
over-read into the next message either.

Record the input socket type when attaching the descriptors so the new
FD-triggered limit does not truncate packet sockets. Explicit bounded
reads retain their existing semantics.

Add regressions for a oneway request followed by an FD-bearing request,
a continued reply followed by an FD-bearing terminal reply, a split CRLF
delimiter followed by an FD-bearing message, and batched messages on
SOCK_SEQPACKET and SOCK_DGRAM.

Fixes #43823
2026-09-24 09:05:42 +02:00
Zbigniew Jędrzejewski-Szmek 1f286f971e test/fsprg: move includes to appease clang-tidy
Previously in CI:
../src/test/fsprg.c:18:1: error: included header gcrypt-util.h is not used directly [misc-include-cleaner,-warnings-as-errors]
   18 | #include "gcrypt-util.h"
      | ^~~~~~~~~~~~~~~~~~~~~~~~
   19 | #include "memory-util.h"
../src/test/fsprg.c:19:1: error: included header memory-util.h is not used directly [misc-include-cleaner,-warnings-as-errors]
   19 | #include "memory-util.h"
      | ^~~~~~~~~~~~~~~~~~~~~~~~
   20 |
2 warnings treated as errors
2026-09-24 10:39:02 +09:00
Daan De Meyer 69cb8c4a94 ci: draft PRs and skip reviews while the README notice is present
AI agents prepend a notice to README.md that the author removes once they
have reviewed the changes. Until that happens nobody else should look at
the PR: convert it to a draft, don't add the please-review label, and
don't start a Claude review. The labeler and the review workflow check
README.md at the PR head for the notice. Marking the PR ready for review
after removing the notice triggers the normal labeling again.
2026-09-24 05:58:54 +09:00
Duncan Overbruck 128416f305 crypto-util: BN_bn2bin asserts have side-effects 2026-09-24 05:49:21 +09:00
Yu Watanabe 62f105c9f4 ndisc: several fixlets (#43733) 2026-09-24 05:47:35 +09:00
Zbigniew Jędrzejewski-Szmek 005a149002 meson: use 'sources' not 'export'
'export' is needed when want to reuse the compilation objects in some
other binary.
2026-09-23 21:55:37 +02:00
Zbigniew Jędrzejewski-Szmek 7609c88df2 NEWS: typo 2026-09-23 21:55:37 +02:00
Zbigniew Jędrzejewski-Szmek 244d9bb6c4 hostnamectl: drop space in synopsis
The standard spelling for args that can repeat is without the space.
2026-09-23 21:55:37 +02:00
Yu Watanabe fd1f164b1b mkosi: drop unnecessary packages
This partially reverts 77b3ddf2aa.

Testing with musl is now done by postmarketOS. Hence, these packages
are not necessary anymore.
2026-09-23 16:47:25 +02:00
Yu WatanabeandSiteshwar Vashisht 3f4a43f0eb test-ndisc-option: add a round trip test for ndisc options
Co-authored-by: Siteshwar Vashisht <svashisht@redhat.com>
2026-09-23 16:33:34 +02:00
Yu Watanabe b628909430 ndisc-option: fix parsing/building extended flags
The flags part of the option is 6 bytes. Let's read/write one by one.

Fixes https://github.com/systemd/systemd/pull/43620#discussion_r3913713018.
2026-09-23 16:33:34 +02:00
Yu Watanabe 1299c9cc9e ndisc-option: drop unused argument 2026-09-23 16:33:34 +02:00
Siteshwar Vashisht d3157f2a67 ndisc: fix an off by 2 write in ndisc_option_build_encrypted_dns()
This function constructs the NDisc Encrypted DNS option (RFC 9463).
`poff` is initialized to `off + sizeof(uint16_t)` - pointing past the 2
bytes SvcParam length field. After all SvcParams are written the length
is set at line 1541. `LESS_BY(poff, off) = poff - off` includes the 2
bytes length field itself. The correct value is `poff - off -
sizeof(uint16_t)`.
2026-09-23 16:33:34 +02:00
Lennart Poettering 186a8486fc report: add backend for reporting temperature sensors 2026-09-23 16:31:41 +02:00
Armaan Sandhu 31bf94f87d siphash24: force inlining of the round
gcc does not inline sipround() at -O2: its size estimate lands just over
the default max-inline-insns-auto budget, so nm on libsystemd-shared.so
shows a local sipround symbol and each of the ten call sites pays a
call/ret plus a reload and store of the state through the pointer, around
six rounds of ~14 ALU ops. clang inlines it on its own, and gcc does too
at -O3 or with --param max-inline-insns-auto=30, so this is not a missed
optimization to report upstream but the inliner's size heuristic doing
what it is designed to do. The documented way to overrule it for one
function is always_inline.

The SipHash reference implementation this file is derived from inlines
the round manually, by writing it as a SIPROUND macro.

AMD Ryzen AI 7 350, gcc 16.2.1, -O2 -fstack-protector-strong
-fno-strict-aliasing, median of five runs:

    input     before      after     speedup
      8 B    61.3 ns     9.3 ns       6.63x
     16 B    54.6 ns    10.7 ns       5.11x
     24 B    50.0 ns    12.6 ns       3.98x
     40 B    49.4 ns    16.4 ns       3.01x
     64 B    53.2 ns    22.1 ns       2.41x
    128 B    67.8 ns    36.9 ns       1.84x
    512 B   157.7 ns   128.1 ns       1.23x
   4096 B   992.5 ns   964.5 ns       1.03x

The win is concentrated on short inputs because the bulk loop in
siphash24_compress() was the one place gcc did inline the round; the
prologue, the tail and all six rounds of siphash24_finalize() were not.
Short inputs are also what we overwhelmingly hash: hashmap and set keys,
unit names, paths, journal field names and data objects, bus match
strings. clang is unaffected.

Resulting hash values are unchanged; verified identical over every input
length from 0 to 128 bytes, and test-siphash24, test-hash-funcs,
test-hashmap and test-set pass.
2026-09-23 16:30:50 +02:00
Chris Coulson efe5e4d271 report: Add the session audit digest algorithm to the TPM2 signature
When generating a session audit digest, the algorithm isn't included in
the attestation. The algorithm is the auth digest algorithm that the TPM
session is created with, which is currently hardcoded as SHA-256.

This might not always be the case though, and verifiers shouldn't have
to guess what the digest algorithm is, so include the algorithm in the
report signature component.
2026-09-23 16:30:17 +02:00
theogeff e8142670aa report: add reportID field to reports
This uses a random high-entropy ID for reports, making it useful
when hashing the report for passing it to the Time Stamping
Authority. Reports are therefore guaranteed to be distinct from
one another.
2026-09-23 16:28:58 +02:00
Luca Boccassi 3f9d31fdc0 cryptenroll-varlink: Allow to display recovery-key before enrolling (#43687)
Closes https://github.com/systemd/systemd/issues/43676
2026-09-23 16:28:19 +02:00
Luca Boccassi d8cea1b942 sysinstall: optionally, pick target block device automatically (#43582) 2026-09-23 16:27:01 +02:00
Christian Hesse 327061908a mkosi: update arch commit reference to 4749b653ee7b9210bcd46fe43065508aa58b779a 2026-09-23 14:52:39 +02:00
Yu Watanabe 83cc7f7ea8 in-addr-util: several cleanups (#43656) 2026-09-23 19:23:00 +09:00
Yu Watanabe 2727a7fad4 network: drop pending requests (#43741)
Fixes #39460.
2026-09-23 19:21:10 +09:00
Lennart Poettering 641da198fd update TODO 2026-09-23 10:14:25 +02:00
Lennart Poettering 236e7d8a4c ci: testcase for new auto-pick mode of sysinstall 2026-09-23 10:14:25 +02:00
Lennart Poettering 0bb2f138f4 sysinstall: correct end marker log message
Copypasta...
2026-09-23 10:14:25 +02:00
Lennart Poettering 9b7f2c64b1 sysinstall: send out READY=1 when we start our thing
This is useful so that whoever invokes the tool knows that the general
parameters checked out, and the tool now proceeds with actually doing
the work.
2026-09-23 10:14:25 +02:00
Lennart Poettering ce8d684ed8 sysinstall: optionally, automatically pick target block device after a settle timeout
Let's make sysinstall useful for truly unattended installations, and let
it it automatically pick a target disk after some settlement time-out.
2026-09-23 10:14:25 +02:00
Lennart Poettering 647fa40327 blockdev-list: add blockdev_list_full() which allows passing in a pre-determined pair of root_devno/whole_root_devno 2026-09-23 10:08:36 +02:00
Lennart Poettering 48a9afb6ec blockdev-list: split BLOCKDEV_LIST_IGNORE_LOOP out of BLOCKDEV_LIST_IGNORE_VIRTUAL
So far BLOCKDEV_LIST_IGNORE_VIRTUAL filtered out everything below
/sys/devices/virtual/, which includes loopback devices. Loopback devices
are frequently used as stand-ins for real disks though (in tests, and
when installing to disk images), hence it's useful to be able to control
them independently of the other virtual devices (dm, md, zram, …).

Introduce a separate BLOCKDEV_LIST_IGNORE_LOOP flag for loopback
devices, and make BLOCKDEV_LIST_IGNORE_VIRTUAL only cover the non-loop
virtual devices. The only existing user (systemd-report) is updated to
pass both flags, so that its behaviour stays unchanged.
2026-09-23 10:08:36 +02:00
Julian Sparber 4b259b5630 test: cryptenroll-varlink: Add tests for handing in a recovery key
This adds two new tests to test the validation of the recovery key
passed to `Enroll()` and the generation of a recovery key by `MakeRecoveryKey()`.
2026-09-23 09:30:28 +02:00
Julian Sparber 9569d72182 cryptenroll-varlink: Add method to generate a recovery-key
We want users to use a recovery-key generated by systemd. Therefore
expose a method that let's clients generate a key that can be given to
the Enroll method. This way the key can be displayed before enrolling
it.
2026-09-23 09:30:28 +02:00
Julian Sparber c753849fd6 cryptenroll-varlink: Allow handing in a recovery key
In some cases we want users to copy the recovery key to a save location
before we enroll it, therefore allow clients to hand in a recovery key.
The next commit will add a varlink method to generate the recovery key.

Closes: https://github.com/systemd/systemd/issues/43676
2026-09-23 09:30:28 +02:00
Luca Boccassi 1c168322cf Improve error report when PCR changes (#43579)
When PCR is extended during a TPM2 operation, the internal counter of
the TPM2 will detect a new extension. systemd already retry this
operation several times, but sometimes the report will be an error, and
will refer to the wrong PCR.

This situation happends when IMA is enabled (when secure boot is active,
for example). PCR 10 will receive an extension for each new kernel
module that is loaded, logging in the journal errors that are recovered
later after a subsequent retry.
2026-09-23 09:28:35 +02:00
Daan De Meyer 0167e36e74 sd-future: rework cancellation, add slot callbacks and future groups
We replace the implicit single callback and wait-future indirection with
the usual slot design so independent fibers and future groups can track
the same future. We also opt to always have callbacks dispatch asynchronously,
including when they are registered after the future has already resolved.

We now require futures to be resolved before their final unref rather than
cancelling them implicitly. The idea is to catch bugs rather than leak futures.
A future should always be cancelled and awaited before it is cleaned up,
otherwise resources might leak if the stack is not unwound properly. We make
exceptions for futures that haven't started executing yet as there's no risk
of leaking resources there since there's no stack to unwind.

One issue with awaiting futures is that sd_fiber_await() returned both
errors and the future's result via the function's return value, meaning it
was impossible to distinguish future failures from interrupted waits (or
waits that failed for whatever other reason). This is generally not an issue
except in the cleanup functions, where we have to retry on interrupted waits
(the best example is a parent fiber waiting for a future being cancelled
itself, which should cancel the future it's waiting for and retry the wait).
So we introduce fiber_wait() which distinguishes between both values via
return value and output argument so the two can be distinguished from each
other.

Cleanup always consumes the caller's reference, including on invalid self or
cross-loop waits. The existing assertion still forbids dropping the last
reference to an unresolved future. The installed header documents this rule.

We introduce a new RUNNING fiber state to distinguish executing fibers from
non-executing fibers. We replace CANCELLED with queued resume results and
preserve interruptions across ordinary wakeups.

We add future groups with wait-all, wait-any and ignore-errors policies to
wait for multiple futures at once and migrate various existing call sites over
to them. Group size is a direct size_t query, treating NULL as an empty group.
Document all four policy combinations, including that IGNORE_ERRORS suppresses
fail-fast and parent cancellation without discarding the group's error result.

We also add defer futures and migrate bus, varlink, QMP and fiber I/O callers to
use them. Bus and QMP futures report -ENOPKG when no event loop is attached,
rather than passing NULL to sd_future_new() and returning -EINVAL.

Parent-await suppression is derived from the active wait's callback slot, so
groups use sd_fiber_await() without a separate await API or additional state.
Waits, group children and captured parents must use the same event loop.
Groups created on another loop have no parent, and a group releases its
parent reference when that fiber finishes.

Resolve SD_EVENT_DEFAULT in sd_future_new() so futures retain the actual
loop. Match group parents against that resolved loop as well; an unavailable
default returns -ENOPKG without creating an event loop implicitly.

Keep the public await entry point in fiber.c, sharing the slot-based wait with
cancellation cleanup through future-internal.h. Keep event/future integration
in event-future.c/h: priority inheritance uses the public fiber accessor, and
sd_future_new_defer() lives alongside the other event-backed constructors.
This avoids sd-event depending on sd-future private headers and removes the
redundant private defer wrapper.

Assert the non-failing slot-disabling and active-loop invariants instead of
returning early without completing callback dispatch.

Regression tests cover group error propagation and NULL-safe size queries,
interrupted waits, partial add-many rollback, groups outliving their parent,
and cancellation or timeout during nested event-loop waits, including
event-loop and descriptor cleanup. They also cover cross-loop parent isolation,
reference release on invalid cleanup calls, mixed WAIT_ANY outcomes, failed
child cancellation and policy changes on resolved groups. Additional tests
verify failed group-priority updates, slot priority during dispatch and exit,
and cancellation, timeout and spurious wakeups during bus and QMP calls. Late
replies must leave subsequent calls unaffected. Default-event tests cover
missing-loop errors, reference lifetime and parent capture by constructors.
Unattached bus and QMP clients are covered by missing-event-loop regressions.
Constructor tests verify inherited and default priorities for I/O, defer and
timer futures, plus defer argument validation and missing-default errors.

Signed-off-by: Daan De Meyer <daan@amutable.com>
2026-09-23 09:09:08 +02:00
Yu Watanabe de9ea9ea5d resolve: several cleanups for managing objects (#43629) 2026-09-23 15:54:02 +09:00
Heran Yang 2aed6d9ad7 network: find pending address in IPv4 ACD callback
When IPv4 ACD is enabled for a DHCPv4 address, the address remains in
the request queue until ACD succeeds. Hence, when ACD detects a
conflict, the address may not be present in link->addresses yet.

on_acd() currently looks up the address with address_get(), which only
searches link->addresses. This makes the callback return early and
prevents dhcp4_address_on_conflict() from sending DHCPDECLINE.

Use address_get_harder(), which also looks up pending address requests.

Fixes #39460
2026-09-23 14:35:58 +09:00
Yu Watanabe 830b60ae1f network: drop pending requests when a DHCP lease is lost or a client is stopped
When a DHCP lease is lost or a client is stopped, there may exist
requests not processed yet. We need to cancel them, otherwise an
address or route requested by the lost lease may be configured later.
2026-09-23 14:35:47 +09:00
Yu Watanabe 8698ce03d2 firewall-util: drop unnecessary restriction for the source address
Then, set assertions for the source address, as we already set non-NULL.
2026-09-23 13:53:23 +09:00