Commit Graph
90709 Commits
Author SHA1 Message Date
Luca Boccassi 002d467ce4 shift-uid: use TAKE_FD on input fd
Follow-up for c3eafb10a0
2026-07-16 19:21:48 +01:00
Luca Boccassi 305393135b rm-rf: use faccessat instead of fstatat
Follow-up for 9dd2dab37e
2026-07-16 19:20:57 +01:00
Lennart Poettering 8009fa4984 boot: fix MEMMAP_DEVICE_PATH EndingAddress field calculation
Let's do what EDK2 does.

Fixes: #43038
2026-07-17 01:17:14 +09:00
Yu Watanabe 95648d612a udev-util: bound leading whitespace skip in udev_replace_whitespace (#42757)
udev_replace_whitespace() is documented to read at most 'len' bytes from
'str':
- the strspn() skip of leading whitespace stops at a non-space byte or
NUL, not at 'len'
- ata_id passes the space padded, non-NUL-terminated ATA IDENTIFY
model/serial/fw fields
- an all-blank field reads off the end of the 512-byte hd_driveid stack
struct
Capped the skip to 'len'; existing outputs are unchanged. Added a
regression test.
2026-07-17 01:16:07 +09:00
Yu Watanabe 4d4e9be0ea Assorted remote/shared/resolved hardening fixes flagged by kres (#42978) 2026-07-17 01:12:32 +09:00
xiahualiu 9d02f0d9a7 Rebased and reapplied the fix, dropped the test case. 2026-07-16 14:32:56 +02:00
Frantisek Sumsal f9348b3bc8 discover-image: don't ignore symlinks to raw images
Since 5c6bb28999 image_discover() uses
chaseat() to chase the path to the image. This however breaks the raw
image check in image_make() as "path" is now not the symlink itself, but
the symlink target.

So with:

$ ls -l /var/lib/machines
total 872104
lrwxrwxrwx. 1 root root         12 Jul 14 06:10 foo.raw -> foo.squashfs
-rw-r--r--. 1 root root 5368709120 Jul 13 02:07 foo.squashfs

The endswith(path, ".raw") check is now performed on "/.../foo.squashfs"
instead of "/.../foo.raw", making it false and thus ignoring the image
symlink completely.

Address this by also checking if the pretty name is set - if so, and the
path is a regular file, the caller must've been image_find() or
image_discover() which already checked if the original path ends in .raw
and is a regular file.

Follow-up for 5c6bb28999.

Resolves: #41656
2026-07-16 14:31:32 +02:00
Luca Boccassi 0755bb125c homed: fix verification of local identity file
Follow-up for 70a5db5822
2026-07-16 14:24:18 +02:00
Zbigniew Jędrzejewski-Szmek 0bdf8d31ad Assorted coverity issues (#43035) 2026-07-16 14:20:25 +02:00
Zbigniew Jędrzejewski-Szmek 9311e98358 Assorted network hardening fixes flagged by kres (#43014) 2026-07-16 14:15:18 +02:00
Luca Boccassi cec14f99d2 sysupdate: add config file with metadata for sysupdate components (#42651)
This carries some metadata for components. It's supposed to grow a bit,
and include a way to enable/disable transfers, and to condition them.
2026-07-16 12:48:10 +01:00
Lennart Poettering 59d04da90c repart,dissect: explicitly support DDIs that are both signed *and* encrypted (#43009)
This is a pretty relevant usecase: preparing an image on some trusted
host, submitting it to some other host that authenticates it and
decrypts it, and consumes it only then.

Let's support this explicitly.
2026-07-16 13:40:49 +02:00
cidkidnix 93212e2910 machined: Allow user ids in open_shell for machine-dbus
Previously "machinectl shell --uid=1000 <container>" resulted in a
sucessful drop into a shell in the respective target machine. After
commit a9e9288288 this is no longer the
case.

This fixes the above breaking change brought in commit a9e9288288
2026-07-16 11:58:15 +01:00
Syed Mohammed Nayyar 6b2cb3abeb udev-util: bound leading whitespace skip in udev_replace_whitespace
The function documents that at most 'len' bytes are read from 'str',
but the leading whitespace skip used strspn(), which is bounded only
by a non-whitespace byte or a NUL. ata_id passes the space padded,
non-NUL-terminated ATA IDENTIFY fields, so an all-blank model reads
past the buffer. Use strnspn() to cap the skip to 'len'.
2026-07-16 15:53:37 +05:30
Syed Mohammed Nayyar 0af6caff42 string-util: add strnspn()
Like strspn(), but reads at most 'n' bytes from the input. strspn()
is bounded only by a non-matching byte or a NUL, so it over-reads a
buffer that is all matching bytes and not NUL terminated within 'n'.
2026-07-16 15:53:37 +05:30
Lennart Poettering d14c40919a ci: add test suite for verity+luks disk images 2026-07-16 07:10:07 +02:00
Lennart Poettering 1423d78dc9 dissect-image: support activating luks+verity partitions
Let's properly activate images that have both LUKS and Verity enabled
for a partition.
2026-07-16 07:05:39 +02:00
Lennart Poettering 628c3f25f1 repart: say when we are calculating Verity data
We say when we encrypt a partition, let's also say when we calculate
verity protection data.
2026-07-16 07:05:39 +02:00
Lennart Poettering 02cd3fd879 repart: support generating LUKS+Verity partitions
For various cases it is interesting to both sign and encrypted a file
system, for example to prepare it on one host and provide it to another.
Let's explicitly support preparing this in systemd-repart via setting
both Verity= and Encrypt=.
2026-07-16 07:05:39 +02:00
Lennart Poettering 07a9d1f929 update TODO 2026-07-16 07:05:10 +02:00
Luca Boccassi 9d4cb85cf5 sysext: validate work directory metadata before removal
unmerge_hierarchy() joined the persisted work_dir value directly with
--root=. An empty value therefore resolved to the root itself and was passed
to rm_rf().

Require the decoded metadata to name a non-empty, safe, normalized relative
path before constructing the removal target. Add coverage using a disposable
root with deliberately emptied metadata.

Follow-up for 9cfad502f4
2026-07-15 21:13:24 +01:00
Luca Boccassi c3eafb10a0 shift-uid: close consumed directory fds on early return
recurse_fd() consumes each directory fd passed to it, but it has no
cleanup set up until after take_fdopendir() succeeds.
Errors and skipped procfs, sysfs, or read-only subtrees therefore leak the
incoming fd.

Follow-up for b1fb2d971c
2026-07-15 21:13:24 +01:00
Luca Boccassi 9dd2dab37e rm-rf: fail closed when the root check fails
path_is_root_at() returns a negative errno when it cannot determine whether
a target is the root file system. rm_rf_at() treats those errors as a
negative answer and continued with destructive operations.

Propagate root-check errors before modifying the target, while preserving
REMOVE_MISSING_OK for an absent path.

Follow-up for c0228b4fa3
2026-07-15 21:13:24 +01:00
Luca Boccassi 57db794b9d vconsole: reject empty layout during keymap conversion with error
A leading-dash console keymap or leading-comma X11 layout can produce an
empty layout while converting between the two formats. find_converted_keymap()
then asserts on it, allowing malformed input to abort callers such as localed.

Return EINVAL for an empty derived layout instead.

Follow-up for 6d0f502736
2026-07-15 21:13:24 +01:00
Luca Boccassi fea9a64432 resolved: preserve unchanged question on asymmetric redirect
dns_question_cname_redirect() returns no replacement when a question
already matches a CNAME target or a DNAME does not apply. If only one of
the UTF-8 and IDNA questions redirects, dns_query_cname_redirect() then
installs NULL for the unchanged side.

Keep a reference to the original question on whichever side does not
redirect, and update the existing asymmetric DNAME test to verify it.

Follow-up for 23b298bce7
2026-07-15 21:13:24 +01:00
Luca Boccassi 14830891f3 journal-remote: zero-initialize MHD daemon wrapper
MHDDaemonWrapper_free() unconditionally unrefs both event sources, but
setup_microhttpd_server() could return before initializing either pointer.
Zero-initialize the wrapper so cleanup after MHD startup failures safely
unrefs NULL.

Follow-up for 3c67c8bd4c
2026-07-15 21:13:24 +01:00
Luca Boccassi 16c6758eb4 journal-remote: remove disabled compression entry before freeing
compression_config_put() frees the COMPRESSION_NONE value when a later
algorithm is selected, but lefts the map entry pointing at it. Remove the
entry first so subsequent parsing, mangling, and teardown cannot access or
free stale memory.

Follow-up for c259c9e253
2026-07-15 21:11:09 +01:00
Luca Boccassi 890dd23c83 network: cancel netlink calls for detached requests
Store the asynchronous netlink slot in the Request object and release it
when the request is detached. This cancels the pending callback instead of
keeping the request alive until its reply arrives.

Follow-up for 80d62d4f1a
2026-07-15 19:21:18 +01:00
Luca Boccassi f65d4e6c4e network: compare all multipath route nexthops
The multipath route comparator looks up every nexthop in the first
route and hence compares each entry with itself. Compare both ordered
nexthop sets instead, including weights, as the hash function does.

Follow-up for 47420573a7
2026-07-15 19:11:08 +01:00
Paul Meyer afff448cf4 tpm2-util: keep the measurement log's torn-write marker intact
The userspace measurement log carries a sticky-bit marker while a writer
is between updating a measurement register and appending the matching
record, so that a writer dying in between leaves the log detectably
incomplete.

However, the next successful writer used to clear the marker again after
appending its own record, erasing the evidence that an earlier writer
had died and the log is still missing a record. Keep the marker set in
that case instead; the new record is appended and synced regardless. The
marker likewise stays set if the measurement itself fails, so that any
non-clean completion remains flagged: a spurious flag on a failed but
harmless measurement is preferable to erasing evidence of a real gap,
and PCR replay stays authoritative either way.

Finally, warn when systemd-pcrlock loads a marked log, so the resulting
PCR validation failures come with a hint at their cause.

Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2026-07-16 01:59:38 +09:00
dongshengyuan cb7b533b92 journalctl: reject field listing with filters
Reproducer:
  journalctl -F _SYSTEMD_UNIT -u test.service --no-pager
  journalctl -u test.service --no-pager -n 1

Before, the field listing ignored the unit filter and listed unrelated
units, while the normal journal query applied the filter.

sd_journal_query_unique() cannot represent journalctl filters such as
unit, boot, time, cursor, or grep filters. Walking the journal line by
line would make field listing linear in the number of entries and
duplicate unique-value handling.

Keep the scope-option predicate next to add_filters(), and reject field
listings combined with options that actually limit the journal.
Display-only options such as --pager-end are left alone.
2026-07-16 01:52:39 +09:00
Luca Boccassi b5c94b4364 clonesetup: check target table size for overflow
The target parameter length is added to two headers and aligned before
allocation. Check each operation and reject payloads that cannot be
represented by the device-mapper ioctl header.

CID#1663846

Follow-up for 104970a8bd
2026-07-15 17:51:48 +01:00
Luca Boccassi 280b880388 clonesetup: check target message size for overflow
Build the variable-length ioctl size with checked additions. Reject an
oversized message before allocating and copying it into the buffer.

CID#1663845

Follow-up for 104970a8bd
2026-07-15 17:51:48 +01:00
Luca Boccassi df965878c7 test: make NSS IPv4 tuple bounds explicit
gaih_addrtuple.addr has room for an IPv6 address, while IPv4 uses only
the first struct in_addr. Express the remaining range directly in terms
of that type so static analysis can prove the access remains within the
array.

CID#1663899

Follow-up for 2d85bba6b9
2026-07-15 17:51:48 +01:00
Luca Boccassi 7cb8728d59 mkosi: update debian commit reference to 88c420c621dbd1b988950cf26fc60789fc989453
* 88c420c621 Install new files for upstream build
* 5b7f67b86a Update changelog for 261.1-3 release
* 3f91c8567c NEWS: update about removal of sd-tpm dep
* e13ba94737 Drop obsolete TODO
* b0c5def366 systemd: downgrade systemd-tpm and mount to recommends
* e9eb859a3a systemd-tpm: depend on tpm-udev for rules and tmpfiles.d
* 42f74bb110 Drop obsolete comment from d/control
* fc40986137 debian/extra/network: use NamePolicy=keep mac on USB wifi devices
2026-07-15 17:47:25 +01:00
Kai Lüke a1c760c435 oci-util: Don't fall back to default registry for explicit registries
When a reference specifies a registry like ghcr.io or quay.io for which
we don't have a registry config file, the fallback forced the default
registry which is wrong.

Only use the default as fallback when there is no explicit registry.
2026-07-16 01:34:11 +09:00
Yu Watanabe ac007dd0f1 Cleanup argument and return values for copy_bytes_full helpers (#43034)
Follow-up for #43004.
2026-07-16 01:32:04 +09:00
dongshengyuan d0d0eea266 boot: guard missing Windows auto entry
config_add_entry_loader_auto() returns NULL when the Windows loader
is missing. With reboot-for-bitlocker enabled, the caller still
assigned e->call and could dereference NULL.

This can happen when reboot-for-bitlocker is enabled but the ESP does
not contain EFI/Microsoft/Boot/bootmgfw.efi.

Before:
  systemd-boot could dereference NULL while building the menu

Follow-up for: 661615a0af.
2026-07-16 01:26:46 +09:00
dongshengyuan 3121e14658 journalctl: use root machine ID for namespaces
journalctl --root=... --list-namespaces scans the target root's
journal tree, but used the host machine ID when matching namespace
directories.

Reproducer:
  root="$(mktemp -d)"
  mid=11111111111111111111111111111111
  mkdir -p "$root/etc" "$root/var/log/journal/$mid.testns"
  printf '%s\n' "$mid" >"$root/etc/machine-id"
  journalctl --root="$root" --list-namespaces --quiet

Before:
  no output

Follow-up for: 68f66a1713.
2026-07-16 01:26:46 +09:00
Aritra Basu 08bebda611 network: add IPv4ProxyARPAddress= and consolidate proxy ARP/NDP handling
This adds an IPv4 counterpart to `IPv6ProxyNDPAddress=` for adding
manual entries to the kernel's IPv4 neighbour proxy table (check via
`ip -4 neighbour show proxy dev <dev>`). systemd-networkd only exposed
`IPv4ProxyARP=` for per-interface `proxy_arp` sysctl (automatic proxy
ARP) with no way to manage manual entries from a .network file.

To avoid duplicating the IPv6 proxy NDP code path, both families are
now combined into a single new `networkd-neighbor-proxy` module. The
IPv6 behaviour is preserved: `IPv6ProxyNDPAddress=` still implies
`IPv6ProxyNDP=yes` unless `IPv6ProxyNDP=` is explicitly disabled and
entries are still dropped if the kernel has no IPv6 support.
The same rule is applied to `IPv4ProxyARPAddress=`. It implies
`IPv4ProxyARP=yes` when the sysctl is not explicitly set and has no
effect if `IPv4ProxyARP=` has been set to false.

This keeps the user model symmetric and predictable across both
families: a single per-address setting that turns on the matching
per-interface sysctl automatically, while still letting system
administrators opt out by setting the boolean explicitly to false.

Note that the IPv4 manual NTF_PROXY entries installed here would
actually function without `proxy_arp` (unlike IPv6, where `proxy_ndp`
gates the manual entries); the implication is kept for symmetry with
`IPv6ProxyNDPAddress=` and is now called out explicitly in the man
page, together with the fact that enabling `proxy_arp` also activates
interface-wide automatic proxy ARP for routed-toward addresses on
connected subnets.

Parser-time validation rejects addresses the kernel would refuse:
the ANY/null address for both families, IPv4 and IPv6 multicast
and the IPv4 limited broadcast 255.255.255.255.

Signed-off-by: Aritra Basu <aritrbas+gh@cisco.com>
2026-07-16 01:23:40 +09:00
Zbigniew Jędrzejewski-Szmek 8437a7605a shared/copy: simplify argument convention for reflink_range
reflink_range() would treat size==UINT64_MAX as "copy everything", but
only if the offsets were 0. There are only two callers: one always passes
a fixed size, the other translated size==UINT64_MAX to 0. Make things
more uniform by always treating size==UINT64_MAX the same as size==0.
2026-07-15 13:54:40 +02:00
Zbigniew Jędrzejewski-Szmek 5efd4688a9 shared/copy: simplify return convention for try_reflink_copy_bytes
Follow-up for 5a12005c83.

Also a rescue a comment from the discussion in the PR.
2026-07-15 13:54:28 +02:00
Lennart Poettering bf4263b92e update TODO 2026-07-15 13:27:48 +02:00
Lennart Poettering b0cf7d60ac ci: add test for the various new sysupdate features 2026-07-15 13:27:48 +02:00
Lennart Poettering 1cd217ee81 shell-completion: add shell completion for systemd-sysupdate 2026-07-15 13:27:48 +02:00
Lennart Poettering 87f4e729d8 man: document the new .component files 2026-07-15 13:27:48 +02:00
Lennart Poettering b488ee3dcc man: document the new systemd-sysupdate switches and verbs 2026-07-15 13:27:48 +02:00
Lennart Poettering 559f52ee3f units: add unit that can auto-enables all suggested component/features
if enabled it will plug itself before systemd-sysupdate-update.service
and enable every component + feature that is suggested.
2026-07-15 13:27:48 +02:00
Lennart Poettering ca5ddf8cc0 units: update all components in systemd-sysupdate-update.service
Let's beef up systemd-sysupdate-update.service and update not just one
component but all enables ones.
2026-07-15 13:27:48 +02:00
Lennart Poettering 921f63447b sysupdate: add support for 'update --component-all'
Let's add a way to quickly update all components that are enabled.
2026-07-15 13:27:48 +02:00