Commit Graph
91797 Commits
Author SHA1 Message Date
nikstur aba5c2df8e taint: don't taint if /bin, /usr/sbin, /var/run don't exist
It doesn't make sense to taint a system if these fails don't exist.

A missing /usr/sbin for example doesn't indicate an unmerged-bin.
Indeed, if you have no /usr/sbin but only a /usr/bin you have a
perfectly merged bin.

(cherry picked from commit 419cf189d05e0903a233d13db444586cfb2aaf16)
2026-10-16 11:36:32 +01:00
Martin Pitt a9868c9800 vmspawn: actually enable io_uring for disks
vmspawn never used `aio=io_uring` for disks, even when QEMU supports it.
Commit 1a7b6fd9dd added a blockdev probe node named `__io_uring_probe`.
QEMU rejects that name ("Invalid node-name"), as node names have to
start with a letter. The probe then reported io_uring as unsupported.

Use a valid name, following the "vmspawn-" prefix of the other node names.
Check the multi-drive test's debug log for rejected node names to catch
this and similar issues in the future.

Signed-off-by: Martin Pitt <martin@amutable.com>
(cherry picked from commit 9c582182e1ae1e38b7ec2dca29bb279cae83e69b)
2026-10-16 11:36:32 +01:00
Daan De Meyer e7dc2168e7 install: Pass in root prefixed path where needed
The lookup paths are root prefixed in this function, so we need to
pass in the root prefixed path as well to make sure path_is_generator()
does the right thing.

(cherry picked from commit fd6984e2d67fccf54ecf29a3d311e2486423cb98)
2026-10-16 11:36:32 +01:00
Daan De Meyer 3d267223ea systemctl: honour --root= in "is-enabled --full"
We have a root argument, let's make sure we honour it
in this case.

(cherry picked from commit b231b43ff0c3a4b951e45567474052885cad52d3)
2026-10-16 11:36:32 +01:00
Daan De Meyer c74e3aa5b7 install: preset in the scope the caller asked for
unit_file_preset() and unit_file_preset_all() zero-initialized their
install contexts, so their scope was always RUNTIME_SCOPE_SYSTEM. In
the global scope, specifiers in [Install] were then resolved as if for
the system: %U became 0 and a unit got enabled into
target-0.target.wants/. Set the scope the caller asked for, so that
this fails with -EUNATCH instead.

Covered by a new test that presets a unit using %U in the global
scope, with both functions.

(cherry picked from commit 0a4491ef3fce30d31a35c95031c8026a0235e0a2)
2026-10-16 11:36:32 +01:00
Daan De Meyer d14b9ace0c specifier: return -EUNATCH for user and group specifiers in global scope
%u, %U, %g and %G have nothing to resolve to in the global scope, and
failed with -EINVAL. Install code already treats -EUNATCH as "cannot
resolve specifiers": it is listed in ERRNO_IS_NEG_UNIT_ISSUE() and
install_change_dump_error() turns it into a proper message. With
-EINVAL, "systemctl --global enable" of a unit using these specifiers
only reported "Invalid argument".

Return -EUNATCH instead, like the machine-id and os-release
specifiers already do when their source is missing. Only the install
code uses these specifiers in the global scope.

(cherry picked from commit 03ce9bcff23d07751dc6911c7963e3bde9e780c2)
2026-10-16 11:36:32 +01:00
Daan De Meyer cb8fffda7d core: drop the dependency dropin name from the mask log line
The log line reported the file name of the masked dependency symlink, except
that entry is not assigned and is NULL at that point.

(cherry picked from commit 6e6114dd6cafb8d7c9585cf1d4ee58866db42d99)
2026-10-16 11:36:32 +01:00
Kai Lüke 9f00584fc3 test: Cover sysext/confext ordering
The ordering matters at unit startup and when we refresh on updates.
For now, just add a test for the update refresh ordering.

(cherry picked from commit 3bebfc9d85144ffe375ae076a2ba5cf58ade4284)
2026-10-16 11:36:32 +01:00
Kai Lüke efa8139061 sysext: refresh confexts before sysexts on sysupdate notifications
The extension refresh on update did sysext first and then confext but
the units until the previous commit didn't have any ordering. Since it
makes sense to first merge configuration and then the service that might
be influenced by that configuration, this ordering was chosen for the
unit startup path.
Align the update refresh order with the unit startup order.

(cherry picked from commit 2d5e73a485f892059e12d95ef69964bd40d04457)
2026-10-16 11:36:32 +01:00
Kai Lüke 0eee5712fd sysext: Order sysext unit after confext to provide guarantees
Up to now there was no clear ordering of confext and sysext units.
Normally, configuration should be able to influence the behavior of
services (config files or unit drop-ins), so it makes sense to order
confext before sysext. The mounting from the initrd for the final system
makes this less important together with the fact that live merges/
refreshes can encode unit restarts now. Yet I think it's better to know
what gets merged first and if wanted one can avoid encoding restarts if
one doesn't care about later live content changes. Where it matters more
for me is consistent behavior for the refresh check during boot for
non-verity images because they get compared by file handle and mount ID
which means whether the overlay was set up or not determines the
identity and decides if we do a refresh or not and this should not
vary by boot merely due to timing or other dependencies impacting the
ordering. (Note that one extension type shipping another extension type
is not the reason for the ordering and these cycles should be avoided
because they never free the mounts and backing loop devices.)

(cherry picked from commit 7197b862b2a132ea044fed59d914d5eb3e8ae9dd)
2026-10-16 11:36:32 +01:00
WilliButz fdd193ff22 docs: mention LoaderInfo efivar in BLI
(cherry picked from commit cfb11e1feb3c944fb0274c8a326a55b406f09582)
2026-10-16 11:36:32 +01:00
iacopo 5274598b37 man: fix sd_bus_destroy_t return type
(cherry picked from commit 4e7b8f2282430dfb6bac570a908ce47041af8d26)
2026-10-16 11:36:32 +01:00
SecretLUL 29646b6f1c journal-file: don't zero freshly allocated hash tables
The hash tables are only ever set up in newly created journal files, in
space that was just allocated via posix_fallocate() and hence reads as
zeroes anyway, so zeroing the items explicitly is unnecessary.

It is also harmful: the sequential write faults of the memzero() make the
kernel's mmap readahead instantiate the table in ever larger folios, up to
the size of the readahead window, on file systems that support large folios
in the page cache (e.g. XFS, and ext4 since kernel 6.16). And since write
faults on shared file mappings dirty the whole folio, each later update of
a single 16 byte hash bucket then has the whole folio written back. Without
the explicit zeroing, the table's pages are only faulted in when buckets
are first accessed, in random order, and hence mostly as order-0 folios.

Measured on Linux 6.18 with a new journal file (SystemMaxFileSize=50M),
appending 15 syslog-like entries with 23 fields each per second for 120s,
while writing back the file's dirty pages every second, as happens on
machines under page cache pressure, where reclaim keeps waking up the
flusher threads. Bytes written to the (loop) device, median and range of
4-5 runs:

          before                    after
  ext4    182.8M (178.4M-185.7M)    41.2M (31.6M-41.9M)
  xfs     172.7M (161.0M-182.4M)    40.1M (39.7M-44.9M)

This also avoids writing out the whole data hash table once for every new
journal file, i.e. ~2.8% of the maximum file size.

Related: #40262
(cherry picked from commit 6db7cf38d40e8fe6a11392d2f0cc044ed5acf812)
2026-10-16 11:36:32 +01:00
WilliButz 9299c328ac tpm2-util: print log message when search for NvPCR definition fails
Before this change it took some effort to find out why NvPCR related
functions would fail. Specifically, missing NvPCR defintions would let
the `systemd-pcrlogin@` services fail with the following log message:

```
Could not extend NvPCR: No such file or directory
```

There are two annoyances with this: even with log level debug there was
no indication of what is missing, and then there is (at least) one other
reason for the same error to be logged, which is the absence of the PCR
pubkey. The latter can be discovered by setting log level debug for the
affected service.

(cherry picked from commit b43fed88efe34889a49a7710a92141849dc4906d)
2026-10-16 11:36:32 +01:00
Daan De Meyer 26d273d804 nsresourced: Exclude cgroupfs from superblock check
cgroupfs has a single shared global superblock but
programs running in managed user namespaces still
need to be able to write it to make cgroup delegation
work. d381a0d9d5 broke
this by insisting the user namespace owns the
superblock. Let's fix this by excluding cgroupfs from
this check.

(cherry picked from commit 889bc48f101a7cbb56cb4be202e85e1f6d933151)
2026-10-16 11:36:32 +01:00
Zbigniew Jędrzejewski-Szmek 9359eeaf95 NEWS: fix/deduplicate texts about dlopen
The para for libcryptsetup duplicated the text three paras down.

The news for 259 used the phrase "$library support is now implemented via
dlopen()", which is a copy-pasta from an earlier paragraph which talked
about "Linux audit support" and "PAM support". We support PAM, but we
don't "support" libpam, we use it.

(cherry picked from commit 2b24baf2070d01ea8d48651c5052b82dc4c9ece0)
2026-10-16 11:36:32 +01:00
Yu Watanabe 2e8e1bf2d7 test: drop dlopen_gcrypt() test from test-dlopen-so
libgcrypt is used only by test-fsprg. We do not add dlopen notes for
unit tests, so the library may not be installed on the system. If systemd
is built with HAVE_GCRYPT but libgcrypt is not installed, the test fails.

There is no need to install libgcrypt solely for test-dlopen-so, so drop
the test case.

(cherry picked from commit 764b9a724925c4167e91fd36311e38aee8c6871a)
2026-10-16 11:36:32 +01:00
Kamil Monicz f3d4d3e25a socket-proxyd: fix off-by-one in connection limit
The limit is checked before the new connection is added to the set, so
with --connections-max=N and N connections open "set_size() > N" is
false and an additional connection is admitted. Use ">=" to refuse new
connections once the limit is reached.

(cherry picked from commit 9b51efd69fade39b0315251d02d1c9eab929891c)
2026-10-16 11:36:32 +01:00
Kamil Monicz bcf0a9ac58 socket-proxyd: raise RLIMIT_NOFILE at startup
Each proxied connection uses eight file descriptors: the accepted and the
outgoing socket, a duplicate of each, and a pipe for each direction. With
the default soft RLIMIT_NOFILE of 1024, setting up forwarding fails with
"Too many open files" at about 127 concurrent connections, well before
the default --connections-max=256, and the connection is closed right
after being accepted.

socket-proxyd's I/O is sd-event based and handles fds above 1023, so it
does not need the select()-compatible soft limit. Call
rlimit_nofile_bump(-1) at startup to raise RLIMIT_NOFILE as far as
permitted, like udevd does.

(cherry picked from commit 98752540be47778e253cbafe51c7ccdd30f4995e)
2026-10-16 11:36:32 +01:00
Tobias Hunger c74f6f85ed fix(xattr): Handle labels without value
I stumbled over this with the very first image I tried:

> sudo systemd-pull oci --system quay.io/toolbx/arch-toolbox:latest

That failed with a label "user.overlay.origin" with a value of NULL and size 0.

This one-line change allows value == NULL if size == 0 when setting xattrs.

(cherry picked from commit 885fe07ee37cff7316680b5088d11081e01813b1)
2026-10-16 11:36:32 +01:00
Simon de Vlieger d5c945bddb dissect: relate verity partitions
When using `systemd.image_filter=usr=250` a `/usr` was selected based on
its label but the corresponding verity partitions were *not* selected
based on their (potential labels).

This leads to mismatched verity partitions and `dm-verity` failure when
using `image_filter` without also explicitly passing matching
`usr-verity` and `usr-verity-sig`.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
(cherry picked from commit b5326670faac3064bcfa01ae3c1d57565d387bfb)
2026-10-16 11:36:32 +01:00
Fredrik Hugosson b07c5a0639 analyze: Fix leading zero bug in decimals for tool tip in svg plot
Change-Id: If572cc593aa730de87510982613791d94d8f26b5
(cherry picked from commit a446e8ff2c)
2026-10-16 11:36:32 +01:00
Paul Meyer 6d80332e9a test: strip directory from subtest name in summary
The integration tests are started with the absolute path of the test
unit as $0, so run_subtests() derives absolute paths for the subtests
and the summary prints them in full. Show just the script name, the
directory is the same for every entry and only adds noise.

Signed-off-by: Paul Meyer <katexochen0@gmail.com>
(cherry picked from commit 0d1ae05a7f)
2026-10-16 11:36:32 +01:00
Robert Beckett ffb5f4bf45 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
(cherry picked from commit 4ca7ac0275)
2026-10-16 11:36:32 +01:00
Yu Watanabe 412876f581 test: add missing ASSERT_OK()
Follow-up for 3f4a43f0eb.

Addresses https://github.com/systemd/systemd/pull/43733#discussion_r4087916957

(cherry picked from commit 63850321af)
2026-10-16 11:36:32 +01:00
Michael Vogt 2bd3ff6e81 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.

(cherry picked from commit 1cf66d1c67)
2026-10-16 11:36:32 +01:00
Yu Watanabe 97b3c393bf 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.

(cherry picked from commit 77c51f4e97)
2026-10-16 11:36:32 +01:00
Totoro b0bac1d35b 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

(cherry picked from commit 3fe57d03a3)
2026-10-16 11:36:32 +01:00
Zbigniew Jędrzejewski-Szmek 25bf98c305 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

(cherry picked from commit 1f286f971e)
2026-10-16 11:36:32 +01:00
Duncan Overbruck 3ee0dcd754 crypto-util: BN_bn2bin asserts have side-effects
(cherry picked from commit 128416f305)
2026-10-16 11:36:32 +01:00
Yu Watanabe ba158ae568 test-ndisc-option: add a round trip test for ndisc options
Co-authored-by: Siteshwar Vashisht <svashisht@redhat.com>
(cherry picked from commit 3f4a43f0eb)
2026-10-16 11:36:32 +01:00
Yu Watanabe 220ab61cd2 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.

(cherry picked from commit b628909430)
2026-10-16 11:36:32 +01:00
Yu Watanabe 4bc4705b6b ndisc-option: drop unused argument
(cherry picked from commit 1299c9cc9e)
2026-10-16 11:36:32 +01:00
Siteshwar Vashisht 69b915a059 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)`.

(cherry picked from commit d3157f2a67)
2026-10-16 11:36:32 +01:00
Zbigniew Jędrzejewski-Szmek 43cd0e4004 NEWS: typo
(cherry picked from commit 7609c88df2)
2026-10-16 11:36:32 +01:00
Zbigniew Jędrzejewski-Szmek 6176a463f6 hostnamectl: drop space in synopsis
The standard spelling for args that can repeat is without the space.

(cherry picked from commit 244d9bb6c4)
2026-10-16 11:36:32 +01:00
Lennart Poettering 23e31ad577 sysinstall: correct end marker log message
Copypasta...

(cherry picked from commit 0bb2f138f4)
2026-10-16 11:36:32 +01:00
Heran Yang 9a4abe9909 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

(cherry picked from commit 2aed6d9ad7)
2026-10-16 11:36:32 +01:00
Yu Watanabe 64f2911bac 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.

(cherry picked from commit 830b60ae1f)
2026-10-16 11:36:32 +01:00
Yu Watanabe ae6dc22b40 network: disable IPv4ACD when the address request is cancelled
If an address with IPv4ACD is requested, then sd_ipv4acd instance for
the address is configured. If the request is cancelled, we should
also disable the IPv4ACD instance.

Note, if the address is already configured, the IPv4ACD instance for the
address will be removed when the address is removed. See address_drop().

(cherry picked from commit c5bf6bac23)
2026-10-16 11:36:32 +01:00
Yu Watanabe 773592d77d network: add a configuration-source filter to link_drop_requests()
Preparation for later changes.

(cherry picked from commit 4be31a9c35)
2026-10-16 11:36:32 +01:00
Alberto Planas 365f24a571 test: check the credentials Varlink error table
credentials_varlink_error_by_errno() answers with the first row whose errno
matches, so two rows sharing one errno make the second unreachable and the
client is told the wrong error. This series re-keys UnexpectedPCRState to
EPERM and adds PCRsKeptChanging on EUCLEAN, so walk the table by id and check
that the errno lookup comes back to the same row, in both errno signs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit 827099139b)
2026-10-16 11:36:32 +01:00
Alberto Planas 9bb8d8de9a tpm2-util: retry NvPCR initialization when PCR values keep changing
tpm2_nvpcr_initialize() already retries the initializing write when
tpm2_extend_nvpcr_nv_index() reports that PCR values changed under its
feet, which the comment there attributes to IMA measurements performed
by the kernel.  The policy session that write needs is opened in the
same loop, and a PCR extended while that policy is submitted makes
tpm2_policy_pcr() return -EUCLEAN, which was propagated as a hard
failure instead.

That is the same transient condition observed one step earlier, so let
the loop absorb it too.

Signed-off-by: Alberto Planas <aplanas@suse.com>
(cherry picked from commit f08bfdbf3d)
2026-10-16 11:36:32 +01:00
Alberto Planas df12508d01 pcrlock: retry policy submission when PCR values keep changing
make_policy() already retries unsealing the recovery PIN when the TPM
reports that PCR values changed, but the tpm2_policy_super_pcr() call
that builds the policy for that unseal attempt was not covered: a
concurrent PCR extension there aborted the whole operation on the first
try.

This is easy to hit when IMA is enabled (e.g. implicitly through secure
boot), as PCR 10 is extended for every kernel module that gets loaded.

Retry that step within the existing loop, and give the retry budget a
name while at it.

Signed-off-by: Alberto Planas <aplanas@suse.com>
(cherry picked from commit 299989fe0b)
2026-10-16 11:36:32 +01:00
Alberto Planas 5f28c87fb6 tpm2-util: log transient PCR changes in tpm2_policy_super_pcr() at debug level
tpm2_policy_pcr() returns -EUCLEAN when the TPM's global PCR update
counter moved while the policy was being submitted, not when the
recorded PCR values disagree with the current state.  Logging "Either
the system has been tampered with or the provided policy is incorrect"
at error level is therefore wrong, and it is noisy too: the condition is
transient and callers are expected to restart the policy session.

Downgrade both occurrences to debug and describe what actually happened,
and document the contract at the declarations.

Signed-off-by: Alberto Planas <aplanas@suse.com>
(cherry picked from commit 1fc5351945)
2026-10-16 11:36:32 +01:00
Alberto Planas 9c420c2f03 creds: don't report a malformed PCR signature file as changing PCRs
tpm2_load_pcr_signature() propagates the JSON parser's errno, and the
parser reports a string that is not valid UTF-8 as -EUCLEAN.  With
EUCLEAN now mapping to io.systemd.Credentials.PCRsKeptChanging, such a
file would be reported as if a PCR were being extended continuously.

Translate it where it originates, so that the errno stays single valued
for every caller of tpm2_load_pcr_signature() and not only for the creds
one: a signature file that cannot be parsed is -EBADMSG, whichever way
it is malformed.  A syntax error used to come out as -EINVAL, which
matched nothing on the way out either.

Signed-off-by: Alberto Planas <aplanas@suse.com>
(cherry picked from commit 2994ca5226)
2026-10-16 11:36:32 +01:00
Alberto Planas a30858ebc3 creds: add io.systemd.Credentials.PCRsKeptChanging error
io.systemd.Credentials.UnexpectedPCRState used to be mapped to EUCLEAN,
which now means "a PCR kept being extended while unsealing" rather than
"the PCR state does not match the policy".  Map it to EPERM instead,
which is one of the errnos ERRNO_IS_NEG_TPM2_UNSEAL_BAD_PCR() covers,
and introduce a separate PCRsKeptChanging error for EUCLEAN.

Also report the condition explicitly in decrypt_credential_and_warn(),
like the other TPM2 unseal callers do.

Signed-off-by: Alberto Planas <aplanas@suse.com>
(cherry picked from commit 42f3ac664a)
2026-10-16 11:36:32 +01:00
Alberto Planas 1e3fa26b7c cryptsetup,cryptenroll: report continuously changing PCRs explicitly
tpm2_unseal() returns -EUCLEAN specifically when a PCR kept being
extended while unsealing, but the unseal callers no longer catch it
via ERRNO_IS_NEG_TPM2_UNSEAL_BAD_PCR() and would fall back to the
generic "Failed to unseal secret using TPM2" message.

Give it a message of its own instead, so that the log points at the
actual cause instead of suggesting the system was tampered with.

Signed-off-by: Alberto Planas <aplanas@suse.com>
(cherry picked from commit 941db14b8e)
2026-10-16 11:36:32 +01:00
Alberto Planas c3fdb3ec2e tpm2-util: make -EUCLEAN from tpm2_unseal() mean "PCRs kept changing"
So far tpm2_unseal() used -EUCLEAN together with the errors that
signal that the PCR state does not match the policy.  That is
misleading: -EUCLEAN (and TPM2_RC_PCR_CHANGED) is only ever generated
when the TPM's global PCR update counter moves while we are building the
policy or unsealing, i.e. when something on the system extends a PCR
concurrentlyi (usually IMA extending PCR 10).  It says nothing about
whether the policy itself matches.

Until now the retry loop only recognized those conditions while retries
were left (i > 0), and once the budget was exhausted the last iteration
fell through to the generic paths, reporting either an unrelated policy
error or -ENOTRECOVERABLE.  Handle the last iteration explicitly instead,
and return -EUCLEAN with a message that names the actual problem.

Drop -EUCLEAN from ERRNO_IS_NEG_TPM2_UNSEAL_BAD_PCR(), it is not a "bad
PCR state" error.

Signed-off-by: Alberto Planas <aplanas@suse.com>
(cherry picked from commit 2d54e6b56e)
2026-10-16 11:36:32 +01:00
Yu Watanabe 7898414837 resolve: stop timer event source and detach from browser when a dnssd service is removed
Otherwise, if the timer event source is enabled, a new query may be
invoked by the already removed service.

This also renames dns_remove_service() to dnssd_discovered_service_detach(),
and drops unused DnssdDiscoveredService.query.

(cherry picked from commit 02f65ebead)
2026-10-16 11:36:32 +01:00