Commit Graph

87390 Commits

Author SHA1 Message Date
Hadi Chokr
21bfad87e4 Add condition for mutable extensions directory
Signed-off-by: Hadi Chokr <hadichokr@icloud.com>
2026-03-25 12:36:44 +01:00
Michael Vogt
9f691ad3c0 varlink: comment that "more" flag IDL comment is API
External tools that use the systemd varlink ecosystem require
to know if a specific varlink method supports/requires the
"more" flag from the IDL. This is tracked upstream in
https://github.com/varlink/varlink.github.io/issues/26

As an intermediate step systemd adds the (very nice) comments
```
 # [Requires 'more' flag]
or
 # [Supports 'more' flag]
```
to the various methods.

This commit extends the comment around the code that adds the
comment to clarify that this should be considered API and that
the comment should not be changed as external tools (like e.g.
the varlink-http-bridge) rely on it.
2026-03-25 12:27:50 +01:00
Zbigniew Jędrzejewski-Szmek
66feeea8e1 A batch of conversions to the new options parsers (#41302)
This was partially done with Claude, but it needed an insane amount of prodding to
not do stupid things.
2026-03-25 11:39:36 +01:00
Walter McKelvie
8ddc1c07f6 network: increase transmit/receive queues size to 16384 (#41289)
A 10G Marvell AQC113 included in an ASRock TRX50WS motherboard NIC claims to
support tx/rx queues as large as 8184.

After boot 'ethtool -g eth0' outputs:
  Ring parameters for eth0:
  RX:			8184
  RX Mini:		n/a
  RX Jumbo:		n/a
  TX:			8184
  TX push buff len:	n/a
  HDS thresh:		n/a
  RX:			2048
  RX Mini:		n/a
  RX Jumbo:		n/a
  TX:			4096
  RX Buf Len:		n/a
  CQE Size:		n/a
  TX Push:		off
  RX Push:		off
  TX push buff len:	n/a
  TCP data split:		n/a
  HDS thresh:		n/a

'ethtool --set-ring eth0 rx 8184 tx 8184 && ethtool -g eth0' yields:
  Ring parameters for eth0:
  RX:			8184
  RX Mini:		n/a
  RX Jumbo:		n/a
  TX:			8184
  TX push buff len:	n/a
  HDS thresh:		n/a
  RX:			8184
  RX Mini:		n/a
  RX Jumbo:		n/a
  TX:			8184
  RX Buf Len:		n/a
  CQE Size:		n/a
  TX Push:		off
  RX Push:		off
  TX push buff len:	n/a
  TCP data split:		n/a
  HDS thresh:		n/a

I can measure a throughput difference between using using buffer sizes
4096 and 8184 on my hardware, so it really seems that this is doing
something beyond buggy firmware.

Original PR https://github.com/systemd/systemd/pull/17635 didn't give any
explanation for the limit of 4096, but that's probably what was supported by
the kernel drivers at the time.

A web search shows that CISCO VIC 15000 supports 16k, so allow up to that.

[zjs: edited the message]
2026-03-25 11:37:31 +01:00
Ronan Pigott
27eedfa0ef resolved: use the SOA to find chain of trust quicker
sd-resolved does dnssec "backwards" compared to most resolvers.

A typical strategy is to start from the DNS root and gather the
requisite keys on the way down, but sd-resolved requests the final
answer it wants and then goes searching for the requisite keys later.

We don't know in advance under which names we should expect to find
those keys, because we don't know the zone cuts a priori, but we can use
what we have found in prior responses to make an educated guess. This
was more or less the intent of 47690634f1, but it was partially
regressed in d840783db5 while fixing a bug handling totally empty
responses.

Fixes #37472

Ref: 47690634f1 ("resolved: don't request the SOA for every dns label")
Fixes: d840783db5 ("resolved: always progress DS queries")
2026-03-25 11:32:51 +01:00
Frantisek Sumsal
f912de9312 homectl: apply all --member-of= groups from a comma-separated list
Commit 0e1ede4b4b introduced a bug where
we'd always fetch the "original" (empty) list of groups when processing
a comma-separated list of groups from the --member-of= option, so only
the last group from the list would get applied. This bug was then later
(in 316e9887f2) refactored into a separate
function.

Follow-up for 0e1ede4b4b.
Resolves: #41286
2026-03-25 10:41:06 +01:00
Zbigniew Jędrzejewski-Szmek
2e31b9eb29 resolved: resolve insecure answers with unsupported sig algorithms (#40778)
sd-resolved does not support all the permissible DNSSEC signature
algorithms, and some are intentionally unsupported as a matter of
policy. Answers that can only be validated via unsupported algorithms
should be treated as if they were unsigned, per RFC4035 § 5.2.

Previously, sd-resolved tried to properly record insecure answers for
unsupported algortihms, but did not record this status for each of the
auxilliary DNSSEC transactions, so the primary transaction had no way to
know if there was a plausible DNSKEY with an unsupported signature
algorithm in the chain of trust.

This commit adds the insecure DNSKEYs that use unsupported algorithms to
the list of validated keys for each transaction, so that dependent
transactions can learn that a plausible chain of trust exists, even if
no authenticated one does, and report the insecure answer.

This should improve the situation in #35126.
2026-03-25 10:38:08 +01:00
Zbigniew Jędrzejewski-Szmek
9e8658b887 various: fix typos 2026-03-25 02:03:56 +01:00
Zbigniew Jędrzejewski-Szmek
cad2dca504 bless-boot: use the new option parser and verb macros
Co-developed-by: Claude <claude@anthropic.com>
2026-03-25 02:03:55 +01:00
Zbigniew Jędrzejewski-Szmek
baae6e9476 shared/verbs: add VERB_COMMON_HELP_HIDDEN macro and skip verbs with NULL help
Co-developed-by: Claude <claude@anthropic.com>
2026-03-25 02:03:49 +01:00
Zbigniew Jędrzejewski-Szmek
7be9bb1845 shared/verbs: allow multiple verbs to be handled by a single function
With the uintptr_t data parameter, it is actually quite nice to have
VERB(do_impl, "name-a", …)
VERB(do_impl, "name-b", …)
int do_impl(…) { … }

To make this work, the do_impl_data struct needs to have a unique name and
we also need to suppress the warning about the forward declaration for
do_impl being repeated. I think it's fine to suppress the warning, it's
not needed for anything. If somebody declares the function with the same
name by mistake, the implementations are going to conflict too.
2026-03-25 02:02:25 +01:00
Zbigniew Jędrzejewski-Szmek
ca6c3bd0e5 validatefs: shorten and reindent code 2026-03-25 02:02:24 +01:00
Zbigniew Jędrzejewski-Szmek
34d08e2ec3 validatefs: use the new option parser
Co-developed-by: Claude <claude@anthropic.com>
2026-03-25 02:02:24 +01:00
Zbigniew Jędrzejewski-Szmek
58e891e5f6 update-done: use the new option parser
While at it, add --version.

Co-developed-by: Claude <claude@anthropic.com>
2026-03-25 02:02:23 +01:00
Zbigniew Jędrzejewski-Szmek
6e2c5624e6 ask-password: use the new option parser
--version was missing from the old help text and is now included.

Co-developed-by: Claude <claude@anthropic.com>
2026-03-25 02:02:22 +01:00
Zbigniew Jędrzejewski-Szmek
9a96415c69 shared/options: allow option help to be extended with fake lines
Useful when we want to enumerate options rvalues with custom help
texts.
2026-03-25 02:02:20 +01:00
Zbigniew Jędrzejewski-Szmek
1ccfe9ec5f binfmt: use the new option parser
Co-developed-by: Claude <claude@anthropic.com>
2026-03-25 00:45:57 +01:00
Zbigniew Jędrzejewski-Szmek
0765919f05 shared/options: add common option macros for --cat-config and --tldr
Co-developed-by: Claude <claude@anthropic.com>
2026-03-25 00:45:57 +01:00
Zbigniew Jędrzejewski-Szmek
9b8d74a4e7 ac-power: use the new option parser
Co-developed-by: Claude <claude@anthropic.com>
2026-03-25 00:45:57 +01:00
Zbigniew Jędrzejewski-Szmek
848dd000e0 shared/options: add helper function to count positional args 2026-03-25 00:45:57 +01:00
Lennart Poettering
4b6893bdc8 resolved: add "static RRs" concept (#41213)
split out of #40980
2026-03-24 22:45:22 +01:00
Daan De Meyer
4c02d63b36 vmspawn: Fix --help width 2026-03-24 22:43:44 +01:00
Lennart Poettering
fb17ad1581 vmspawn: add disk type selection for root and extra drives (#41301)
vmspawn previously hardcoded virtio-blk for all drives. This adds
  --image-disk-type= to select the root disk type (virtio-blk,
  virtio-scsi, or nvme) and allows per-drive overrides via a
  colon-separated prefix on --extra-drive=. The format and disk type
  prefixes can appear in any order since their value sets don't overlap.

  For virtio-scsi, a single shared controller is created with drives
  attached as scsi-hd devices. For nvme, each drive gets its own
controller. Both have serial number length limits (30 and 20 characters
  respectively), so long filenames are replaced with a truncated SHA-256
  hex digest.
2026-03-24 21:48:00 +01:00
Daan De Meyer
a8c2aa9e2f vmspawn: Add headless console support 2026-03-24 21:36:19 +01:00
Massii Aqvayli
da9df5eb25 po: Translated using Weblate (Kabyle)
Currently translated at 22.5% (60 of 266 strings)

Co-authored-by: Massii Aqvayli <massiin@proton.me>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/kab/
Translation: systemd/main
2026-03-24 20:27:20 +00:00
Lennart Poettering
0718a21c13 resolved: add ability to define additional local RRs via drop-ins
This is an extension of the /etc/hosts concept, but can provide any kind
of RRs (well, actually, we only parse A/AAAA/PTR for now, but the
concept is open for more).

Fixes: #17791
2026-03-24 21:24:48 +01:00
Lennart Poettering
7ad4411a61 resolved: also flush /etc/hosts on reload
When we are told to reload our configuration also flush out /etc/hosts
explicitly. This is particularly relevant since we suppress too frequent
reloads, and hence a synchronous way to force a reload is very useful.
2026-03-24 21:24:47 +01:00
Lennart Poettering
2f1bbebeb9 dns-rr: add dns_resource_record_from_json()
This only parses a small subset of RR types for now, but we can add more
later.

Covered are the most important RR types: A, AAAA, PTR.
2026-03-24 21:24:47 +01:00
Lennart Poettering
333a9a91ef dns-rr: tighten rules on parsing RR keys from JSON
let's ensure the name is actually a valid DNS name.
2026-03-24 21:24:47 +01:00
Lennart Poettering
9eb207356c json-util: add json_dispatch_in6_addr() 2026-03-24 21:24:47 +01:00
Lennart Poettering
3839f5efec json-util: optionally accept string-based serialization for IPv4 addresses 2026-03-24 21:24:47 +01:00
Lennart Poettering
172ae47e65 stat-util: introduce inode_unmodified_hash_ops
This is almost the same as inode_hash_ops, but also hashes + compares
all attributes that could affect the contents of a file. It ignores
"superficial"/"external" attributes such as ownership or access mode
however.
2026-03-24 21:24:47 +01:00
Lennart Poettering
cf6f65c5ea stat-util: also include inode type in hash ops
This doesn't really have any major benefit, but it does make this nicely
mirror stat_inode_same() which also checks this triplet for identifying
identical inodes.
2026-03-24 21:21:10 +01:00
Daan De Meyer
53d5f5c02f ci: Drop codeql workflow
After analyzing all 218 CodeQL alerts across the project's history, the
workflow has not justified its CI cost:

- The most impactful query (PotentiallyDangerousFunction) was a custom
  systemd-specific query that has already been replaced by clang-tidy's
  bugprone-unsafe-functions check (6fb5ec3dd1).

- Of the remaining C++ queries, 6 never triggered at all
  (bad-strncpy-size, unsafe-strcat, unsafe-strncat,
  suspicious-pointer-scaling, suspicious-pointer-scaling-void,
  inconsistent-null-check).

- Several high-value-sounding queries had extreme false positive rates:
  toctou-race-condition (95% FP), use-after-free (88% FP),
  cleartext-transmission (100% FP).

- Many queries that did trigger are already covered by compiler warnings
  (-Wshadow, -Wformat, -Wunused-variable, -Wreturn-type,
  -Wtautological-compare) or existing clang-tidy checks
  (bugprone-sizeof-expression).

- Across all alerts, only 3 genuinely useful C++ fixes can be
  attributed to CodeQL: 1 tainted-format-string, 2
  incorrectly-checked-scanf. The rest were either false positives or
  incidental fixes during refactoring that weren't prompted by CodeQL.

- The Python queries are largely superseded by ruff (already in CI) and
  had an 89% false positive rate on the security-focused checks.

The workflow consumed significant CI resources (40+ minutes per run) and
the ongoing maintenance burden of triaging false positives outweighs the
marginal value of the 2-3 real findings it produced across its entire
lifetime.
2026-03-24 17:55:26 +01:00
Christian Brauner
b76e1732f7 vmspawn: add nvme disk type support
Extend --image-disk-type= and the --extra-drive= disk type prefix to
support nvme in addition to virtio-blk and virtio-scsi:

  systemd-vmspawn --image-disk-type=nvme --image=image.raw
  systemd-vmspawn --image=image.raw --extra-drive=nvme:data.raw

The NVMe serial number is limited to 20 characters by the NVMe spec.
If the image filename exceeds this, it is hashed with SHA-256 and
truncated to 20 hex characters via the disk_serial() helper introduced
in the previous commit.

Signed-off-by: Christian Brauner <brauner@kernel.org>
2026-03-24 16:53:41 +01:00
Christian Brauner
e4a58c38e9 vmspawn: add virtio-scsi disk type support
Add --image-disk-type= to select the disk type for the root disk, and
allow specifying the disk type as a colon-separated prefix on
--extra-drive=:

  systemd-vmspawn --image-disk-type=virtio-scsi --image=image.raw
  systemd-vmspawn --image=image.raw --extra-drive=virtio-scsi:data.raw

For --extra-drive=, the format and disk type prefixes can appear in any
order since the value sets don't overlap:

  --extra-drive=raw:virtio-scsi:/path
  --extra-drive=virtio-scsi:raw:/path

Extra drives inherit --image-disk-type= by default unless overridden
with an explicit prefix.

vmspawn originally used virtio-scsi for all drives but switched to
virtio-blk in 1f24a954e4 for simplicity and direct kernel boot
compatibility. This makes virtio-scsi available again as an explicit
option for cases where a SCSI storage topology is desired.

For virtio-scsi, a shared virtio-scsi-pci controller is created and
drives are attached as scsi-hd devices. The SCSI serial number is
limited to 30 characters, so filenames exceeding this are hashed with
SHA-256.

Signed-off-by: Christian Brauner <brauner@kernel.org>
2026-03-24 16:53:40 +01:00
Daan De Meyer
f498a5652f vmspawn: EFI NVRAM state control (#41218)
Split out of #41016
2026-03-24 16:04:16 +01:00
Zbigniew Jędrzejewski-Szmek
ec32afd525 shell-completion: add shell completions for systemd-hwdb
Co-developed-by: Claude <claude@anthropic.com>
2026-03-24 14:49:22 +00:00
Lennart Poettering
48ca2f6ff5 discover-image: remove tpm state + efi nvram state on image removal 2026-03-24 14:42:39 +01:00
Lennart Poettering
dc91cb82da vmspawn: split out swtpm-setup logic, and beef it up a bit 2026-03-24 14:42:39 +01:00
Lennart Poettering
9996cfd2c9 vmspawn: manage EFI nvram (variables) state similar to TPM state 2026-03-24 14:40:08 +01:00
Lennart Poettering
5cd3462014 vmspawn: make efi variable nvram dependent on whether the EFI profile knows the concept, not on secureboot 2026-03-24 14:40:08 +01:00
Daan De Meyer
516a7b2baa ci: Only run claude-review automatically on PRs to main 2026-03-24 14:25:57 +01:00
Daan De Meyer
da580dc161 vmspawn: Drop --sandbox=chroot from virtiofsd command line
It's unclear why I added this in fd05c6c759,
but it breaks bind mounting regular directories via --bind,
so drop it again since it's not actually required to make virtiofsd
work with the foreign UID range.
2026-03-24 11:21:02 +00:00
Daan De Meyer
7aa94251fe ci: Generalize escaping instructions in claude-review prompt 2026-03-24 10:27:35 +01:00
Luca Boccassi
3af158759f creds: use CLEANUP_ERASE for symmetric key
Just in case, ensure the sha256 that is used as a symmetric
key for encrypted creds is safely erased from memory.

Reported on yeswehack.com as YWH-PGM9780-166

Follow-up for 21bc0b6fa1
2026-03-24 08:29:03 +01:00
Lennart Poettering
e7a176fe46 Define options and verbs through "magic macros" (#40880)
This is an another alternative for #40656, based on @poettering's
suggestion to use an ELF section.

The output of --help is generated using format-table, but the details of
the formatting a bit off: different sections in the table (verbs, option
groups) are not aligned to the same column. Our current table formatting
doesn't make this easy. If somebody has an idea how to do this without
too much pain, please make suggestions.

Another thing that I didn't know how to do nicely, was to use the two
columns of separation. But maybe this doesn't matter. If we switch to
one column everywhere, I don't think people will care.

Example output:
```console
$ build/systemd-id128 -h | cat    
systemd-id128 [OPTIONS...] COMMAND

Generate and print 128-bit identifiers.

Commands:
  new                Generate a new ID
  machine-id         Print the ID of current machine
  boot-id            Print the ID of current boot
  invocation-id      Print the ID of current invocation
  var-partition-uuid Print the UUID for the /var/ partition
  show [NAME|UUID]   Print one or more UUIDs
  help               Show this help

Options:
  -h --help            Show this help
     --version         Show package version
     --no-pager        Do not start a pager
     --no-legend       Do not show headers and footers
     --json=FORMAT     Output inspection data in JSON (takes one of pretty,
                       short, off)
  -j                   Equivalent to --json=pretty (on TTY) or --json=short
                       (otherwise)
  -p --pretty          Generate samples of program code
  -P --value           Only print the value
  -a --app-specific=ID Generate app-specific IDs
  -u --uuid            Output in UUID format

See the systemd-id128(1) man page for details.
```

The output wraps automatically with terminal width. If the terminal is
extremely narrow, ellipsization occurs. I think this doesn't matter
and/or is actually a feature. Such narrow terminals mostly occur in
testing, so it doesn't matter what exactly we do, as long as it is
something somewhat reasonable.

Anyway, I think this is enough as PoC. Please compare this with the
previous approach. /cc @behrmann, @YHNdnzj, @poettering

The three binaries that are converted have options, verbs, optional
arguments, and options terminate option parsing, so most of the
functionality is there. One thing that I didn't implement that was
present in previous PRs is "namespaces", i.e. multiple parsers in the
same source file. I expect that we can handle this similarly to option
groups.
2026-03-23 22:17:05 +01:00
Ronan Pigott
3ddb73317e resolved: also validate unsupported dnssec digest algs 2026-03-23 13:06:19 -07:00
Ronan Pigott
053f4f1dbc resolved: resolve insecure answers with unsupported sig algorithms
sd-resolved does not support all the permissible DNSSEC signature
algorithms, and some are intentionally unsupported as a matter of
policy. Answers that can only be validated via unsupported algorithms
should be treated as if they were unsigned, per RFC4035§5.2.

Previously, sd-resolved tried to properly record insecure answers for
unsupported algortihms, but did not record this status for each of the
auxilliary DNSSEC transactions, so the primary transaction had no way to
know if there was a plausible DNSKEY with an unsupported signature
algorithm in the chain of trust.

This commit adds the insecure DNSKEYs that use unsupported algorithms to
the list of validated keys for each transaction, so that dependent
transactions can learn that a plausible chain of trust exists, even if
no authenticated one does, and report the insecure answer.
2026-03-23 13:06:19 -07:00
Lennart Poettering
5adfd44c9e copy: add new flags that cause a seek to beginning of files before copying
This is quite useful in various cases where we so far did this manually.
2026-03-23 19:19:46 +00:00