Commit Graph
92502 Commits
Author SHA1 Message Date
Yu Watanabe 496fd5e254 sd-journal: fix indentation 2026-10-19 17:43:04 +09:00
Yu Watanabe 5bb19fbb37 compress: introduce decompress_blob_to_fd()
This may be useful for decompressing data straight into a file
descriptor, without allocating a large in-memory buffer for the
entire decompressed payload.
2026-10-19 17:43:04 +09:00
Yu Watanabe 9b3e73ea71 compress: introduce DECOMPRESS_REFUSE_CONCATENATED flag 2026-10-19 17:43:04 +09:00
Yu Watanabe bcbb3d1885 compress: allow to skip beginning of decompressed data
The parameter will be used later.
2026-10-19 17:43:04 +09:00
Nayyar 462e1cc635 acpi-fpdt: bound record against table before reading pointer
Only type/length/revision are the generic performance record header; the
pointer is specific to the Firmware Basic Boot Performance Table Pointer
Record. Check that the record fits into the table where its length is
validated against the expected size, so rec->ptr is never read past the
end of the buffer.
2026-10-19 10:27:18 +02:00
Yu Watanabe 8fd029445d sd-future: do not pass -EBADF to anonymous mmap()
The man page mmap(2) states the following:
> The fd argument is ignored; however, some implementations require
> fd to be -1 if MAP_ANONYMOUS (or MAP_ANON) is specified, and
> portable applications should ensure this.

Fixes the following failure:
```
$ sudo valgrind --leak-check=full ./test-fiber
==1070213== Memcheck, a memory error detector
==1070213== Copyright (C) 2002-2026, and GNU GPL'd, by Julian Seward et al.
==1070213== Using Valgrind-3.27.1 and LibVEX; rerun with -h for copyright info
==1070213== Command: ./test-fiber
==1070213==
/* test_fiber_simple */

valgrind: m_debuginfo/debuginfo.c:1168 (vgPlain_di_notify_mmap): Assertion 'use_fd >= -1' failed.

host stacktrace:
==1070213==    at 0x58053B1F: ??? (in /usr/libexec/valgrind/memcheck-amd64-linux)
==1070213==    by 0x5804FC83: ??? (in /usr/libexec/valgrind/memcheck-amd64-linux)
==1070213==    by 0x5804FE9B: ??? (in /usr/libexec/valgrind/memcheck-amd64-linux)
==1070213==    by 0x58082A00: ??? (in /usr/libexec/valgrind/memcheck-amd64-linux)
==1070213==    by 0x580C8BF2: ??? (in /usr/libexec/valgrind/memcheck-amd64-linux)
==1070213==    by 0x580ABE14: ??? (in /usr/libexec/valgrind/memcheck-amd64-linux)
==1070213==    by 0x580B74B6: ??? (in /usr/libexec/valgrind/memcheck-amd64-linux)
==1070213==    by 0x58113907: ??? (in /usr/libexec/valgrind/memcheck-amd64-linux)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable syscall 9 (lwpid 1070213)
==1070213==    at 0x519387C: mmap (in /usr/lib64/libc.so.6)
==1070213==    by 0x4D277AB: fiber_allocate_stack (fiber.c:122)
==1070213==    by 0x4D29B0E: sd_fiber_new (fiber.c:727)
==1070213==    by 0x402B3A: test_fiber_simple (test-fiber.c:32)
==1070213==    by 0x4B628CD: run_test_table (tests.c:410)
==1070213==    by 0x423E31: main (test-fiber.c:2861)
client stack range: [0x1FFEFFE000 0x1FFF000FFF] client SP: 0x1FFEFFFD70
valgrind stack range: [0x1002BAA000 0x1002CA9FFF] top usage: 9960 of 1048576

Note: see also the FAQ in the source distribution.
It contains workarounds to several common problems.
In particular, if Valgrind aborted or crashed after
identifying problems in your program, there's a good chance
that fixing those problems will prevent Valgrind aborting or
crashing, especially if it happened in m_mallocfree.c.

If that doesn't help, please report this bug to: www.valgrind.org

In the bug report, send all the above text, the valgrind
version, and what OS and version you are using.  Thanks.
```
2026-10-19 17:26:18 +09:00
Zbigniew Jędrzejewski-Szmek cca9a12e5c core,shared: support the ConfigurationDirectory= flags field over D-Bus (#43633) 2026-10-19 10:13:46 +02:00
Lennart Poettering d7024404a0 sysupdate: allow feature, transfer, component definitions to be provided by a varlink backend in addition to files (#43657)
In some cases it might make sense to provide
features/transfers/components in a more dynamic fashion. Let's add a
concept of "sysupdate provider" backends, that can provide such
definitions at runtime.

Fixes: #33351 
Fixes: #30695
2026-10-19 09:44:00 +02:00
Yu Watanabe cb070c87eb storage-fs: Support for "dir" volumes in the user service (#44271)
This utilizes the `mkdir_foreign_at` helper function to create
foreign-owned directories. I extended it to `mkdir_foreign_at_full` to
allow for creating btrfs subvolumes too (thanks for merging #43869 to
enable this).

When a read-only directory is requested, the system instance can create
a read-only mount and return a file descriptor to that.
The unprivileged user instance can't do that, so it just returns the
directory file descriptor. An alternative would be to not allow for
read-only requests, but its not like we're consulting polkit for user
session requests.
2026-10-19 14:20:15 +09:00
Skye Soss 844cdd3367 nspawn: log the signal that is sent to PID 1, not the one received
When asked to shut down, nspawn sends KillSignal= to the container's
PID 1, but logged the signal it received instead, e.g. "Trying to halt
container by sending TERM to container PID 1" for a booted container,
which actually gets SIGRTMIN+3.
2026-10-19 14:11:07 +09:00
Yu Watanabe 98d4099b89 coredumpctl: use vertical table for printing coredump info (#44264) 2026-10-19 12:56:19 +09:00
Yu Watanabe ba73e2469b coredumpctl: introduce new option -l/--full 2026-10-19 08:29:15 +09:00
Yu Watanabe 645e918c01 options: introduce OPTION_COMMON_FULL 2026-10-19 08:29:15 +09:00
Yu Watanabe 2f154f26a7 coredumpctl: use bool for arg_legend 2026-10-19 08:29:15 +09:00
Yu Watanabe dca0fb200b coredumpctl: use vertical table for printing coredump info 2026-10-19 08:29:11 +09:00
Yu Watanabe 7f4df15d19 Recommend namespacing for tags and adjust deduplication rules (#43728) 2026-10-19 07:51:15 +09:00
Skye Soss 57d059ccec storage-fs: support directory volumes in user mode
Use mkdir_foreign_at_full() to create directory volumes from the user
instance. Unlike the system instance, read-only directories can't be
enforced by the storage instance, but are still supported.
2026-10-18 09:05:16 -05:00
Skye Soss 3f7af4008e dissect-image: add mkdir_foreign_at_full()
Adds a mkdir_foreign_at variant that takes XOpenFlags. This allows
callers to create a foreign-owned btrfs subvolume.
2026-10-18 09:04:20 -05:00
Zbigniew Jędrzejewski-Szmek ccecada0c6 man: recommend for machine tags to be namespaced
Initial deployment experience indicates that if tags are short strings,
chaos ensues. Change "berlin" to "company.location=berlin" and "webserver"
to "company.role=webserver", where "company." is described as a identifier
for the organization. This way, people get to arrange their own mess in
their namespace as they wish, and we have some hope that we can combine
tags from different sources.
2026-10-18 15:50:29 +02:00
Zbigniew Jędrzejewski-Szmek 5b69e2f4ab hostname-util: make machine_tag_list_is_valid wrap machine_tags_from_string
We had two implementations that very slightly differed in interpretation
of what is valid. Let's just reuse the same underlying logic in both
places. The tests are adjusted appropriately.

This additional advantage is that the O(n²) implementation is replaced by
O(n).
2026-10-18 15:50:29 +02:00
Zbigniew Jędrzejewski-Szmek 2b395f0df4 hostname-util: let the last specified value win when parsing machine tags
When duplicates were present, the existing code picked the
lexicographically earliest entry. This is strange, no other code
that combines list in systemd behaves in this way. This really looks
like an accident of implementation.

In graceful mode, rework the parsing to take the key=value pair that is
specified last. Also, rework the code to use a hashmap. This allows the
graceful and non-graceful paths to be unified into a single pass.
In graceful mode a conflicting tag is replaced by the entry specified
later, in strict mode refused. Every valid tag counts towards
MACHINE_TAGS_MAX.

(The O(n²) complexity in sorting of the tags wasn't great. The tag list is
bounded to 1024 items, so this wasn't _too_ bad, but the approach with the
hashmap is not much more complicated and has better computational
complexity, now the dominant part is O(n×log n) sort that happens later.)

For systemd-firstboot this means that a conflicting tag repeated in
--machine-tags= or in the firstboot.machine-tags credential is now an
error. The duplicated description of tag syntax in systemd-firstboot man
page is replaced by a reference. It was already inaccurate previously,
after not having been adjust for key=value.
2026-10-18 15:50:29 +02:00
Mahdi Shariat de1e749daa hwdb: add touchpad toggle for MSI Stealth 14 laptops
The F4 key on modern MSI Stealth 14 laptops (such as the Stealth 14 Studio A13VF)
emits the Windows Precision Touchpad combination (Ctrl + Super + scancode 0x76).
Mapping scancode 0x76 to touchpad_toggle allows desktop environments (like GNOME)
to toggle the touchpad on/off.

Add the DMI match for MSI Stealth 14 laptops to match the existing Prestige and Modern rules.

Verified on MSI Stealth 14 Studio A13VF (MS-14K1).

Signed-off-by: Mahdi Shariat <mahdishariat@proton.me>
2026-10-18 11:54:06 +01:00
Ivan Kruglov 7197de996d core: report unit sub-state in metrics (#44231) 2026-10-18 08:00:33 +02:00
Lennart Poettering 049c05df44 cryptenroll-varlink: Automatically determine node when not set (#44175)
If the user doesn't set the node parameter, determine the node backing
/var/. This is usefull for installers or any UI that want to operated on
the
current system.
2026-10-18 07:36:16 +02:00
ujo4eva 388d7a6ef6 hwdb: stop lid cycles toggling airplane mode on HP Pavilion Gaming 15-dk0xxx (#44266)
The HP Pavilion Gaming Laptop 15-dk0xxx embedded controller emits atkbd
scancodes d7/d8 on lid cycles. The generic HP block maps d7 to KEY_WLAN,
so every lid cycle soft-blocks the radios through rfkill (airplane mode);
d8 is likewise grabbed by the Pavilion block as a touchpad toggle.

The sibling 15-dk1* chassis already carries the d7/d8=unknown override
("# Pavilion gaming 15-dk1* (lid keys)") for exactly this reason, but
15-dk0xxx does not match it and falls through to the generic HP d7=wlan
mapping. Add a matching entry for 15-dk0xxx.

Verified on HP Pavilion Gaming 15-dk0xxx (Insyde F.67): without the
override `systemd-hwdb query` resolves KEYBOARD_KEY_d7=wlan and a lid
cycle soft-blocks phy0; with it, d7/d8 are unknown and lid cycles leave
both radios enabled. evtest on the AT keyboard (event3) shows d8 on lid
close and d7 on lid open.
2026-10-18 12:50:18 +09:00
Luca Boccassi 409be20487 dissect: also interpret "validatefs" xattrs when dissecting DDIs (#44163)
Currently we only look at the "validatefs" xattrs when mounting
partitions at system boot. Let's also validate them when processing
DDIs, in order to lock things down further a bit.

Given that we default to AddValidateFS= anyway in repart, let's add the
other side too for all DDIs we activate during runtime.
2026-10-17 19:18:25 +01:00
Pétur Ingi Egilsson de4dd53136 import: fix D-Bus policy for Manager.ListImages (#44252)
ListImages() is implemented on org.freedesktop.import1.Manager
(manager_vtable), but 5b7bfe0637 added its allow rule under
org.freedesktop.import1.Transfer, so unprivileged callers are denied by
the bus even though the method is marked SD_BUS_VTABLE_UNPRIVILEGED.
2026-10-17 17:29:06 +01:00
Lennart Poettering 93a234df36 update TODO 2026-10-17 18:02:40 +02:00
Lennart Poettering 9de39b045c test: cover provider: URLs and io.systemd.ResourceProvider in TEST-72-SYSUPDATE 2026-10-17 18:02:40 +02:00
Lennart Poettering ac6debd012 sysupdate: accept provider: URLs in transfer sources
Since systemd-pull now understands "provider:[/path/to/socket]/name"
URLs, allow them in the Path= setting of url-file and url-tar sources,
wherever HTTP/HTTPS URLs are accepted. Manifests and payloads are then
acquired from the specified io.systemd.ResourceProvider service, with
the same verification as for web servers. Document the scheme, and how
component providers can use it to serve their own resources.

Fixes: #33351
2026-10-17 18:02:40 +02:00
Lennart Poettering 0c07f0390b import: add Varlink resource provider transport to systemd-pull
Teach systemd-pull to acquire resources via "provider:[/path/to/socket]/name"
URLs: connect to the specified AF_UNIX socket, invoke
io.systemd.ResourceProvider.AcquireResource() with a protocol upgrade,
and read the raw resource data from the upgraded connection. Everything
below the transport – compression detection and decompression, size
and checksum verification, the SHA256SUMS/.sha256/signature lookups
with their not-found fallbacks, --direct, --offset= and --sync= – works
unchanged, since the data is fed through the same code as with curl.

The transport is fully asynchronous, driven by the same event loop as
the curl jobs, using sd_varlink_invoke_and_upgrade().

importctl and systemd-importd accept such URLs too.
2026-10-17 18:02:40 +02:00
Lennart Poettering c71880a657 import: separate transport-independent pull job logic from the curl callbacks
Factor the parts of PullJob that don't depend on the transport out of
the curl callbacks: feeding downloaded data into compression detection
and decompression, finalizing a completed download (size and checksum
verification, finishing the target file), and progress reporting. Also
add an accessor for the event loop a CurlGlue is attached to.

This prepares for adding a second transport. No behaviour change.
2026-10-17 18:02:40 +02:00
Lennart Poettering 1755f2f5e2 varlink-idl: add io.systemd.ResourceProvider interface
A generic interface for acquiring the contents of named resources from a
local service: AcquireResource() is called with the "upgrade" flag, and
after the reply the connection carries the raw resource data until the
provider closes it. It is addressed via "provider:[/path/to/socket]/name"
URLs.
2026-10-17 18:02:40 +02:00
Lennart Poettering cddde675cb basic: add provider:[socket]/resource URL scheme helpers
Introduce a URL scheme for acquiring resources from local Varlink
services: "provider:[/path/to/socket]/resource" names a resource offered
by the service listening on the specified AF_UNIX socket. Add parsing
and validation helpers, and teach the import URL path manipulation
helpers to skip bracketed host components, since the socket path may
contain slashes, so that sibling resources such as SHA256SUMS files are
derived from provider URLs the same way as from HTTP URLs.
2026-10-17 18:02:40 +02:00
Lennart Poettering e7d73d1d15 man: document sysupdate component providers
Describe the io.systemd.SysUpdate.Provider interface, the socket
directory, the precedence rules and the resulting restrictions in
sysupdate.components(5), and reference it from the other sysupdate man
pages..
2026-10-17 18:02:40 +02:00
Lennart Poettering f5cb62ebe6 test: cover component providers in TEST-72-SYSUPDATE 2026-10-17 18:02:40 +02:00
Lennart Poettering 55c4d2eaaa sysupdate: acquire component definitions from component providers
Teach systemd-sysupdate to consult the component providers in
/run/systemd/sysupdate/provider/ in addition to the file system, when
operating on the host (i.e. neither --root=, --image= nor --definitions=
are used):

 * The list of components is the union of the components defined in
   the file system and those offered by any provider. Components defined
   in the file system always win; among providers the one whose socket
   name sorts first wins.

 * When the file system defines nothing for a named component, i.e.
   neither a .component file nor any feature or transfer definition
   could be loaded for it, its definition (metadata, features,
   transfers) is acquired via DescribeTarget() instead.

 * enable-component/disable-component and enable-feature/disable-feature
   refuse to operate on provider-backed components, since their
   definitions do not live in the file system. In the --component-all
   and --component-suggested modes such components are skipped.

 * If not all providers could be asked, a component that is not found is
   not treated as removed, so that "cleanup" and "update --cleanup=yes"
   don't delete installed files just because a provider is down.

The "components --json" output gains a "providers" map naming the
provider of each component whose definition came from a provider.

Inspired-by: #33351
2026-10-17 18:02:40 +02:00
Lennart Poettering 1678c48c9c sysupdate: also list components defined by a .component file alone
get_component_list() so far only considered sysupdate.<name>.d/
directories when enumerating components. A sysupdate.<name>.component
file is a definition of the component as well, hence pick those up too,
so that a component that (so far) only has a metadata file is listed.
2026-10-17 18:02:40 +02:00
Lennart Poettering 9e7a612c14 sysupdate: add client for component providers
Add the client side of io.systemd.SysUpdate.Provider: connect to all
sockets in /run/systemd/sysupdate/provider/ in parallel, collect the
replies and process them sorted by provider name, so that the provider
whose socket name sorts first wins if several claim the same component.

When asking for the definition of a component, distinguish "no provider
offers it" from "not all providers could be asked": the latter must not
be mistaken for the former by callers that clean up after components
that went away.
2026-10-17 18:02:40 +02:00
Lennart Poettering b8c95c5c8b sysupdate: add JSON constructors for component, feature and transfer definitions
Add component_from_json(), feature_from_json() and transfer_from_json(),
which fill in the respective objects from JSON objects shaped like the
types of the io.systemd.SysUpdate.Provider interface, i.e. mirroring the
settings of the configuration files one to one. The transfer constructor
shares the validation and completion logic with the file parser via
transfer_finalize(). In contrast to the configuration files no specifier
expansion takes place.
2026-10-17 18:02:40 +02:00
Lennart Poettering 8570ec7b00 json-util: add json_dispatch_http_url() and json_dispatch_http_urls()
Dispatchers for a single HTTP/HTTPS URL string and for an array of
them, validating each with http_url_is_valid().
2026-10-17 18:02:40 +02:00
Lennart Poettering b141adcdd4 basic: move web-util from src/shared/ to src/basic/
The URL validation helpers only depend on string and path utilities,
hence they can live in libbasic, so that libsystemd code can use them
too.
2026-10-17 18:02:40 +02:00
Lennart Poettering e11e311921 sysupdate: split transfer validation from transfer file parsing
Move the part of transfer_read_definition() that validates and completes
a transfer definition into transfer_finalize(), and factor the semantic
bits of the MatchPattern=, Path= and InstancesMax= parsers into helpers
that don't depend on the config file parser. Also add a
context_add_transfer() helper that sorts a transfer into the enabled or
disabled list of a context.

This prepares for building transfer definitions from other sources than
configuration files. No behaviour change.
2026-10-17 18:02:40 +02:00
Lennart Poettering 4576fa5584 varlink-idl: add io.systemd.SysUpdate.Provider interface
Define the interface component providers implement to feed
systemd-sysupdate with component definitions: ListTargets() returns the
components a provider offers as targets of class 'component', in the
same format as ListTargets() of the io.systemd.SysUpdate interface, and
DescribeTarget() the full definition of one of them, i.e. its target
object, features and transfers. The types mirror
sysupdate.components(5), sysupdate.features(5) and sysupdate.d(5) one
to one, reusing the Target type of the io.systemd.SysUpdate interface.

Also define the directory systemd-sysupdate will look for provider
sockets in.
2026-10-17 18:02:40 +02:00
Lennart Poettering 15f480fbf4 test: cover MaxVersion= on transfers and the component-level version settings 2026-10-17 18:02:40 +02:00
Lennart Poettering b48e4fb3d3 sysupdate: expose component metadata via Varlink and JSON
Extend the Target type of the io.systemd.SysUpdate interface with the
metadata settings of sysupdate.components(5): ListTargets() now fills
them in for targets of class 'component', with the effective enablement
and suggestion state, and leaves them unset for other classes. The
"components --json" output gains a matching "details" array, generated
by the same serializer.
2026-10-17 18:02:40 +02:00
Lennart Poettering 678444cc51 sysupdate: add MinVersion=/MaxVersion=/ProtectVersion= to component definitions
Allow the version bounds and protected versions to be specified once for
a whole component in its .component file. The effective settings of a
component are determined by component_min_version(),
component_max_version() and component_version_is_protected(), which
combine the component's own settings with those of all its enabled
transfers: the more restrictive bound wins, and a version is protected
if the component or any of its enabled transfers lists it.

The two parsers are moved to sysupdate-config.c so both the transfer and
the component tables can share them.
2026-10-17 18:02:40 +02:00
Lennart Poettering a12a993053 sysupdate: add MaxVersion= to transfer definitions
Add a MaxVersion= setting to the [Transfer] section, complementing the
existing MinVersion=. Versions newer than it are flagged "too new": they
are never selected as update candidate, and an explicit request to
install one is refused. Otherwise they are treated like any other
version, i.e. they remain subject to vacuuming and cleanup, and an
already installed too-new version is not removed.

Since the newest available version may now be ineligible while an older
one is fine, candidate selection no longer requires the "newest" bit but
picks the first eligible available version in newest-to-oldest order.
The selected candidate is flagged explicitly, so that the assessment
shown by "list" reflects it even if it isn't the newest version.

Expose the new state in the "list" output, the JSON output ("tooNew",
"candidate") and updatectl.

Fixes: #30695
2026-10-17 18:02:40 +02:00
Lennart Poettering 003b25de9c sysupdate: compose update set assessment strings instead of enumerating flag combinations
update_set_flags_to_string() so far listed every valid combination of
update set flags in one giant switch. That doesn't scale when adding
further flag bits. Replace it by a function that composes the string from
a base assessment plus suffixes into a caller-provided buffer, exposed via
a FORMAT_UPDATE_SET_FLAGS() convenience macro, and pin the produced
strings down with a unit test.

No behaviour change for the combinations that were handled before.
2026-10-17 18:02:40 +02:00
Lennart Poettering af1dee442e sysupdate: split component metadata out of Context into a Component struct
The [Component] section data (description, documentation, enablement,
suggestion state) so far lived as loose fields directly in the Context
object. Move it into a dedicated Component structure with its own reader
and suggestion check, in preparation for teaching it further settings and
for building it from sources other than .component files.

No behaviour change.
2026-10-17 18:02:40 +02:00