]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 days agolibsystemd-network: propagate sd_event_default() failure 42263/head
Chris Mason [Fri, 22 May 2026 16:13:55 +0000 (09:13 -0700)] 
libsystemd-network: propagate sd_event_default() failure

Four *_attach_event helpers swallow sd_event_default() failures and
return success while leaving obj->event NULL:

    sd_dhcp_client_attach_event   (sd-dhcp-client.c)
    sd_dhcp6_client_attach_event  (sd-dhcp6-client.c)
    sd_ndisc_attach_event         (sd-ndisc.c)
    sd_radv_attach_event          (sd-radv.c)

Each contains the same copy-pasted typo in the NULL-event branch:

    r = sd_event_default(&obj->event);
    if (r < 0)
            return 0;          /* swallows -ENOMEM / -ECHILD */

The caller is told the attach succeeded, but obj->event is still
NULL. A subsequent *_start() then trips assert_return(obj->event,
-EINVAL) and returns a spurious -EINVAL (or aborts on assert-abort
builds), and any consumer of *_get_event() dereferences NULL.

The sibling helper sd_dhcp_server_attach_event already uses the
correct pattern:

    r = sd_event_default(&server->event);
    if (r < 0)
            return r;

Fix by returning r instead of 0 at each of the four sites so the
sd_event_default() errno is propagated to the caller and ownership
stays with the caller.

Assisted-by: kres (claude-opus-4-7)
Signed-off-by: Chris Mason <clm@meta.com>
6 days agocore/exec-invoke: log write() allow-list widening
Chris Mason [Fri, 22 May 2026 16:15:50 +0000 (09:15 -0700)] 
core/exec-invoke: log write() allow-list widening

apply_syscall_filter() unconditionally inserts the write() syscall
into c->syscall_filter when exec_fd or handoff_timestamp_fd is in
use, so the parent can receive the exec status / handoff timestamp
from the child. When the unit configured a positive
SystemCallFilter= allow-list that deliberately omits write(), the
resulting widening of the operator's policy happens silently with
no trace in the journal.

Emit a log_debug() before the seccomp_filter_set_add_by_name() call
when syscall_allow_list is true, so the widening is at least
observable to operators inspecting the unit's debug log.

While here, document that mutating c->syscall_filter through a
'const ExecContext *c' is intentional: apply_syscall_filter() runs
only in the post-fork child, which owns a private copy of the
address space, so the hashmap change is never observed by the
manager.

No functional change for the allow-list itself; write() is still
added exactly as before.

Fixes: 84b79215ccc5 ("core: do not filter out write() if required in the very late stage")
Assisted-by: kres (claude-opus-4-7)
Signed-off-by: Chris Mason <clm@meta.com>
6 days agocore/exec-invoke: chdir("/") after chroot in apply_root_directory
Chris Mason [Fri, 22 May 2026 15:49:27 +0000 (08:49 -0700)] 
core/exec-invoke: chdir("/") after chroot in apply_root_directory

apply_root_directory() calls chroot() but never pairs it with a
chdir("/"). Moving cwd into the new root is left to the subsequent
apply_working_directory() call. That delegation breaks when the unit
sets WorkingDirectory=-/path (working_directory_missing_ok):

    apply_root_directory()              apply_working_directory()
      chroot(new_root)        -->         chdir(wd) fails (ENOENT)
      return 0                            return 0  /* missing_ok */

chroot(2) changes only the process root, not cwd. With cwd still
resolving to the pre-chroot host dentry, the process runs with the
kernel root pointing at the new root while relative-path accesses
and /proc/self/cwd reach paths outside RootDirectory=.

Only the chroot-only branch (exec_needs_mount_namespace() == false)
is affected. The mount-namespace branch uses pivot_root(), which
restructures the mount tree and makes the pre-chroot dentry
unreachable.

Fix by issuing chdir("/") immediately after the successful chroot()
in apply_root_directory() and propagating any failure with
EXIT_CHROOT, matching the standard chroot+chdir idiom and making
the chroot self-contained regardless of how
apply_working_directory() later handles a missing directory.

Assisted-by: kres (claude-opus-4-7)
Signed-off-by: Chris Mason <clm@meta.com>
6 days agosd-dhcp6-client: fix ref leak on duplicate option add
Chris Mason [Fri, 22 May 2026 16:14:51 +0000 (09:14 -0700)] 
sd-dhcp6-client: fix ref leak on duplicate option add

sd_dhcp6_client_add_option() and sd_dhcp6_client_add_vendor_option()
store the caller's sd_dhcp6_option in an ordered container whose value
destructor is sd_dhcp6_option_unref, registered via
DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR in dhcp6_option_hash_ops. The
container therefore owns exactly one ref per stored slot.

Both helpers guarded the ref bump only on r < 0:

    r = ordered_{hashmap,set}_ensure_put(..., v);
    if (r < 0)
            return r;
    sd_dhcp6_option_ref(v);

ordered_hashmap_ensure_put() (and the ordered_set wrapper) forward the
underlying hashmap_put_boldly tri-state verbatim: 1 on fresh insert, 0
when the identical key+value pair is already stored (no new slot
allocated), <0 on error. The r == 0 path fell through and bumped the
refcount without a corresponding slot.

The extra ref is permanently stranded once the container's destructor
runs. In a long-running networkd that reapplies .network files on
reload this leaks one sd_dhcp6_option allocation per duplicate-add.

Fix by tightening the guard to r <= 0 in both helpers, so
sd_dhcp6_option_ref(v) is reached only on a genuine new slot (r == 1).
Propagate the tri-valued result by returning r from both helpers
instead of a hard-coded constant.

sd_dhcp6_client_add_vendor_option() is a public libsystemd sd_ API;
its success return changes from a constant 1 to {0, 1}.
sd_dhcp6_client_add_option() now also propagates the tri-valued
result (previously a hard-coded 0 on success), giving the two parallel
helpers identical return contracts.

The sole non-fuzz in-tree callers are both in dhcp6_configure()
(src/network/networkd-dhcp6.c), which treat any r >= 0 as success and
do not distinguish 0 from 1, so the contract widening is caller-safe.

Fixes: e7d5fe17db9d ("DHCP client: make SendOption work for DHCPv6 too.")
Assisted-by: kres (claude-opus-4-7)
Signed-off-by: Chris Mason <clm@meta.com>
6 days agodissect-image: cast to uint64_t before *512 for sig lookup
Chris Mason [Fri, 22 May 2026 16:13:50 +0000 (09:13 -0700)] 
dissect-image: cast to uint64_t before *512 for sig lookup

In the PARTITION_ROOT_VERITY_SIG / PARTITION_USR_VERITY_SIG branch of
dissect_image(), the call to acquire_sig_for_roothash() passes the
partition offset and size as

    acquire_sig_for_roothash(fd,
                             start * 512,
                             size * 512,
                             &root_hash, NULL);

where start and size are blkid_loff_t (int64_t). The literal 512 is
int, so the multiplication is performed in int64_t and overflows for
LBA values in (INT64_MAX/512, INT64_MAX]. The overflowed signed result
is then converted to the uint64_t parameters of
acquire_sig_for_roothash(), yielding a near-UINT64_MAX
partition_offset that slips past the sole offset guard (an exact
== UINT64_MAX sentinel) and reaches pread() with a corrupt disk
offset. An overflowed partition_size would be rejected by the 4 MiB
EFBIG check at src/shared/dissect-image.c:710-712 before pread(); the
dangerous scenario is a corrupt offset combined with a legitimate
small size.

The three sibling call sites at src/shared/dissect-image.c:1284,
1589-1590 and 1671-1672 all cast to uint64_t before multiplying by
512; only this call site was missed.

Fix by casting start and size to uint64_t before the multiplication,
matching the sibling sites and making the arithmetic well-defined.

Fixes: 98ca65c36aa9 ("dissect: check that roothash in signature matches before selecting partition")
Assisted-by: kres (claude-opus-4-7)
Signed-off-by: Chris Mason <clm@meta.com>
6 days agodissect-image: fix wrong errno on pread failure
Chris Mason [Fri, 22 May 2026 16:23:03 +0000 (09:23 -0700)] 
dissect-image: fix wrong errno on pread failure

In acquire_sig_for_roothash() the pread() failure branch returns
-ENOMEM, which is copy-pasted from the malloc() check immediately
above it:

    _cleanup_free_ char *buf = new(char, partition_size+1);
    if (!buf)
            return -ENOMEM;

    ssize_t n = pread(fd, buf, partition_size, partition_offset);
    if (n < 0)
            return -ENOMEM;

pread() sets errno to the actual I/O failure (EIO, EINTR, EBADF,
...). Aliasing those to -ENOMEM misleads dissect_log_error() and
any caller that branches on the returned code; verity signature
lookup failures get reported as out-of-memory.

Fix by returning -errno from the pread() failure branch. The
malloc() branch above is correct and unchanged.

Fixes: 98ca65c36aa9 ("dissect: check that roothash in signature matches before selecting partition")
Assisted-by: kres (claude-opus-4-7)
Signed-off-by: Chris Mason <clm@meta.com>
6 days agodissect-image: fix swallowed open() error in mountfsd_make_directory
Chris Mason [Fri, 22 May 2026 16:15:04 +0000 (09:15 -0700)] 
dissect-image: fix swallowed open() error in mountfsd_make_directory

mountfsd_make_directory() opens the parent directory after a
successful path_extract_filename() call, but reports failure using
the stale path_extract_filename() return value:

    r = path_extract_filename(path, &dirname);
    if (r < 0)
            return log_debug_errno(r, ...);
    ...
    _cleanup_close_ int fd = open(parent, O_DIRECTORY|O_CLOEXEC);
    if (fd < 0)
            return log_debug_errno(r, "Failed to open '%s': %m", parent);

At the open() check site r holds the non-negative return of
path_extract_filename(). log_debug_errno() with a non-negative
first argument returns 0, so the function reports success even
though open() failed. Callers that pass a non-NULL ret_directory_fd
then consume an uninitialized fd value, and the diagnostic message
is suppressed because log_debug_errno(0, ...) emits nothing.

Fix by passing errno instead of r, matching the convention used in
mountfsd_mount_image() and mountfsd_mount_directory() in the same
file. The real open() failure (ENOENT, EACCES, ENOTDIR, EMFILE, ...)
now propagates to the caller and the log message is preserved.

Fixes: 1be8caa6be6f ("importd: support unpacking tarballs to foreign UID range")
Assisted-by: kres (claude-opus-4-7)
Signed-off-by: Chris Mason <clm@meta.com>
7 days agoupdate NEWS a bit more for v261
Lennart Poettering [Fri, 22 May 2026 15:10:02 +0000 (17:10 +0200)] 
update NEWS a bit more for v261

7 days agomeson: fix build with -Dmachine=false
Luca Boccassi [Fri, 22 May 2026 14:32:25 +0000 (15:32 +0100)] 
meson: fix build with -Dmachine=false

Fixes https://github.com/systemd/systemd/issues/42257

Follow-up for 5d0ac2c23c7063b219df9fce74bc8d8481cb6e7a

7 days agoman: add sd_varlink_connect_address() man page
Lennart Poettering [Fri, 22 May 2026 13:04:38 +0000 (15:04 +0200)] 
man: add sd_varlink_connect_address() man page

7 days agomeson: bump version to v261~rc1 v261-rc1
Luca Boccassi [Fri, 22 May 2026 13:21:32 +0000 (14:21 +0100)] 
meson: bump version to v261~rc1

7 days agoNEWS: finalize date and time
Luca Boccassi [Fri, 22 May 2026 13:20:46 +0000 (14:20 +0100)] 
NEWS: finalize date and time

7 days agoNEWS: list contributors
Luca Boccassi [Fri, 22 May 2026 13:20:10 +0000 (14:20 +0100)] 
NEWS: list contributors

7 days agoUpdate NEWS
Luca Boccassi [Fri, 22 May 2026 13:18:10 +0000 (14:18 +0100)] 
Update NEWS

7 days agosd-dhcp-server-lease: always update all information in bound lease
Yu Watanabe [Sun, 10 May 2026 13:29:47 +0000 (22:29 +0900)] 
sd-dhcp-server-lease: always update all information in bound lease

We manage bound leases by their client ID. Hence, potentially, other
fields may be changed. Let's always update all information.

7 days agopkcs11: switch to RSA-OAEP SHA-256/SHA-1
Luca Boccassi [Sun, 26 Apr 2026 17:56:52 +0000 (18:56 +0100)] 
pkcs11: switch to RSA-OAEP SHA-256/SHA-1

RSA PKCS#1 v1.5 is vulnerable to Bleichenbacher-style padding oracle
attacks, albeit very difficult and unlikely to actually happen in the
real world. Still for hardedning, switch new enrollments to RSA-OAEP,
with SHA-256 preferred and SHA-1 as fallback (probed at enrollment time,
since e.g. SoftHSM only accepts SHA-1, and older token might as well).

The actual padding scheme used to wrap a given key is recorded as a new
optional 'pkcs11-padding' / 'padding' field in the LUKS2 token JSON and
the homed user record. Decryption defaults to PKCS#1 v1.5 when absent so
existing enrollments keep working.

7 days agosysupdate: List default component only if transfer definition exists (#42179)
Luca Boccassi [Fri, 22 May 2026 13:07:06 +0000 (14:07 +0100)] 
sysupdate: List default component only if transfer definition exists (#42179)

`sysupdate --json=short components` lists the components known to
sysupdate; these are the components which something like `updatectl`
will try to update.

The `default` component represents the host, and is meant to be listed
if transfer definitions exist in (for example) `/etc/sysupdate.d`
corresponding to the host OS. This then corresponds to `TARGET_HOST` in
`updatectl` and causes it to try updating that target.

The logic for working out whether the `default` component was present
essentially boiled down to “does `{/run,/etc,/usr/lib}/sysupdate.d`
exist”, and it didn’t check whether a `.transfer` or `.conf` file
actually existed in the config directory.

This is quite the corner case, but becomes more evident on systems where
sysupdate is being used to update a portable service but not the main
OS. At that point, if `/etc/sysupdate.d` exists empty (for some reason),
`updatectl` falls over because it starts trying to update the host OS
without any configuration to do so.

So, modify `sysupdate` to more fully load the available configuration
when listing components, and query it a bit more deeply to check whether
a default component exists.

If `sysupdate` is called with various command line arguments to affect
how its configuration is loaded, do *not* say that a default component
exists, as these arguments essentially anull the possibility of a
default being used in that process.

Add an integration test based on the reproducer provided by the issue
reporter. This test has been tested to fail if the changes to
`sysupdate.c` aren’t applied — if so, the second call to `sysupdate
components` would return
`{"default":true,"components":["some-component"]}`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: https://github.com/systemd/systemd/issues/41501
7 days agobootctl: refactor get_file_version() (#42246)
Luca Boccassi [Fri, 22 May 2026 12:50:36 +0000 (13:50 +0100)] 
bootctl: refactor get_file_version() (#42246)

7 days agonsresourced: Verify user namespace identity on registry lookup (#42224)
Daan De Meyer [Fri, 22 May 2026 12:31:03 +0000 (14:31 +0200)] 
nsresourced: Verify user namespace identity on registry lookup (#42224)

7 days agoreport-basic: add a bunch more essential metrics (#42248)
Luca Boccassi [Fri, 22 May 2026 12:29:08 +0000 (13:29 +0100)] 
report-basic: add a bunch more essential metrics (#42248)

7 days agotpm2: measure user records on first login (#42228)
Luca Boccassi [Fri, 22 May 2026 12:28:33 +0000 (13:28 +0100)] 
tpm2: measure user records on first login (#42228)

This is useful so that we can "blow a fuse" in TPM policies once a user
logged in.

7 days agosd-dhcp-server: update conditions when we should send DHCPNAK (#42252)
Yu Watanabe [Fri, 22 May 2026 11:02:17 +0000 (20:02 +0900)] 
sd-dhcp-server: update conditions when we should send DHCPNAK (#42252)

7 days agotest: cover LUO serialize-side anti-hijack guard in TEST-91
Rocker Zhang [Thu, 21 May 2026 16:02:51 +0000 (00:02 +0800)] 
test: cover LUO serialize-side anti-hijack guard in TEST-91

manager_luo_serialize_fd_stores() refuses to serialize a unit fd store
entry that holds a child LUO session named like PID 1's own ("systemd"),
to stop a service from hijacking PID 1's reserved session namespace
across kexec. That guard had no test coverage.

Add a test-luo store-hijack/check-hijack subcommand pair: on the first
boot a system service preserves a child LUO session named "systemd" in
its fd store; after kexec the test asserts the entry was not restored --
the unit's NFileDescriptorStore is 0, and check-hijack, run as the unit's
own second-boot ExecStart, confirms the hijack fd is absent from its
restored LISTEN_FDNAMES -- proving PID 1 skipped it during serialization.

The restore-side guards (corrupt mapping, reserved token 0, invalid unit
name, missing child session) are intentionally not covered: they only run
against PID 1's own "systemd" session built by luo_preserve_fd_stores(),
which a cooperating userspace helper cannot corrupt without racing or
displacing PID 1 (it single-owns /dev/liveupdate at shutdown). Triggering
them reliably would need kernel fault injection.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
7 days agodhcp-server-request: drop unused value in DHCPRequest
Yu Watanabe [Sun, 10 May 2026 13:33:00 +0000 (22:33 +0900)] 
dhcp-server-request: drop unused value in DHCPRequest

7 days agosysupdate: List default component only if transfer definition exists 42179/head
Philip Withnall [Tue, 19 May 2026 14:46:36 +0000 (15:46 +0100)] 
sysupdate: List default component only if transfer definition exists

`sysupdate --json=short components` lists the components known to
sysupdate; these are the components which something like `updatectl`
will try to update.

The `default` component represents the host, and is meant to be listed
if transfer definitions exist in (for example) `/etc/sysupdate.d`
corresponding to the host OS. This then corresponds to `TARGET_HOST` in
`updatectl` and causes it to try updating that target.

The logic for working out whether the `default` component was present
essentially boiled down to “does `{/run,/etc,/usr/lib}/sysupdate.d`
exist”, and it didn’t check whether a `.transfer` or `.conf` file
actually existed in the config directory.

This is quite the corner case, but becomes more evident on systems where
sysupdate is being used to update a portable service but not the main
OS. At that point, if `/etc/sysupdate.d` exists empty (for some reason),
`updatectl` falls over because it starts trying to update the host OS
without any configuration to do so.

So, modify `sysupdate` to more fully load the available configuration
when listing components, and query it a bit more deeply to check whether
a default component exists.

If `sysupdate` is called with various command line arguments to affect
how its configuration is loaded, do *not* say that a default component
exists, as these arguments essentially anull the possibility of a
default being used in that process.

Add an integration test based on the reproducer provided by the issue
reporter. This test has been tested to fail if the changes to
`sysupdate.c` aren’t applied — if so, the second call to `sysupdate
components` would return
`{"default":true,"components":["some-component"]}`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: https://github.com/systemd/systemd/issues/41501
7 days agosysupdate: Add a flag to control error behaviour in internal function
Philip Withnall [Thu, 21 May 2026 10:17:56 +0000 (11:17 +0100)] 
sysupdate: Add a flag to control error behaviour in internal function

Optionally prevent `context_read_definitions()` erroring out if zero
transfer definitions were found.

This commit makes no functional changes (the flag is always passed to
calls to `context_make_offline()` for the moment), but the new flag will be
used in the following commit.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: https://github.com/systemd/systemd/issues/41501

7 days agosysupdate: Convert an internal bool argument to flags
Philip Withnall [Thu, 21 May 2026 10:14:01 +0000 (11:14 +0100)] 
sysupdate: Convert an internal bool argument to flags

This commit makes no functional changes, but the new flags will be
used and extended in the following commit. We need a flags variable to
avoid having two bool arguments, which would be confusing.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: https://github.com/systemd/systemd/issues/41501

7 days agobootctl: refactor get_file_version() to use proper PE parsing 42246/head
Lennart Poettering [Fri, 22 May 2026 02:34:54 +0000 (04:34 +0200)] 
bootctl: refactor get_file_version() to use proper PE parsing

This irked me for a while. Let's not scan for strings stupidly, but
properly parse PE files to find the magic marker.

It's easy with our own PE APIs, hence we should do it.

This moves logging to the callers (previously, this was all mixed up).

7 days agope-binary: tweak pe_read_section_data() error codes
Lennart Poettering [Fri, 22 May 2026 02:36:15 +0000 (04:36 +0200)] 
pe-binary: tweak pe_read_section_data() error codes

Let's return -EBADMSG if the PE headers reference stuff missing in the
file, regardless if that's because the offsets are larger than SSIZE_MAX
or just larger than the file size. We generally use EBADMSG for all
cases we deem the file to not be a conformant PE file, and these two
cases are the same. Hence, let's be systematic here.

7 days agoreport-basic: report TPM2 vendor strings too 42248/head
Lennart Poettering [Fri, 22 May 2026 03:49:38 +0000 (05:49 +0200)] 
report-basic: report TPM2 vendor strings too

This is highly relevant to debug/analyze TPM related behaviour, hence
let's report this as part of the metrics.

7 days agoreport-basic: also report confidential computing tech
Lennart Poettering [Fri, 22 May 2026 03:39:57 +0000 (05:39 +0200)] 
report-basic: also report confidential computing tech

7 days agoreport-basic: report various SMBIOS fields as metrics, too
Lennart Poettering [Fri, 22 May 2026 03:34:28 +0000 (05:34 +0200)] 
report-basic: report various SMBIOS fields as metrics, too

This are pretty fundamental hw fields, let's make them available.

7 days agoreport-basic: also report /etc/machine-info fields, just like os-release fields
Lennart Poettering [Fri, 22 May 2026 03:05:51 +0000 (05:05 +0200)] 
report-basic: also report /etc/machine-info fields, just like os-release fields

The TAGS= field is really nice to have in reports, hence make this a
thing.

7 days agoupdate TODO 42228/head
Lennart Poettering [Thu, 21 May 2026 12:51:58 +0000 (14:51 +0200)] 
update TODO

7 days agoci: add simple test case for new logic
Lennart Poettering [Thu, 21 May 2026 12:49:25 +0000 (14:49 +0200)] 
ci: add simple test case for new logic

7 days agodocs: document new measurement
Lennart Poettering [Thu, 21 May 2026 12:48:59 +0000 (14:48 +0200)] 
docs: document new measurement

7 days agologind: automatically pull in systemd-pcrlogin@.service on first login
Lennart Poettering [Thu, 21 May 2026 12:48:29 +0000 (14:48 +0200)] 
logind: automatically pull in systemd-pcrlogin@.service on first login

7 days agopcrextend: add support for measuring a user record, to be executed on first login...
Lennart Poettering [Thu, 21 May 2026 12:47:59 +0000 (14:47 +0200)] 
pcrextend: add support for measuring a user record, to be executed on first login of the user

This is supposed to be useful to mark an interactive user login as a
"break glass" event in the measurement logs, i.e. as in many typically
headless scenerios this indicates debug access or similar.

7 days agopcrextend: port to help-util.[ch] APIs
Lennart Poettering [Fri, 22 May 2026 01:51:12 +0000 (03:51 +0200)] 
pcrextend: port to help-util.[ch] APIs

7 days agosysupdate: Add separate polkit actions for cancellation (#42209)
Lennart Poettering [Fri, 22 May 2026 08:35:49 +0000 (10:35 +0200)] 
sysupdate: Add separate polkit actions for cancellation (#42209)

This allows us to have a separate, more permissive, policy for
cancelling ongoing sysupdate jobs. The new default policy for
cancellation actions is to allow them for the active user, without admin
authentication, because typically the user can just pull the plug on the
computer to cancel a job anyway.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: https://github.com/systemd/systemd/issues/38568
7 days agoefi-api: fix unaligned access in efi_guid_to_id128()
Daan De Meyer [Thu, 21 May 2026 22:00:28 +0000 (22:00 +0000)] 
efi-api: fix unaligned access in efi_guid_to_id128()

EFI_GUID requires 4-byte alignment due to its uint32_t Data1 field, but
callers may pass pointers at arbitrary offsets into serialized EFI
variable buffers (e.g. bootctl walking BootXXXX entries). UBSan flagged
the misaligned member access; the old comment claiming the struct was
packed was wrong. Copy the bytes into an aligned local first.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
7 days agohwdb: reject out-of-bounds fnmatch prefixes
Luca Boccassi [Thu, 21 May 2026 22:24:32 +0000 (23:24 +0100)] 
hwdb: reject out-of-bounds fnmatch prefixes

Ensure that fnmatch traversal doesn't go off the hwdb.bin in case of
a corrupted file

Originally reported on yeswehack.com as #YWH-PGM9780-70

For the unit test:
Co-developed-by: GitHub Copilot <github-copilot[bot]@users.noreply.github.com>
7 days agodhcp-server-request: rename dhcp_server_handle_message() -> dhcp_server_process_message() 42252/head
Yu Watanabe [Sun, 10 May 2026 16:49:56 +0000 (01:49 +0900)] 
dhcp-server-request: rename dhcp_server_handle_message() -> dhcp_server_process_message()

Then, make it take struct iovec.
No functional change, just refactoring.

7 days agodhcp-server-request: rework when we should reply DHCPNAK
Yu Watanabe [Sun, 10 May 2026 15:26:33 +0000 (00:26 +0900)] 
dhcp-server-request: rework when we should reply DHCPNAK

Previously, DHCPNAK was sent only when the client is in INIT-REBOOT
state. But, on selecting or renewing, the request is directed to a
specific server, so we can safely reply with DHCPNAK.

Also, verify existing bound lease even when there is no static lease for
the client.

7 days agodhcp-server-request: logs more when received invalid messages
Yu Watanabe [Sun, 10 May 2026 15:25:02 +0000 (00:25 +0900)] 
dhcp-server-request: logs more when received invalid messages

7 days agodhcp-server-request: also save IP_PKTINFO of received message
Yu Watanabe [Sun, 10 May 2026 14:04:15 +0000 (23:04 +0900)] 
dhcp-server-request: also save IP_PKTINFO of received message

It will be used later.

This also drops redundant ifindex check, as the socket is already
initialized with socket_bind_to_ifindex().

7 days agosd-dhcp-server: use sd_dhcp_message to parse/build DHCP messages (#42240)
Yu Watanabe [Fri, 22 May 2026 06:28:52 +0000 (15:28 +0900)] 
sd-dhcp-server: use sd_dhcp_message to parse/build DHCP messages (#42240)

7 days agosd-dhcp-server: drop unused enum
Yu Watanabe [Fri, 22 May 2026 00:43:11 +0000 (09:43 +0900)] 
sd-dhcp-server: drop unused enum

Follow-up for 2e5580a8c12427ddf421b7fee7be3677ff41bd5b.

7 days agosd-dhcp-server: use sd_dhcp_message object on sending reply 42240/head
Yu Watanabe [Sun, 10 May 2026 13:17:05 +0000 (22:17 +0900)] 
sd-dhcp-server: use sd_dhcp_message object on sending reply

This also makes the conditions in dhcp_server_send_message() uses
the message that will be sent, rather than we received.

This does not change basic functionality, but changes/fixes several
minor behaviors, e.g.
- fix when the broadcast flag assignment,
- set server identifier in DHCPFORCERENEW.

7 days agosd-dhcp-server: use sd_dhcp_message to parse received messages
Yu Watanabe [Thu, 7 May 2026 04:30:00 +0000 (13:30 +0900)] 
sd-dhcp-server: use sd_dhcp_message to parse received messages

This is mostly refactoring. This does not change basic behavior, but
changes/fixes some minor/corner cases, e.g.

- extend the minimum default lease time from 1 second to 30 seconds, as
  1 second is too short and causes the network unstable (though 30
  seconds is stll too short, but hopefully that does not make the
  network unstable).
- error code on broken/malicious message received may be changed.

7 days agodhcp-server-request: drop invalid short-cut logic
Yu Watanabe [Mon, 18 May 2026 00:37:27 +0000 (09:37 +0900)] 
dhcp-server-request: drop invalid short-cut logic

Even if no pool is allocated, the server may have a static lease
matching with the DHCPDISCOVER message.

7 days agodhcp: move definition of enum DHCPState to dhcp-protocol.[ch]
Yu Watanabe [Sun, 10 May 2026 14:13:07 +0000 (23:13 +0900)] 
dhcp: move definition of enum DHCPState to dhcp-protocol.[ch]

It will be also used in DHCP server, later.

7 days agosd-dhcp-relay: use forward declarations
Yu Watanabe [Thu, 21 May 2026 22:10:46 +0000 (07:10 +0900)] 
sd-dhcp-relay: use forward declarations

7 days agosd-dhcp-server: several trivial cleanups (#42235)
Yu Watanabe [Thu, 21 May 2026 21:44:07 +0000 (06:44 +0900)] 
sd-dhcp-server: several trivial cleanups (#42235)

This should mostly not change behavior, except for some corner cases.
Just refactoring and preparation for later changes.

7 days agoUpdate NEWS
Luca Boccassi [Thu, 21 May 2026 20:59:17 +0000 (21:59 +0100)] 
Update NEWS

7 days agobootctl: add A/B fallback for sd-boot updates (#41650)
Luca Boccassi [Thu, 21 May 2026 20:56:05 +0000 (21:56 +0100)] 
bootctl: add A/B fallback for sd-boot updates (#41650)

On `bootctl install`, two EFI boot entries are registered: one for the
primary sd-boot binary and one for a fallback. On `bootctl update`, the
existing primary binary is rotated to the fallback path before the new
version is installed, so the fallback entry always points to the
previous known-good binary.

```
$ sudo bootctl install
...
Created EFI boot entry "Linux Boot Manager".
Created EFI boot entry "Fallback Linux Boot Manager".
$ sudo bootctl update
Copied "/boot/EFI/systemd/systemd-bootaa64.efi" to "/boot/EFI/systemd/systemd-boot-fallbackaa64.efi".
Copied "/usr/lib/systemd/boot/efi/systemd-bootaa64.efi" to "/boot/EFI/systemd/systemd-bootaa64.efi".
$ efibootmgr
...
Boot0004* Linux Boot Manager        HD(...)/\EFI\systemd\systemd-bootaa64.efi
Boot0005* Fallback Linux Boot Manager     HD(...)/\EFI\systemd\systemd-boot-fallbackaa64.efi
```

Fixes: #23805
7 days agoUpdate NEWS
Luca Boccassi [Thu, 21 May 2026 20:49:22 +0000 (21:49 +0100)] 
Update NEWS

7 days agoboot,stub: explicitly measure select SMBIOS objects (#42233)
Luca Boccassi [Thu, 21 May 2026 20:44:42 +0000 (21:44 +0100)] 
boot,stub: explicitly measure select SMBIOS objects (#42233)

This is supposed to protect our SMBIOS type 11 importing for
credentials. Note that firmwares are supposed to measure SMBIOS anyway
to PCR 1. Alas firmware doesn't really do that in various cases. Hence
let's do so again, for select objects.

This closes a gap where some of the input for OS (i.e. system
credentials places in smbios11) isn't measured properly.

(I really want this to get into v261, because this will fuck up the PCRs
a bit more, and we already have the new separator measurement in v261,
hence there's value in getting this merged at the same time, so that we
don't break the measurements a 2nd time)

7 days agoupdate TODO 42233/head
Lennart Poettering [Thu, 21 May 2026 15:13:40 +0000 (17:13 +0200)] 
update TODO

7 days agopcrlock: port --help to help-util.[ch] apis
Lennart Poettering [Thu, 21 May 2026 16:16:32 +0000 (18:16 +0200)] 
pcrlock: port --help to help-util.[ch] apis

7 days agopcrlock: decode new smbios events
Lennart Poettering [Thu, 21 May 2026 16:16:45 +0000 (18:16 +0200)] 
pcrlock: decode new smbios events

7 days agobootctl: show SMBIOS feature flags
Lennart Poettering [Thu, 21 May 2026 15:27:13 +0000 (17:27 +0200)] 
bootctl: show SMBIOS feature flags

7 days agodocs: document the new smbios measurements
Lennart Poettering [Thu, 21 May 2026 15:26:20 +0000 (17:26 +0200)] 
docs: document the new smbios measurements

7 days agoUpdate NEWS
Luca Boccassi [Thu, 21 May 2026 20:13:10 +0000 (21:13 +0100)] 
Update NEWS

7 days agoUse malloc'ed strings instead of static libc buffers for user and group lookup (...
Yu Watanabe [Thu, 21 May 2026 20:09:56 +0000 (05:09 +0900)] 
Use malloc'ed strings instead of static libc buffers for user and group lookup (#42184)

Preparation for other work.

7 days agohostnamed,pid1,firstboot: introduce "machine tags" concept (#42223)
Luca Boccassi [Thu, 21 May 2026 19:57:34 +0000 (20:57 +0100)] 
hostnamed,pid1,firstboot: introduce "machine tags" concept (#42223)

Fixes: #38591
7 days agoci: ignore failures to chown journal in GHA jobs
Luca Boccassi [Thu, 21 May 2026 18:21:19 +0000 (19:21 +0100)] 
ci: ignore failures to chown journal in GHA jobs

Otherwise when the build fails, this fails, and the GUI jumps to the
chown failure instead of the actual failure

Follow-up for 35bf1c826454bfcaa3c93cae950d36fa216ac3ce

7 days agodhcp-server-request: check server address in DHCPDECLINE and DHCPRELEASE 42235/head
Yu Watanabe [Thu, 7 May 2026 03:19:25 +0000 (12:19 +0900)] 
dhcp-server-request: check server address in DHCPDECLINE and DHCPRELEASE

Otherwise, we may do something wrong by messages for another DHCP server.
Let's silently ignore messages with unmatching server identifier.

Also, logs something when we receive DHCPRELEASE but found lease does
not match the reported address.

7 days agosd-dhcp-server: store more information in DHCPRequest
Yu Watanabe [Thu, 7 May 2026 02:59:23 +0000 (11:59 +0900)] 
sd-dhcp-server: store more information in DHCPRequest

This makes DHCPRequest stores
- the message type of the received message,
- acquired address,
- found static DHCP lease,

This also moves call of dhcp_request_get_lifetime_timestamp() from
dhcp_server_ack() to dhcp_server_set_lease(), and rename
DHCPRequest.server_id -> .server_address.

No functional change, just refactoring.

7 days agosd-dhcp-server: use struct hw_addr_data to manage client hardware address parsed...
Yu Watanabe [Mon, 4 May 2026 19:55:03 +0000 (04:55 +0900)] 
sd-dhcp-server: use struct hw_addr_data to manage client hardware address parsed from DHCP message

Then, this drops garbage in DHCP server lease in DBus and Varlink message.

This also drops fallback to use client ID as hardware address when chaddr
field is not set. In that case, we should broadcast reply.

7 days agodhcp-server-send: rework sending DHCP reply message
Yu Watanabe [Mon, 4 May 2026 13:08:40 +0000 (22:08 +0900)] 
dhcp-server-send: rework sending DHCP reply message

This should mostly not change anything, except for some corner cases.
Just refactoring.

7 days agosd-dhcp-server: make IP service type (TOS) configurable
Yu Watanabe [Thu, 7 May 2026 03:41:38 +0000 (12:41 +0900)] 
sd-dhcp-server: make IP service type (TOS) configurable

7 days agosd-dhcp-server: refactoring for socket fd handling
Yu Watanabe [Mon, 4 May 2026 10:57:49 +0000 (19:57 +0900)] 
sd-dhcp-server: refactoring for socket fd handling

This makes
- UDP socket fd is owned by IO event source,
- open RAW socket fd just before sending first packet,
- set TOS and socket priority,
- use AF_UNIX soxket pair in the unit test and fuzzer, so the unit test
  can now run by unprivileged user.

7 days agodhcp-serve-request: move message size check to dhcp_server_handle_message()
Yu Watanabe [Mon, 4 May 2026 21:57:33 +0000 (06:57 +0900)] 
dhcp-serve-request: move message size check to dhcp_server_handle_message()

7 days agodhcp-server-request: modernize server_receive_message()
Yu Watanabe [Mon, 4 May 2026 07:59:04 +0000 (16:59 +0900)] 
dhcp-server-request: modernize server_receive_message()

7 days agosd-dhcp-server: split into small pieaces
Yu Watanabe [Mon, 4 May 2026 04:24:33 +0000 (13:24 +0900)] 
sd-dhcp-server: split into small pieaces

No functional change, just several functions are moved/split/renamed.

7 days agotest-dhcp-server: several cleanups
Yu Watanabe [Mon, 4 May 2026 11:42:27 +0000 (20:42 +0900)] 
test-dhcp-server: several cleanups

No effective change, just rafactoring.

7 days agomeson: Add libucontext to libshared_deps
Daan De Meyer [Thu, 21 May 2026 17:51:07 +0000 (17:51 +0000)] 
meson: Add libucontext to libshared_deps

Fixes #42236

7 days agobootctl: remove fallback EFI Boot#### variable on uninstall 41650/head
Clayton Craft [Thu, 30 Apr 2026 03:32:19 +0000 (20:32 -0700)] 
bootctl: remove fallback EFI Boot#### variable on uninstall

This cleans up the fallback Boot#### entry that was registered on
install. The logic cleaning up variables was moved from verb_remove into
a new remove_variables function, which mirrors the install side.

7 days agobootctl: register fallback EFI Boot#### entry on install
Clayton Craft [Thu, 30 Apr 2026 01:46:13 +0000 (18:46 -0700)] 
bootctl: register fallback EFI Boot#### entry on install

This adds a second install_boot_option call to register a Boot#### entry
pointing at systemd-boot-fallback{arch}.efi, and place it immediately
after the primary entry in BootOrder.

The fallback file does not exist on the ESP on first install and is
only created on first update when the existing primary binary is
rotated to the fallback path. We register the variable anyway, so
that the entry exists in the BootOrder once the fallback file shows up.
Until then, firmware that reaches the fallback entry will fail to
load it and fall through to the next entry in BootOrder, which is
fine. install_boot_option gains a require_existing parameter so the
existing early return on a missing ESP path can be skipped for the
fallback, where a missing path is expected.

This also does a bit of refactoring by splitting the bottom part of
run_install() into a new install_variables() function that handles
registering both the primary and fallback entries.

7 days agobootctl: back up sd-boot binary to fallback path on update
Clayton Craft [Thu, 30 Apr 2026 01:24:21 +0000 (18:24 -0700)] 
bootctl: back up sd-boot binary to fallback path on update

When a primary sd-boot binary already exists on the ESP and is being
updated, it is copied to systemd-boot-fallback{arch}.efi before installing
the new version. This gives firmware a fallback Boot#### entry pointing
to the previous binary in case the new one fails to load.

The fallback is preserved (not overwritten) when its product and version
match the currently booted bootloader (read from the LoaderInfo EFI
variable), since that means it already holds the known good binary that
booted this session. In all other cases it is overwritten with the current
primary, when no fallback exists yet, when LoaderInfo is unavailable, or
when the fallback's product or version differs from what booted.

This also moves the version_check() call up so its result determines
both the rotation decision and the main copy, and avoids a duplicate
check (and duplicate "Skipping..." log) when the binary is already
current.

7 days agobootctl: add after_slot parameter to insert_into_order()
Clayton Craft [Thu, 30 Apr 2026 00:35:05 +0000 (17:35 -0700)] 
bootctl: add after_slot parameter to insert_into_order()

This adds an after_slot parameter that, when not set to UINT16_MAX,
requests that the new slot be placed immediately after the given slot in
BootOrder. When after_slot is set and the new slot already exists in
BootOrder, it will leave its position alone. This is so that if a user
reorders it, we don't stomp on their changes.

7 days agobootctl: add description and ret_slot parameters to install_boot_option()
Clayton Craft [Thu, 30 Apr 2026 00:10:05 +0000 (17:10 -0700)] 
bootctl: add description and ret_slot parameters to install_boot_option()

This moves creation of the EFI boot option description out of
install_boot_option and into the caller, and adds a ret_slot output
parameter for capturing the assigned BootOrder slot. This allows reusing
the function for installing variables with different descriptions.

7 days agobootctl: rename install_variables/remove_variables to install/remove_boot_option
Clayton Craft [Tue, 12 May 2026 17:47:17 +0000 (10:47 -0700)] 
bootctl: rename install_variables/remove_variables to install/remove_boot_option

These functions install or remove a single EFI Boot#### entry, not
"all variables," so this renames them to better reflect what they do.

7 days agobootctl: fix removing variables on uninstall
Clayton Craft [Thu, 30 Apr 2026 02:33:58 +0000 (19:33 -0700)] 
bootctl: fix removing variables on uninstall

remove_variables looks up the EFI boot entry by matching both the path
and the partition UUID and it wasn't actually removing any entries
because verb_remove was passing SD_ID128_NULL, so the lookup never
matched and Boot#### entries were left behind on uninstall.

Fixes 38433a6

7 days agosystemctl: also attempt kexec image extraction on EINVAL
Rocker Zhang [Thu, 21 May 2026 15:47:48 +0000 (23:47 +0800)] 
systemctl: also attempt kexec image extraction on EINVAL

load_kexec_kernel() retries kexec_file_load() with an extracted kernel
(decompressed Image / ZBOOT PE / UKI) when the kernel rejects the image,
but it only does so when kexec_file_load() failed with ENOEXEC. On arm64
that retry never happens: arm64's image_probe()
(arch/arm64/kernel/kexec_image.c) returns -EINVAL on an ARM64_IMAGE_MAGIC
mismatch, whereas x86's bzImage64_probe() and the generic
kexec_image_probe_default() return -ENOEXEC. So `systemctl kexec` of a
UKI on arm64 skips the extraction path and falls back to the
/usr/sbin/kexec binary, which is no longer a dependency since e107c7ead0
("systemctl: replace kexec-tools dependency with direct kexec_file_load()
syscall") -- leaving kexec broken.

Accept EINVAL in addition to ENOEXEC. This is safe: the extraction in
kexec_maybe_decompress_kernel() re-gates on the actual file magic (MZ /
compression headers) and is a no-op returning 0 for anything else, so an
EINVAL that is not a format mismatch just falls through to the existing
fallback as before.

Fixing this in systemd (rather than only in the kernel) is appropriate:
systemd must keep working with already-shipped arm64 kernels whose
kexec_file_load() returns EINVAL for an unrecognized image magic.

Relates to: https://github.com/systemd/systemd/issues/28538

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
7 days agonsresourced: Add more debug logging 42224/head
Daan De Meyer [Thu, 21 May 2026 08:37:56 +0000 (08:37 +0000)] 
nsresourced: Add more debug logging

8 days agoboot: measure select SMBIOS objects explicitly
Lennart Poettering [Thu, 21 May 2026 15:26:02 +0000 (17:26 +0200)] 
boot: measure select SMBIOS objects explicitly

8 days agoupdate TODO 42223/head
Lennart Poettering [Thu, 21 May 2026 06:42:43 +0000 (08:42 +0200)] 
update TODO

8 days agoci: add test for new machine-tags concept
Lennart Poettering [Thu, 21 May 2026 07:47:16 +0000 (09:47 +0200)] 
ci: add test for new machine-tags concept

8 days agofirstboot: allow configuring machine tags via firstboot
Lennart Poettering [Thu, 21 May 2026 06:39:23 +0000 (08:39 +0200)] 
firstboot: allow configuring machine tags via firstboot

8 days agocondition: add a condition that matches against the machine tags
Lennart Poettering [Wed, 20 May 2026 21:23:15 +0000 (23:23 +0200)] 
condition: add a condition that matches against the machine tags

8 days agohostnamectl: add support for tagging the machine
Lennart Poettering [Wed, 20 May 2026 16:44:45 +0000 (18:44 +0200)] 
hostnamectl: add support for tagging the machine

8 days agohostnamectl: port to new --help API
Lennart Poettering [Wed, 20 May 2026 16:32:59 +0000 (18:32 +0200)] 
hostnamectl: port to new --help API

8 days agohostnamed: introduce "machine tags" concept
Lennart Poettering [Wed, 20 May 2026 16:45:12 +0000 (18:45 +0200)] 
hostnamed: introduce "machine tags" concept

For management purposes it's useful to be able to "tag" a machine with
various labels. Let's add a field for that to /etc/machine-info and make
it settable.

Fixes: #38591
8 days agohostnamed: port to regular string_is_safe()
Lennart Poettering [Wed, 20 May 2026 15:03:39 +0000 (17:03 +0200)] 
hostnamed: port to regular string_is_safe()

8 days agotpm2: add nvpcr allocation priorities (#42227)
Lennart Poettering [Thu, 21 May 2026 16:19:39 +0000 (18:19 +0200)] 
tpm2: add nvpcr allocation priorities (#42227)

nvindex space is very scarce, let's hence introduce "priorities" on
nvpcrs, so that if we haven't got enough space for all we have some
control which ones get dropped and which ones kept.

8 days agocore: introduce ConditionFraction= that is true on a certain percantage of the fleet
Lennart Poettering [Thu, 21 May 2026 13:32:24 +0000 (15:32 +0200)] 
core: introduce ConditionFraction= that is true on a certain percantage of the fleet

8 days agoTEST-08-INITRD: Set up exitrd on boot rather than including in image
Daan De Meyer [Thu, 21 May 2026 10:25:03 +0000 (10:25 +0000)] 
TEST-08-INITRD: Set up exitrd on boot rather than including in image

Just copy the initramfs from the VM rather than doing it during
the image build.

8 days agouser-util: return malloc'ed strings in get_user_creds 42184/head
Zbigniew Jędrzejewski-Szmek [Tue, 19 May 2026 21:22:06 +0000 (23:22 +0200)] 
user-util: return malloc'ed strings in get_user_creds

get_user_creds would use getpwnam() and then returns strings pointing
into the static buffer. This seems very iffy. Let's duplicate the
strings properly