Commit Graph
85809 Commits
Author SHA1 Message Date
Mike Yuan 1886047e59 fdset: sort includes 2026-01-21 15:49:58 +01:00
Mike Yuan 382382a6eb sysupdate-resource: on hash mismatch the best before marker is not ignored
Hence use a less ambiguous wording.

Follow-up for d0badc0a61
Addresses https://github.com/systemd/systemd/pull/40393#discussion_r2709953179
2026-01-21 15:48:14 +01:00
Vunny Sodhi db4b6b7043 pam_systemd_home: Use PAM_TEXT_INFO for token prompts
The prompts asking the user to physically authenticate
or confirm presence on a security token are informational
requests for action, not error conditions.

This commit changes the message type to PAM_TEXT_INFO,
which is more appropriate for guiding the user through
the authentication process.
2026-01-21 14:18:15 +01:00
AshishKumar Mishra 89065ada83 shared/fdset: add detailed debug logging to fdset_new_fill()
Currently, when fdset_new_fill() fails to open /proc/self/fd or
encounters an error while processing individual file descriptors
(such as fcntl or fstat failures), it returns a silent error code.

For debugging rarely reproducible failures it becomes difficult to
know the exact cause of failure
This commit updates the function to use log_debug_errno() for all
error paths and hence  provides better visibility into why FD collection
failed, including the path of the problematic FD (via fd_get_path)
and its inode type.
2026-01-21 20:11:23 +09:00
Daan De Meyer 81a43a44eb mkosi: Install libucontext in Arch/Fedora images
Split out of #39771

We don't use make use of libucontext yet but merging this early makes
sure my mkosi cached images don't get invalidated every time I switch
between my other work and the fiber branch.
2026-01-21 12:02:52 +01:00
Mike Yuan a9859a62f1 reread-partition-table: fix typo 2026-01-21 02:15:09 +01:00
Mike Yuan 14d4bb527c prompt-util: trivial header cleanups (#40407) 2026-01-21 01:38:19 +01:00
Mike Yuan dbd7555190 mkdir: reset mtime *after* fchown()
Follow-up for 34c3d57474

Also, drop pointless shortcut.
2026-01-21 08:35:31 +09:00
Mike Yuan 475c8a491f prompt-util: use our own sd-varlink header 2026-01-21 00:10:08 +01:00
Mike Yuan dca48de7ed prompt-util: drop unneeded inclusion of stdbool.h
Our -forward headers have it covered.
2026-01-21 00:09:49 +01:00
Lennart Poettering d0badc0a61 sysupdate: add simple "freshness" validation to systemd-sysupdate
In order to make "freeze" attacks against the update logic harder let's
add the ability to encode a "Best Before" date into SHA256SUMS directory
listings: if the current time is already beyond that time, we'll ignore
the SHA256SUMS as "stale" and fail the upgrade. Or in other words: the
freeze attack will now result in a client-side error eventually, instead
of success state.

The best before data is encoded in an optional pseudo-file listed in SHA256SUMS:
any file named BEST-BEFORE-YYYY-MM-DD.
2026-01-20 21:22:35 +01:00
Mike Yuan ba1a9c7b72 bootctl,sbsign: fix $SOURCE_DATE_EPOCH parsing (#40404)
A more comprehensive fix for #40403

Closes #40403
2026-01-20 19:13:50 +01:00
Mike Yuan f6edc81230 bootctl,sbsign: fix $SOURCE_DATE_EPOCH parsing
This fixes two things:

* $SOURCE_DATE_EPOCH is previously treated as usec, while it's in seconds
* >= 0 is passed to log_debug_errno(), triggering assertion

Replaces #40403
2026-01-20 15:54:55 +01:00
Mike Yuan 2f7fdef55e install-file: add a generalized parser for $SOURCE_DATE_EPOCH 2026-01-20 15:54:55 +01:00
Yu Watanabe e6a25c2fc7 stat-util: make proc_mounted() not update errno
Typically, proc_mounted() is used in error handling. Hence, it is better
to make it not update the original errno.

Currently, there are two places that returns wrong error code:
- pidref_get_capability() in src/basic/capability-util.c
```c
        _cleanup_fclose_ FILE *f = fopen(path, "re");
        if (!f) {
                if (errno == ENOENT && proc_mounted() == 0)
                        return -ENOSYS;

                return -errno;
        }
```
- fdset_new_fill() in src/shared/fdset.c
```c
        d = opendir("/proc/self/fd");
        if (!d) {
                if (errno == ENOENT && proc_mounted() == 0)
                        return -ENOSYS;

                return -errno;
        }
```

Rather than fixing them, let's make proc_mounted() not update errno,
otherwise we may make a similar failure in a future.
2026-01-20 22:37:04 +09:00
Mike Yuan e41d7de091 core/dbus-execute: fix memleak on Mount/ExtensionImages parse failure (#40398) 2026-01-20 03:10:34 +01:00
Mike Yuan ae039016f4 bless-boot-generator: skip if current system is entered via soft-reboot
Fixes #40386
2026-01-20 11:09:27 +09:00
Yu Watanabe 9503cc3b6d resolve: include current DNS server in JSON again (#40396)
Fixes a regression caused by c6b6ac63ea.
2026-01-20 09:41:51 +09:00
Mike Yuan f0f66976e7 core/dbus-execute: use strextendf_with_separator() where appropriate 2026-01-19 23:30:58 +01:00
Mike Yuan 00f459f30f core/dbus-execute: fix memleak on Mount/ExtensionImages parse failure
Define mount_image_free_many() in our usual fashion for use in
CLEANUP_ARRAY and ensure proper cleanup on error paths.
2026-01-19 23:22:32 +01:00
safforddr 331fef07d8 tpm2: allow use of recoverable sealing keys
In some use cases it is desirable to use a recoverable (ie duplicatable)
sealing key. Currently objects have the attribute TPMA_OBJECT_FIXEDTPM
and TPMA_OBJECT_FIXEDPARENT hard coded, which will not work with a
recoverable sealing key. This patch sets the object's attributes from
the sealing key's attributes, so that both types of sealing keys will work.
2026-01-19 22:00:45 +01:00
Lennart Poettering 9316e02c9d Introduce 'fixate-volume-key' option to repart/cryptsetup to pin the exact LUKS volume key hash (#40343)
Add an option to generate the expected volume key hash for LUKS volumes
by systemd-repart
and put it to crypttab, make systemd-cryptsetup check it upon attaching.
The format of the hash
matches what's currently being measured to TPM2 PCR with
tpm2-measure-pcr=.

Closes #40123
2026-01-19 21:59:47 +01:00
Lennart Poettering 3a0ddbe338 core: follow-ups for changes to MountOptions (#40395)
Follow-up for #39449
2026-01-19 21:59:19 +01:00
Lennart Poettering 799392286e sd-varlink: ensure that "any" actually means "any but null"
The new "any" type was implemented by accident that it actually meant
"any but null" – unless marked as "any?" in which case it actually meant
truly any, including null. The spec change in
https://github.com/varlink/varlink.github.io/pull/43 otoh suggested that
"any" really means anything, and "any?" apparently too.

I think the implementation in code makes more sense than the spec change
however, hence let's add some checks/tests to ensure the behaviour of
the code is made explicitly and cared for.

I will prep a spec change to make the spec follow the code on this too.

Follow-up for: #39918
2026-01-19 21:29:38 +01:00
Nick Rosbrook e06ee11150 test: check that currentServer field is set in resolvectl JSON status 2026-01-19 13:48:07 -05:00
Nick Rosbrook d990b426b9 resolve: include current DNS server in JSON again
The current_dns_server_json object in dns_configuration_json_append() is
always NULL, because the logic to dump the current DNS server to JSON
was removed by mistake in a re-factoring commit. Add that logic back.

Fixes c6b6ac63ea ("resolve: drop unnecessary preparation of empty arrays").
2026-01-19 13:29:52 -05:00
Yu Watanabe 8a5fb3627a vmspawn: use indexed loop
Previously, the index is obtained from the pointer offset. The
pointer offset is expressed by ptrdiff_t and may be different from
ssize_t.

Let's avoid to use FOREACH_ARRAY() but use an indexed loop.
This also renames `mount` to `m` to avoid conflict with `mount()`.

Fixes #40380.
2026-01-20 02:26:35 +09:00
Vitaly Kuznetsov 398acccb2a TEST-58-REPART: Add a test for fixate_folume_key
The test checks that the expected hash is correctly recorded to the
generated crypttab and also checks that systemd-cryptsetup handles
the option correctly.
2026-01-19 17:50:25 +01:00
Vitaly Kuznetsov 4754289ddf repart: Add fixate_volume_key crypttab option generation
Add an option to capture the expected LUKS volume key hash and
record it to the generated crypttab.
2026-01-19 17:50:25 +01:00
Vitaly Kuznetsov 69fab29ec4 cryptsetup: Add fixate-volume-key option to pin the expected volume key hash
The expected hash (SHA265 HMAC signature) uses the exact same algorithm which
is used to calculate sha256 PCR bank digest when 'tpm2-measure-pcr=' is used.
2026-01-19 17:49:39 +01:00
Mike Yuan e1388041c0 core/dbus-util: several cleanups for bus_read_mount_options()
* Make sure ret_options is initialized on success.
* Return empty mount options as-is rather than NULL-ing it -
  dbus property parser for RootImageOptions relies on it
  for resetting options for a specific partition designator.
* Format partition:options properly with strextendf, currently
  multiple ":" will be emitted.
* Allow separator to be unset if in_out_format_str is not
  needed.
2026-01-19 17:49:29 +01:00
Mike Yuan 079be1e71b core/varlink-execute: skip empty mount options
This keeps things in line with bus_append_mount_options().
2026-01-19 17:35:38 +01:00
Mike Yuan 831eb5453a core/dbus-execute: constify MountOptions 2026-01-19 17:35:37 +01:00
Mike Yuan bdfa039404 dissect-image: use consistent log level 2026-01-19 17:35:37 +01:00
Yu Watanabe 3d2284c7db journal/audit: do not use strjoina() for arbitrary length of received string
Otherwise, when a long message is received, the assertion in strjoina()
may be triggered.

Fixes oss-fuzz#476768320 (https://issues.oss-fuzz.com/issues/476768320).
Fixes #40388.
2026-01-20 01:29:32 +09:00
Luca Boccassi 2ba15493af portable: pin attached image via image-policy (#40152)
When attaching images generate a policy in the portable drop-in that
matches the partition types and content found while dissecting, so that
it can no longer be changed later without a reattach
2026-01-19 16:24:44 +00:00
Yu Watanabe 1580907953 audit-type: include alloc-util.h for newa() (#40389)
The macro audit_type_name_alloca() needs newa() which is defined in
alloc-util.h.
2026-01-19 16:31:39 +01:00
Yu Watanabe b7dd507cae tree-wide: use consistent format of short comment for constant argument
Follow-ups for recent changes after 93378148d4.
2026-01-20 00:22:15 +09:00
Luca Boccassi d059615492 portable: pin attached image via image-policy
When attaching images generate a policy in the portable drop-in
that matches the partition types and content found while dissecting,
so that it can no longer be changed later without a reattach.
2026-01-19 15:54:12 +01:00
Luca Boccassi 2258c93270 image-policy: add helper to create policy from dissected image
Pin policies to exactly what was found while dissecting
2026-01-19 15:47:15 +01:00
Luca Boccassi f639fb4b77 image-policy: add image_policy_union helper
Similar to image_policy_intersect but is the union of all used policies
instead
2026-01-19 15:47:15 +01:00
Yu Watanabe 67040ea2bc More legacy kernel support removal; follow-ups for XAT_FDROOT (#40384) 2026-01-19 23:10:17 +09:00
zefr0x 985a6fa44b busctl: handle --limit-messages option under the wait verb
Main focus was to not introduce breaking change or duplicated argument.
The `--limit-messages=` option that is used under the `monitor` verb is
reused here. However, both `wait` and `monitor` have contradicting
default behaviors, so it's not the cleanest thing to do.

There was some post-commit discussion about the API in #33961, but the
final name adopted in #34928 wasn't that flexible either to fit nicely
here in the `wait` verbe.

Additionally, there wasn't consideration in #34555 for having uniform
behavrious, so we ended with `wait` verb and `--limit-messages=` option,
rather than `receive` verb with default of continuously receving signals
withtout exit so `--limit-messages=` make more sence and be expectable.
2026-01-19 22:41:33 +09:00
Vitaly Kuznetsov f99f843f24 tpm2-util: make tpm2_pcr_extend_bytes() declaration match its implementation
tpm2_pcr_extend_bytes() has differences in parameter names between the
declaration and the implementation, in particular, 'event' in the header is
named 'event_type' in the implementation.
2026-01-19 13:52:33 +01:00
Mike Yuan 1a0df07843 core/cgroup: obsolete DefaultMemoryMin/Low=
Now that our kernel baseline is v5.7 and memory_recursiveprot
is universally enabled, remove userspace workarounds.
2026-01-19 13:33:28 +01:00
Mike Yuan d57fdbb5e2 core/cgroup: do not consider cgroup_context_has_io_config() if only IOAccounting=yes
This makes things in line with unit_has_memory_config(),
and suppresses pointless application of IO configs.
2026-01-19 13:33:28 +01:00
Mike Yuan 8292b859f3 core/cgroup: drop trusted.survive_final_kill_signal fallback for kernel < 5.7 2026-01-19 13:33:28 +01:00
Mike Yuan 6fd7c5ecdf core/namespace: remove availability checks for procfs hidepid=/subset= opts 2026-01-19 13:33:27 +01:00
Mike Yuan 5f90e4e4bc stat-util: O_NOCTTY is nop with O_PATH 2026-01-19 13:33:27 +01:00
Mike Yuan b0906b1216 stat-util: do not use RET_NERRNO for our own function
Follow-up for 95abe4beff
2026-01-19 13:33:27 +01:00