Commit Graph
90741 Commits
Author SHA1 Message Date
Ross Burton d024c58b8e hwdb: add debug logging for the output filename
It's useful to see exactly what file was written to when updating the
HWDB.
2026-07-20 11:24:57 +01:00
Armaan Sandhu 79f25def86 hostname-util: strip all trailing separators in hostname_cleanup() (#43077)
Fixes #43054.
2026-07-20 16:35:12 +09:00
Nandakumar Raghavan 13aec9fddf networkctl,networkd: add --no-reconfigure flag to networkctl reload
Add a new --no-reconfigure flag to 'networkctl reload' that reloads
.network and .netdev files from disk without reconfiguring any network
interfaces. This may be useful to avoid reconfiguring multiple interfaces
simultaneously when multiple .network files are updated, or when an updated
.network file is applied to multiple interfaces.

On the networkd side, manager_reload() gains a reconfigure_links parameter
that gates the per-link reconfiguration loop. A new io.systemd.Network.Reload
varlink method is added that exposes this as an optional reconfigureLinks
boolean (defaults to true). Both plain 'networkctl reload' and
'--no-reconfigure' now unconditionally call this method first. If an older
networkd returns MethodNotFound, plain reload falls back to
io.systemd.service.Reload for backward compatibility; '--no-reconfigure'
fails with a clear error in that case.
2026-07-20 14:35:04 +09:00
Sinity 1166f4472d core/dbus: do not block the manager on GetId during bus (re-)connection
bus_init_api() issued a synchronous GetId call on every API bus
(re-)connection to decide whether saved subscription state could be
coldplugged onto the new connection.

If the D-Bus socket unit is listening while the message bus daemon
behind it is gone, connect() succeeds against the socket backlog but
nothing answers the authentication handshake. The synchronous call
then blocks PID 1 for BUS_AUTH_TIMEOUT (90 seconds by default), and
queued bus operations can trigger repeated reconnection attempts.
This was observed during shutdown as roughly 15 minutes of teardown
progressing only in 90-second intervals.

Query the instance ID asynchronously on every connection. Defer API
setup until the reply is processed, so saved subscriptions are
validated and coldplugged before new subscription requests can arrive.
If the query cannot be queued or its reply is invalid, discard the
unvalidated state and expose the API without blocking the manager.

Reset the live bus ID on every connection and serialize pending bus ID
and subscription state across reload and reexec. During daemon-reload,
preserve state that was already awaiting the asynchronous reply while
discarding the duplicate state produced by the reload itself.

Also remove the now-unused synchronous bus_get_instance_id() helper.
2026-07-20 11:53:34 +09:00
Zbigniew Jędrzejewski-Szmek d751846043 Manage dlopen notes at beginning of execution, and downgrade priorities in shared libraries (#43060) 2026-07-19 21:23:47 +02:00
Zbigniew Jędrzejewski-Szmek 0f81431e35 portable: tighten image handling and command error reporting (#43033)
Let's further improve portable image handling and command error
reporting.
2026-07-19 21:09:24 +02:00
Zbigniew Jędrzejewski-Szmek 787853bd78 Improve sysinstall messages (#43050)
I was trying to use systemd-sysinstall and those are the fixes for
various ugly parts that are immediately obvious when it is used.
2026-07-19 20:16:06 +02:00
dongshengyuan 4368db3219 boot: cover BCD offsets past the buffer
Add a zero-length test for offset > max so the first bounds guard
is covered separately from the length overflow check.

Follow-up: 231857cfe8
2026-07-19 20:21:47 +09:00
Alexey Shabalin f9a9b6b4f5 password-quality-util-passwdqc: restore password-quality-util.h include
suggest_passwords() references the N_SUGGESTIONS macro, which is defined in
password-quality-util.h. Commit ff33c8f87d ("Extend test-dlopen-so to also
cover cases when built without support") introduced the per-backend split
headers: for the pwquality backend it added the new
password-quality-util-pwquality.h include while keeping password-quality-util.h,
but for the passwdqc backend it replaced password-quality-util.h with
password-quality-util-passwdqc.h (which only pulls in shared-forward.h). As a
result N_SUGGESTIONS is no longer declared in the passwdqc translation unit and
the build fails when the passwdqc backend is enabled.

The passwdqc backend is not exercised by the default CI, so this went
unnoticed. Add the include back, matching the pwquality backend.
2026-07-19 20:19:48 +09:00
Arian van Putten 78a8170a8a systemd-imds-generator: fix import docs
We only run import in the initrd by default. Clarify this.
2026-07-19 10:59:59 +01:00
Lennart Poettering 215ad044d3 run: split out polkit ops into separate .c file (#43047) 2026-07-18 11:03:36 +02:00
Lennart Poettering 1f360f0abd run: simplify timer property handling
Let's make timer prop handling less special, and more like path/socket
handling. Let's move the checks for at least one OnXYZ= setting to a
common place at the end of parsing, instead of explicit checks for each
property.
2026-07-18 00:01:47 +02:00
Lennart Poettering 9793dde16e run: split out polkit ops into separate .c file
Let's shorten an already very long .c file, by splitting it apart a bit.

Splitting out the polkit code is relatively easy, since it does not
touch any of the arg_xyz variables.
2026-07-18 00:01:47 +02:00
acandoo bb3fcd73ce docs: clarify scope of portable services
Removed note clarifying that portable services are only for system services and not user services, and changed comparisons to "system services" with just "services". With newer systemd versions, `systemd-portabled` can be run as a user service.
2026-07-17 21:13:08 +01:00
Yu Watanabe 796580518e dlopen-note: downgrade all dlopen notes in libsystemd.so and libsystemd-shared.so
Since all executables now manage their required dlopen notes directly
within their own source code with explicit priority levels, it is no
longer necessary to declare high-priority dlopen notes in the shared
libraries themselves.
2026-07-18 04:57:00 +09:00
Yu Watanabe 661ab8b6fd tree-wide: drop DLOPEN_FOO() macros
Since 4c0d8d9673, most dlopen notes are
set at the beginning of the executables. Let's manage all dlopen notes
there, rather than setting them where dlopen is called.

Note that the only exceptions are the LIBBPF_NOTE for networkd and
nsresource. Since dlopen_bpf() is wrapped in an `#if` guard, the notes
are instead set within the corresponding functionality.

As a result, the DLOPEN_FOO() wrapper macros are no longer needed and
can be dropped completely.
2026-07-18 04:56:32 +09:00
Luca Boccassi e056e2a707 sd-dlopen: make header self-standing again
The purpose of this header was to provide MIT-0 sources that can be copied
and pasted liberally. Including an LGPL-2.1+ header from it deafeats its
purpose. Make it self-standing again.

Follow-up for aa0db003cf
2026-07-18 01:55:07 +09:00
Lennart Poettering 6eb6a61a96 update TODO 2026-07-17 16:38:14 +02:00
Luca Boccassi 6308a7c2e7 nspawn: use chase() for creating dev nodes (#43037) 2026-07-17 09:02:28 +01:00
Zbigniew Jędrzejewski-Szmek a48ff4de46 repart: fix varlink description string
Fixup for 1c76e204d3.
2026-07-17 09:21:59 +02:00
Zbigniew Jędrzejewski-Szmek d094067547 network: silence false warning about unitialized variable
[1177/3647] Compiling C object systemd-networkd.p/src_network_networkd-bridge-vlan.c.o
In function ‘bridge_vlan_append_set_info’,
    inlined from ‘bridge_vlan_set_message’ at ../src/network/networkd-bridge-vlan.c:257:21:
../src/network/networkd-bridge-vlan.c:162:28: warning: ‘untagged’ may be used uninitialized [-Wmaybe-uninitialized]
  162 |                         if (untagged == u)
      |                            ^
../src/network/networkd-bridge-vlan.c: In function ‘bridge_vlan_set_message’:
../src/network/networkd-bridge-vlan.c:111:14: note: ‘untagged’ was declared here
  111 |         bool untagged, pvid_is_untagged;
      |              ^~~~~~~~
2026-07-17 09:18:58 +02:00
Zbigniew Jędrzejewski-Szmek 9d8f8d55ed sysinstall: don't ask whether to erase a disk that contains no partitions
When the target disk carried no partitions, the installer still asked:

    Please type 'keep' to install the OS in addition to what the disk
    already contains, or 'erase' to erase all data on the disk:

The question is meaningless in that case: there's nothing on the disk
worth preserving, and both answers lead to the same result.

Modify fsystemd-repart to report in the dry-run reply of
io.systemd.Repart.Run() the number of partitions currently on the disk.
The field is only included if the existing partition table was actually
read, i.e. in the 'refuse' and 'allow' empty modes, and omitted
otherwise.

Make systemd-sysinstall skip the erase question if the reply positively
indicates that there are no partitions, proceeding as if 'keep' was
selected.
2026-07-17 09:18:33 +02:00
Zbigniew Jędrzejewski-Szmek efbc4481cb sysinstall: suppress 'no' prompt to begin installation
The user has to type 'yes', but it doesn't mean that the default of
'no' is ever useful. Suppress it, so the user doesn't have to press
backspace twice.
2026-07-17 09:15:09 +02:00
Luca Boccassi 15d0b477f0 nspawn: use chase() for creating dev nodes
Follow-up for de40a3037a
2026-07-16 22:46:31 +01:00
Luca Boccassi 2ef10ee3f1 nspawn: log at error level before exiting if parsing OCI fails
Currently it silently errors out, with nothing at all printed on the
console

Follow-up for de40a3037a
2026-07-16 17:41:27 +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
Zbigniew Jędrzejewski-Szmek 70cc332640 repart: log allocation failure at debug level in Varlink service mode
When systemd-sysinstall probes whether an installation would fit by
calling io.systemd.Repart.Run() in dry-run mode, systemd-repart runs as
a child process sharing sysinstall's stderr. When the requested
partitions didn't fit, context_ponder() logged its failure at LOG_ERR
before vl_method_run() converted it into a structured Varlink error
(InsufficientFreeSpace or DiskTooSmall), which the client then reports
to the user in its own words. The internal message hence appeared
interleaved with the user-facing report:

    Can't fit requested partitions into available free space (1.9G), refusing.
    The selected disk is not large enough for an OS installation.
    The size of the selected disk is 0B, but a minimal size of 15.7G is required.

Log at LOG_DEBUG when running as a Varlink service, and keep LOG_ERR
for CLI invocations, where this message is the primary error report
shown to the user.
2026-07-16 13:59:18 +02:00
Zbigniew Jędrzejewski-Szmek 588275f426 repart: report the actual block device size in currentSizeBytes
The io.systemd.Repart interface documents the currentSizeBytes field as
the size of the selected block device, both in the Run() method's
dry-run reply and in the InsufficientFreeSpace and DiskTooSmall errors.
The implementation however filled it in from the "current size"
computed by determine_auto_size(), which means something else entirely:
the size of the image as it currently exists, i.e. the GPT metadata
overhead plus the sizes of all existing partitions — a metric designed
for growing image files with --size=auto. For a disk that is being
partitioned from scratch (i.e. carries no partition table yet) that
value is 0.

As a result, when systemd-sysinstall was pointed at a blank 2G disk
that is too small for the OS installation, it reported:

    The selected disk is not large enough for an OS installation.
    The size of the selected disk is 0B, but a minimal size of 15.7G is required.

Report context->total instead, i.e. the actual size of the block
device, which is also the value the DiskTooSmall check compares the
required size against. Do this in all three places that send
currentSizeBytes, matching the documented semantics of the field.
2026-07-16 13:58:55 +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
dongshengyuan 75d2686794 portable: honor --force for directory extensions
Pass relax_extension_release_check through the directory extraction
path instead of hardcoding false. Directory extensions now honor the
same --force relaxation as dissected images.

Reproducer:
  cp -a /tmp/app0 /tmp/app10
  sudo portablectl attach --force --runtime \
      --extension /tmp/app10 /tmp/rootdir app0

Before:
  directory image extraction always used strict extension-release name
  checks. --force relaxed other extension paths but still rejected a
  renamed directory extension with matching metadata.

Follow-up: 06768b90a3
2026-07-16 10:03:19 +08: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