Commit Graph
88069 Commits
Author SHA1 Message Date
Nandakumar Raghavan fa6eb2e016 repart: add EncryptKDF= option for LUKS2 partitions
systemd-repart currently creates LUKS2 encrypted partitions using
libcryptsetup's default KDF (Argon2id), which requires ~1GB of memory
during key derivation. This is too much for memory-constrained
environments such as kdump with limited crashkernel memory, where
luksOpen fails due to insufficient memory.

Add an EncryptKDF= option to repart.d partition definitions that allows
selecting the KDF type. Supported values are:

- "argon2id" — Argon2id with libcryptsetup-benchmarked parameters
- "pbkdf2"  — PBKDF2 with libcryptsetup-benchmarked parameters
- "minimal" — PBKDF2 with SHA-512, 1000 iterations, no benchmarking,
  matching the existing cryptsetup_set_minimal_pbkdf() behaviour used
  for TPM2-sealed keys

When not specified, the libcryptsetup default (argon2id) is used,
preserving existing behaviour.

The KDF type is applied via sym_crypt_set_pbkdf_type() after
sym_crypt_format() and before any keyslots are added.
2026-04-18 11:03:52 +01:00
Luca Boccassi 2a6e40c2f5 bootspec: two smaller tweaks to bootspec.c (#41690)
The first commit is prep work for #41543 but I think it makes a ton of
sense on its own as it cleans up logging a bit.
2026-04-18 11:02:35 +01:00
Yu Watanabe b51c133a4e random-util: introduce random_bytes_allocate_iovec() helper function
It is similar to crypto_random_bytes_allocate_iovec(), but possibly
insecure.
2026-04-18 09:56:38 +02:00
Lennart Poettering a08ff701f0 bootspec: improve documentation around id/file BootEntry fields 2026-04-18 09:51:12 +02:00
Lennart Poettering 03cf3c4ff9 bootspec: make boot_filename_extract_tries() ready for use outside of bootspec.c 2026-04-18 09:51:12 +02:00
Lennart Poettering 4368cc8164 Various useful helpers (#41684)
Split out of #41543.

These don't make too much sense on their own, but they also don't really
hurt. They are preparation for #41543, but in order to make things
either to review I split these four commits out, since they are not
directly part of what the PR shall achieve
2026-04-18 09:50:19 +02:00
Lennart Poettering 9879a19222 boot: minor clean-ups in initrd_unregister() 2026-04-18 09:48:42 +02:00
Lennart Poettering e705c842f7 bootctl: minor tweaks (#41695)
This is split out of #41543, but makes sense on its own.
2026-04-18 08:41:46 +02:00
Lennart Poettering 587064b3f3 boot: switch initrd_register() to use _cleanup_free_ and other tweaks 2026-04-18 08:40:58 +02:00
Tobias Stoeckmann 4d2847dcc2 man: Fix NOTES formatting
The NOTES section in os-release(5) contains an unusual formatting.
Switch function and ulink tags and remove a newline within ulink text to
keep the entry formatting in sync with others. Also, this preserves the
formatting within the text itself.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2026-04-17 21:12:16 +01:00
Zbigniew Jędrzejewski-Szmek 1b42c9e06e network/json: two trivial cleanups (#41693) 2026-04-17 19:25:17 +02:00
Yu Watanabe 8bb669712e string-util: make make_cstring() take void* rather than char*
It is typically used for making C string embedded in a binary data.
Hence, the input pointer may not be char*.
2026-04-17 19:24:53 +02:00
Yu Watanabe f46ad8b4ba mountpoint-util: initialize mnt_id for name_to_handle_at(AT_HANDLE_MNT_ID_UNIQUE)
Suppress the following message:
```
$ sudo valgrind --leak-check=full build/networkctl dhcp-lease wlp59s0
==175708== Memcheck, a memory error detector
==175708== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==175708== Using Valgrind-3.26.0 and LibVEX; rerun with -h for copyright info
==175708== Command: build/networkctl status wlp59s0
==175708==
==175708== Conditional jump or move depends on uninitialised value(s)
==175708==    at 0x4BC33D1: inode_same_at (stat-util.c:610)
==175708==    by 0x4BF1972: inode_same (stat-util.h:86)
==175708==    by 0x4BF48FE: running_in_chroot (virt.c:817)
==175708==    by 0x4B16643: running_in_chroot_or_offline (verbs.c:37)
==175708==    by 0x4B175CE: _dispatch_verb_with_args (verbs.c:136)
==175708==    by 0x4B17868: dispatch_verb (verbs.c:160)
==175708==    by 0x407CBB: networkctl_main (networkctl.c:249)
==175708==    by 0x407D06: run (networkctl.c:263)
==175708==    by 0x407D39: main (networkctl.c:266)
==175708==
```
Not sure if it is an issue in valgrind or glibc, but at least there is
nothing we can do except for working around it.
2026-04-17 19:05:41 +02:00
Zbigniew Jędrzejewski-Szmek 08b2d65cab A small batch of conversions to the new option+verbs macros (#41671)
Those are all relatively straightforward.
2026-04-17 19:04:04 +02:00
Zbigniew Jędrzejewski-Szmek 34b9dfe1be sleep: convert to "verbs", using the new option+verb macros
We had verb-like dispatch, but done in a manual way. We have a fairly
heavy preperation steps that wraps all operations in the same way, so we
don't want to call the operation implementation functions directly. But
let's use the generic verb machinery and pass the state directly using
the userdata pointer and the recently added verb data pointer.

--help output is substantially the same, but options are now in a new
section below the verbs.
2026-04-17 19:02:42 +02:00
Zbigniew Jędrzejewski-Szmek b332dfb033 Rework ssh-issue to be verb-based and convert to the new verb+option parsing (#41668)
This is a bit involved because the old interface was documented, so
compat glue needed to be added.
But I think it's an improvement overall.
2026-04-17 19:01:01 +02:00
Lennart Poettering b54af7ce9a bootctl: make bootspec-util.c independent of bootctl.c
This changes boot_config_load_and_select() to also take the root path as
input, just like the ESP and XBOOTLDR path.

This has the benefit of making the whole file independent of bootctl.c,
which means we can link it into a separate test, and is preparatory work
for a follow-up commit.
2026-04-17 18:52:35 +02:00
Lennart Poettering f85415498c bootctl: drop redundant log message
If unprivileged_mode is false then verify_esp() will treat access errors
like any other and log about them. Here we set it to false, hence
there's no point to log a 2nd time.
2026-04-17 18:52:35 +02:00
Yu Watanabe 1c8158412f network/json: drop unnecessary return value assignment 2026-04-18 01:35:17 +09:00
Yu Watanabe 7756f0434c network/json: fix error handling 2026-04-18 01:35:17 +09:00
Lennart Poettering 7e8882a96f stat-util: add vfs_free_bytes()
The casts and the right fields to multiply aren't entirely trivial,
let's add a helper for it.
2026-04-17 18:32:21 +02:00
Lennart Poettering d7b6d89d90 string-util: add minor optimization to strrstr() 2026-04-17 18:32:21 +02:00
Lennart Poettering 2561159d39 string-util: add new strrstr_no_case() call 2026-04-17 18:32:20 +02:00
Lennart Poettering 023f88a6ab parse-util: add safe_atou64_full() 2026-04-17 18:32:20 +02:00
Lennart Poettering c40f254cca boot: gracefully handle LoadFile() implementations that return EFI_SUCCESS with a NULL buffer
LoadFile() with a NULL buffer is supposed to return the file size
without acquiring the data and return EFI_BUFFER_TOO_SMALL.

However it appears some firmware returns EFI_SUCCESS in case the file is
empty, i.e. the file size returned is zero. And I guess that's even
fine.

Let's handle this gracefully hence.
2026-04-17 18:23:51 +02:00
Lennart Poettering a93fa2c6b4 boot: never auto-boot a menu entry with the non-default profile
When figuring out which menu entry to pick by default, let's not
consider any with a profile number > 0. This reflects that fact that
additional profiles are generally used for
debug/recovery/factory-reset/storage target mode boots, and those should
never be auto-selected. Hence do a simple check: if profile != 0, simply
do not consider the entry as a default.

We might eventually want to beef this up, and add a property one can set
in the profile metadata that controls this behaviour, but for now let's
just do a this simple fix.
2026-04-17 17:54:47 +02:00
Lennart Poettering c83c21a054 man: drop redundant word from varlinkctl man page 2026-04-17 15:11:37 +01:00
Luca Boccassi e6fbf51fd6 Revert "ci: Switch PR review workflow to Opus 4.7 via Mantle endpoint"
This reverts commit 0112338585.
2026-04-17 15:35:45 +02:00
Luca Boccassi 2e79f8aa41 systemctl: add --kernel-cmdline= argument
Allows appending kernel command line arguments, like
kexec-tool does. This is especially needed for the integration
tests, as mkosi adds a bunch of options that are needed for the
test suite to work, and it breaks without them.
2026-04-17 13:58:05 +01:00
Luca Boccassi 73aeb1b538 Followups for recent changes to basic/iovec-wrapper (#41676) 2026-04-17 13:55:51 +01:00
Zbigniew Jędrzejewski-Szmek 45c20448d5 basic/iovec-wrapper: use iovw_append in one more place 2026-04-17 12:25:58 +02:00
Zbigniew Jędrzejewski-Szmek 13b6ba9775 basic/iovec-wrapper: fix potential memleak on error
Also reorder the functions in the call stack order.
2026-04-17 12:19:40 +02:00
Zbigniew Jędrzejewski-Szmek 252783981b ssh-issue: replace verb options by normal verbs
The interface of this program was rather strange. It took an option that
specified what to do, but that option behaved exactly like a verb. Let's
change the interface to the more modern style with verbs. Since the
inteface was documented in the man page, provide a compat shim to handle
the old options.

(In practice, I doubt anybody will notice the change. But since it was
documented, it's easier to provide the compat then to think too much
whether it is actually needed. I think we can drop it an year or so.)
2026-04-17 11:54:47 +02:00
Zbigniew Jędrzejewski-Szmek 5961237fde socket-proxyd: convert to the new option parser
--help output is identical in content. --help/--version as now
first in the list, as is usual.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 09:55:35 +02:00
Zbigniew Jędrzejewski-Szmek 07e0805f1a random-seed: convert to "verbs", use the new option+verb code
--help output is the same except for indentation.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 09:55:35 +02:00
Zbigniew Jędrzejewski-Szmek 9d8f4a469b ssh-issue: convert to the new option parser
--make-vsock and --rm-vsock are now described in --help, not only
shown in synopsis.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 09:37:45 +02:00
Zbigniew Jędrzejewski-Szmek 5fdc15f408 string-util: check for overflow in strrep() (#41661)
This simply mirrors the same overflow check we already have in
strrepa(), in case someone passed us a sufficiently long string.

strrep() is currently used only in tests, so this is just hardening.
2026-04-16 22:36:22 +02:00
Zbigniew Jędrzejewski-Szmek b87bc17bf3 report: add ability to upload reports over http (#41440) 2026-04-16 22:35:05 +02:00
Zbigniew Jędrzejewski-Szmek 18acfba6f6 Support for "positional options" and another batch of conversions (#41651)
To make review more sensible, I split out the reordering into separate
commits when there was a lot of reordering.
2026-04-16 22:33:06 +02:00
Zbigniew Jędrzejewski-Szmek baeb764635 report: limit server answer to 1 MiB
As suggested in review.
2026-04-16 21:12:20 +02:00
Zbigniew Jędrzejewski-Szmek b7ac32c2c3 test: add HTTPS upload test for systemd-report
Extend fake-report-server.py with optional --cert, --key, --port
arguments for TLS support. Add a test case that generates a
self-signed certificate and tests HTTPS upload of metrics and facts.

Also exercise the --header param.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 21:12:20 +02:00
Zbigniew Jędrzejewski-Szmek 0f3bd778e0 test: add HTTP upload test for systemd-report
Add a fake HTTP server (fake-report-server.py) that accepts JSON POST
requests and validates the report structure, and test cases in
TEST-74-AUX-UTILS.report.sh that exercise plain HTTP upload of both
metrics and facts.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 21:12:20 +02:00
Zbigniew Jędrzejewski-Szmek ce400ef2d9 report: add option to inject additional HTTP headers
This is useful when debugging things. The option is named and implements
the same logic as imdsd.
2026-04-16 21:12:20 +02:00
Zbigniew Jędrzejewski-Szmek fca491e036 shared/webutil: reorder .c to match .h, mark one more function as _pure_ 2026-04-16 21:12:20 +02:00
Zbigniew Jędrzejewski-Szmek 5bbbe210a4 report: add basic upload functionality 2026-04-16 21:12:20 +02:00
Zbigniew Jędrzejewski-Szmek c861496cd3 shared/curl-util: add curl_append_to_header 2026-04-16 21:07:43 +02:00
Zbigniew Jędrzejewski-Szmek 067aa9b767 test-string-util: test empty_to_null on a char array
Unfortunately empty_to_null(t) where t is char[] fails. But it
works with &t[0].
2026-04-16 21:07:43 +02:00
Zbigniew Jędrzejewski-Szmek 5adccf5034 test: add test-iovec-wrapper
Tests the old code in iovec-wrapper and the two new functions.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 21:07:43 +02:00
Zbigniew Jędrzejewski-Szmek f32af5c69a basic/iovec-wrapper: add iovw_append and iovw_to_cstring
Existing iovw_append is renamed to iovw_append_iovw.
iovw_consume is made noninline.
2026-04-16 20:37:18 +02:00
Frantisek Sumsal 335cc8f39c timesync: verify the actual size of the received data
iov.iov_len doesn't change after calling recvmsg() so it remains set to
sizeof(ntpmsg), which makes the check for a short packet always false.
Let's fix that by checking the actual size of the received data instead.
2026-04-16 19:19:02 +01:00