Commit Graph
91100 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek cbc8cb18e1 shared: add new securebits (#43376)
The securebits parsing code now recognizes 'no-cap-ambient-raise' (added
in Linux 4.3), 'exec-restrict-file', and 'exec-deny-interactive' (both
added in Linux 6.14). The '-locked' variants were added too.

The `exec-restrict-file` and `exec-deny-interactive` securebits are
particularly useful in combination with `RestrictFileSystemAccess=` to
allow developers to extend the "only execute immutable files" concept to
script interpreters. Those securebits are not documented in the
[`capabilities(7)`](https://man7.org/linux/man-pages/man7/capabilities.7.html)
manpage, only in the [Executability
check](https://docs.kernel.org/userspace-api/check_exec.html) kernel
docs.
2026-08-14 11:57:17 +02:00
Zbigniew Jędrzejewski-Szmek 8975c5c1cf Add a "declarative program header" and introspection of options and verbs (#43152) 2026-08-14 11:52:42 +02:00
Daan De Meyer 7c1609b4c2 ci: harden Claude code review orchestration
Replace opaque built-in review behavior with explicit parallel review lenses for
correctness, concurrency, security, architecture, coding style, and regression
coverage, plus bounded domain-specific reviewers and independent validation.
Prefetch pull request discussion in the setup job while letting the read-only
review job fetch and inspect the full commit history without per-commit
worktrees.

Keep GitHub writes isolated to the setup and posting jobs, pin the Claude models
and CLI, and bound execution below the AWS credential lifetime. Materialize
review instructions from the trusted base revision and scope agent writes to the
structured result directory so untrusted pull request content cannot widen the
review authority.

Treat the posting job as the authoritative trust boundary: validate all
model-selected commits, paths, lines, and thread IDs, normalize degenerate line
ranges, bound sanitized output, and surface GitHub API failures in the tracking
comment before performing writes. Retain daandemeyer/systemd in the repository
allowlist so the workflow can be exercised end to end on the personal fork.

Manual runs against fork PR #15 covered OIDC authentication, sandboxing, result
artifact handoff, tracking-comment updates, and validation of posted output.

Signed-off-by: Daan De Meyer <daan@amutable.com>
2026-08-14 09:45:47 +02:00
Skye Soss bfc302dad2 shared: add new securebits
The securebits parsing code now recognizes 'no-cap-ambient-raise'
(added in Linux 4.3), 'exec-restrict-file', and 'exec-deny-interactive'
(both added in Linux 6.14). The '-locked' variants were added too.
2026-08-13 13:21:28 -05:00
Skye Soss 89fb28f1d3 include/uapi: add linux/securebits.h 2026-08-13 13:21:28 -05:00
Yu Watanabe 8f4cd7de43 resolvectl: fix query option handling and resolvconf input errors (#43370) 2026-08-14 00:35:58 +09:00
Yu Watanabe df9265b5a3 resolved: fix domain replacement and delegate DNS parsing (#43365) 2026-08-14 00:29:26 +09:00
dongshengyuan f4284e9ceb path-lookup: reject empty env path components
Only trailing empty components have special meaning:
they request appending the built-in defaults.

Share the validation between normal path lookup and
systemd-analyze verify, so verify does not compose
values that path lookup later rejects.

Propagate generator path parse errors instead of
turning them into empty generator paths.

Follow-up for: cf7d80a5fe
2026-08-14 00:27:09 +09:00
Yu Watanabe cad2c455ec fstab-filter: fix preserve fstab option escaping (#43274)
Fixes #42787.
2026-08-14 00:23:47 +09:00
guolin 9269952ab2 shell-completion: add completion for machinectl restart
The `restart` verb was added to machinectl as a convenience alias for
`reboot`, but its shell completions were never updated. Add it to both
the bash and zsh completions.
2026-08-13 15:55:03 +01:00
Luca Boccassi 4f80cc06a1 test: add TEST-94-COCO integration test for confidential VMs (#43296) 2026-08-13 13:19:15 +01:00
Zbigniew Jędrzejewski-Szmek 94af9a8b40 verbs: wrap abstract too
So far there's only one multi-line abstract. But as pointed out in the
review, it's silly to handle footer but not the abstract.

help_abstract() is not reused because it only works with one-line
abstracts. (It always prints an empty line to separate paragraphs.)
So the formatting is done anew in print_wrapped(). I think this is OK,
since it's all very simple. After everything has been converted to
COMMAND() and its helpers, help_abstract() and the sister functions will
become unused and can be dropped then.
2026-08-13 13:52:35 +02:00
Zbigniew Jędrzejewski-Szmek 7ea090f41b verbs: wrap the help footer at print time
The footer is now wrapped to min($COLUMNS, 80) when it is printed, so
CommandDescription footers do not need to be hard-wrapped in the source,
and make use of the available terminal width. Newlines embedded in the
text are preserved and each line is wrapped independently, so explicit
line breaks can still be used where needed, e.g. before the example
command line in varlinkctl.

The text is wrapped at max of 80 columns to avoid very wrong lines on
wide terminals. Such lines are hard to read.

A new helper is added for this. We already have format_strv_width in
format-table, but it requires a strv, so we'd need to conver the data,
and returns a formatted string, which we'd need to print ourselves. So
overall, it seems better to add a dedicated helper.
2026-08-13 13:48:24 +02:00
Zbigniew Jędrzejewski-Szmek 7670c20c6e verbs: add PagerFlags pointer to all CommandDescription's
Before this series, many help() functions opened the pager. This got lost
in the translation. Starting the pager requires access to arg_pager_flags.
While we could pipe this through in case when command_print_help() is
called directly, but this hard in the case when verb_help_auto() or
VERB_COMMON_HELP_AUTO/VERB_COMMON_HELP_AUTO_HIDDEN are used. Let's instead
extend the (const static) CommandDescription structure with a pointer to
the arg_pager_flags variable. This restores the pager functionality in a
uniform fashion with a one-line change in the individual binaries.
2026-08-13 13:46:08 +02:00
Zbigniew Jędrzejewski-Szmek 8a14181f55 resolvectl: separate systemd-resolve in introspection data
Previously, the systemd-resolve compat alias was described in the same
CommandDescription structure and resolvectl. But they have different
option sets, so this doesn't really work. The alias is deprecated, so
describe it as such in the abstract, but give it a separate entry.

$ build/resolvectl --introspect-cli
{
  "mediaType": "application/vnd.io.systemd.cli-introspection-0",
  "commands": [
    {
      "names": [ "resolvconf" ],
      "abstract": [
        "Register DNS server and domain configuration with systemd-resolved."
      ],
      ...
    },
    {
      "names": [ "resolvectl" ],
      "abstract": [
        "Send control commands to the network name resolution manager, or\nresolve domain names, IPv4 and IPv6 addresses, DNS records, and services."
      ],
      ...
    },
    {
      "names": [ "systemd-resolve" ],
      "abstract": [
        "Send control commands to the network name resolution manager, or\nresolve domain names, IPv4 and IPv6 addresses, DNS records, and services.\n\nThis command is deprecated. Use resolvectl.1 instead."
      ],
      ...
    }
  ]
}
2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 1a54ce154c various: add --introspect-cli 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 6c83ea9eda Add infrastracture to introspect commandline binaries
This adds the helpers to add a hidden --introspect-cli option which
prints a machine-readable description of the program's interface and
exits. Applicable to any programs that have been converted to
VERB_COMMAND().

The output format follows the draft CLI-Introspection Specification
(https://github.com/behrmann/uapi-specifications/blob/cli-introspection/specs/cli_introspection.md):
a single JSON document with a fixed "mediaType" string and an array of
command objects, one per VERB_COMMAND() defined in the binary, so multicall
binaries are described in full. Options are taken from the command's option
namespace, so e.g. systemd-dissect does not list the mount.ddi mount-helper
options.

$ build/systemd-id128 --json=pretty --introspect-cli
{
        "mediaType" : "application/vnd.io.systemd.cli-introspection-0",
        "commands" : [
                {
                        "names" : [
                                "systemd-id128"
                        ],
                        "version" : "262~devel",
                        "features" : [
                                "-PAM",
                                ...
                        ],
                        "abstract" : [
                                "Generate and print 128-bit identifiers."
                        ],
                        "options" : [
                                {
                                        "names" : [
                                                "-h",
                                                "--help"
                                        ],
                                        "argument" : "no_argument",
                                        "help" : "Show this help"
                                },
                                ...
                        ],
                        "verbs" : [
                                {
                                        "names" : [
                                                "new"
                                        ],
                                        "abstract" : [
                                                "Generate a new ID"
                                        ],
                                        "maxArguments" : 1
                                },
                                ...
                        ]
                }
        ]
}

$ build/systemd-id128 --introspect-cli | jq '.commands[0].options[].names[-1]'
"--help"
"--version"
"--no-pager"
"--no-legend"
"--json"
"-j"
"--pretty"
"--value"
"--app-specific"
"--uuid"
"--introspect-cli"
2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek adbec875af systemd-notify: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 816ce4eeee notify: do not print full help output on error
Printing a wall of text is obnoxious. Just tell the user what the
problem was.
2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 66246c98b5 systemd-dissect: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek df03655bc5 resolvectl: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 580489eeec resolvectl: drop --help for systemd-resolve
The rename was done in v239. We generally don't document obsolete
interfaces, so let's just drop the (very nice) --help that we have here.
2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek a60c999d5b systemd-backlight: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek c9cd66ee3a backlight: add parse_argv() 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 92462517a1 systemd-ask-password: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 24acd23d8d systemd-analyze: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 37e3568236 systemd-ac-power: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek edb15285d0 systemd-veritysetup: convert to VERB_COMMAND
The --help output now shows -h/--help.

"verity protected" is changed to the more correct spelling of
"verity-protected".
2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek c81b5d36b9 veritysetup: add the usual parse_argv() function
More options will be added later, so let's use the usual
setup.
2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek d94e88fe14 varlinkctl: convert to VERB_COMMAND
help verb is moved to the end as in most other commands.
2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 6566264405 homectl: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek e256153186 verbs: add flags and allow verbs&options tables to not be synchronized 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 7e2ef99cfb timedatectl: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 0059c3f5f2 verbs: introduce VERB_COMMON_HELP_AUTO{,_HIDDEN} 2026-08-13 13:23:04 +02:00
Zbigniew Jędrzejewski-Szmek 0ebe40080e id128: convert to VERB_COMMAND 2026-08-13 13:23:04 +02:00
Zbigniew Jędrzejewski-Szmek 8616e54872 verbs: add "program header" and generate all help from data
We add a CommandDescription that contains basic info about the program:
- names (the main name and deprecated aliases)
- abstract, man page list, footer
This gets stored as a fake verb entry through VERB_COMMAND macro.

We can then generate the full help for the program from the verbs
and option arrays.

The formatting of man page links is changed from the form used
previously: the section is printed as ".N" instead of "(N)". This
for has the following advantages:
- the form with parenthesis looks like a function call, so e.g. close(1)
  is both a valid call and a man page link.
- the new form can be automatically selected with a double click in the
  typical terminal configurations, while '(' would usually terminate the
  selection area.
- parentheses are special in shell syntax, so even the user manages to
  successfully select and paste them, they still have to add quoting or
  escaping on the command line.
- the new form is shorter
- it looks better
2026-08-13 13:23:04 +02:00
Zbigniew Jędrzejewski-Szmek 4d620b49f5 shared/format-table: add helper to sync widths of a table array 2026-08-13 13:23:04 +02:00
dongshengyuan 253b34d8ac resolvconf: reject malformed stdin without changing link state
The resolvconf compatibility parser ignored errors from
nameserver, domain, and search lines. If one of those lines was
malformed, resolvectl could still send the partially parsed
configuration to resolved and overwrite the previous link state.

Reproducer:

  IF=enp1s0
  TMP="$(mktemp -d)"

  ln -s "$(command -v resolvectl)" "$TMP/resolvconf"

  sudo resolvectl dns "$IF" 1.1.1.1
  sudo resolvectl domain "$IF" keep.example
  resolvectl domain "$IF"

  printf 'nameserver 1.1.1.1\nsearch "unterminated\n' |
    sudo "$TMP/resolvconf" -a "$IF" || true

  resolvectl domain "$IF"

Before:

  The malformed search line was ignored and the previous domain
  was cleared:

    Link 2 (enp1s0): keep.example
    Link 2 (enp1s0):

After:

  The malformed input fails before updating resolved, so
  keep.example remains configured.

Follow-up for: 097f130731
2026-08-13 17:40:50 +08:00
dongshengyuan e7223f2ab2 resolvectl: reject --raw for regular lookups
--raw only affects ResolveRecord output. Without --type= or an
RFC4501 dns: URI, query takes the ResolveHostname/ResolveAddress
paths, where --raw was silently ignored.

Reproducer:

  build/resolvectl --raw query localhost

Before:

  The command exited successfully and printed regular text output,
  such as:

    localhost: 127.0.0.1

After:

  The command fails before issuing a lookup:

    --raw may only be combined with --type= or dns: URIs.

Follow-up for: 05ea7e87b6
2026-08-13 17:40:49 +08:00
dongshengyuan e021a64391 resolvectl: avoid TXT lookup for plain SRV service queries
The service verb documents the one- and two-argument forms as
SRV lookups. They should not request TXT records by default.
Only the three-argument DNS-SD form should request TXT metadata.

Reproducer:

  Run resolvectl service _mysvc._tcp signed.test in the
  TEST-75-RESOLVED environment, where signed.test contains:

    _mysvc._tcp SRV 10 5 1234 myservice
    _mysvc._tcp TXT "This is TXT for myservice"
    myservice A 10.0.0.20

Before:

  resolvectl service _mysvc._tcp signed.test printed TXT data
  for the plain SRV form:

    _mysvc._tcp/signed.test: myservice.signed.test:1234 [priority=10, weight=5]
                             10.0.0.20
                             fd00:dead:beef:cafe::17
                             This is TXT for myservice

After:

  The plain SRV form suppresses TXT data. The DNS-SD form still
  shows it:

    resolvectl service '' _mysvc._tcp signed.test

Follow-up for: a7a4c60a25
2026-08-13 17:40:49 +08:00
Paul Meyer d66923ea07 test: fix race in TEST-07-PID1 multi-unit transaction subtest
Test failed with the following:

TEST-07-PID1.sh[20020]: + systemctl stop issue8102-nop-dep.service
TEST-07-PID1.sh[20409]: ++ systemctl show -P ActiveState issue8102-nop-dep.service
TEST-07-PID1.sh[20020]: + [[ failed == inactive ]]

systemctl start only waits for the jobs of the units named on the
command line, so the start job pulled in for issue8102-nop-dep.service
via Wants= was not waited for. When the following stop landed while its
ExecStart= was still running, the process was SIGTERMed, and since
Type=oneshot does not treat termination by signal as a clean exit, the
unit ended up failed instead of inactive:

issue8102-nop-dep.service: Changed start -> stop-sigterm
issue8102-nop-dep.service: Main process exited, code=killed, status=15/TERM
issue8102-nop-dep.service: Failed with result 'signal'.

Start both units explicitly so both jobs are waited for.

Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2026-08-13 09:58:53 +01:00
wyu 7b00f957fe strv: drop the escape_separator flag from strv_join_full()
Now that fstab_filter_options() no longer uses strv_join_full() with
escape_separator=true (it splits with EXTRACT_UNESCAPE_RELAX and joins the kept
options verbatim), the escape_separator flag has no users. Drop it from
strv_join_full() and its wrapper strv_join(), and update the remaining callers in
kernel-install and the tests accordingly.
2026-08-13 11:17:23 +08:00
wyu eb5ee83c1f fstab-filter: preserve fstab option escaping in the filtered output
fstab_filter_options() used strv_split_full(..., EXTRACT_UNESCAPE_SEPARATORS |
EXTRACT_UNESCAPE_RELAX), which unescapes "\," and "\\" while splitting, and then
strv_join_full(escape_separator=true) to re-escape the kept options. The round-trip
was lossy for invalid escapes kept verbatim by RELAX (e.g. an option value "\xff"
became "\\xff"), so the generated Options= line diverged from the input. A trailing
backslash was also collapsed: "val1\\" in the fstab became "val1\" in the split
word, which let the backslash escape the option separator in Options= (issue #42787).

Rework fstab_filter_options() to split with EXTRACT_UNESCAPE_RELAX only, so the
escape sequences of kept options are preserved verbatim and the filtered output is
assembled with the plain strv_join(); the matching option values are unescaped
manually so callers keep getting the unescaped form they had before.

Fixes a bug introduced by d4d9f034b1.
Fixes #42787.
2026-08-13 10:36:12 +08:00
wyu 609f8d0214 extract-word: also handle EXTRACT_UNESCAPE_RELAX in the escape branch
extract_first_word() handled a backslash followed by another character in the
escape-processing branch only when EXTRACT_CUNESCAPE or EXTRACT_UNESCAPE_SEPARATORS
was set. With EXTRACT_UNESCAPE_RELAX alone, the backslash was silently dropped and
only the following character kept, which is inconsistent with the documented "keep
invalid escapes verbatim" intent of RELAX. Let RELAX also enter that branch, so an
invalid escape like "\x" is preserved verbatim as "\x" rather than collapsing to
"x".

EXTRACT_UNESCAPE_RELAX is not used on its own anywhere outside the test cases —
the non-test callers always combine it with EXTRACT_CUNESCAPE, which already enters
this branch — so only the test cases that use RELAX by itself are affected, and
their expectations are updated accordingly.
2026-08-13 10:36:11 +08:00
dongshengyuan a572dd2f60 resolved: allow full replacement of link domains
SetLinkDomains() marks old link domains and then builds the replacement
list in place. The marked old domains still counted against
LINK_SEARCH_DOMAINS_MAX, so replacing a non-empty list with exactly the
maximum number of new domains failed while adding the last entry. The error
path then unlinked all domains, so a failed setter call also destroyed the
previous configuration.

Reproducer:

  resolvectl domain dnsbug1 old.example
  busctl call org.freedesktop.resolve1 /org/freedesktop/resolve1 \
    org.freedesktop.resolve1.Manager SetLinkDomains 'ia(sb)' "$ifindex" 1024 "${args[@]}"
  resolvectl domain dnsbug1

Before: the bus call failed with "Argument list too long" and the link's
domain list became empty.

Follow-up for: d2ec6608b9
2026-08-13 09:04:26 +08:00
dongshengyuan 0cfa2d4f4c resolved: keep parsing DNS delegate servers after duplicates
The DNS delegate parser tries to filter duplicate DNS= entries, but the
duplicate branch returned from the whole parser. This made a duplicate
server truncate the rest of the same DNS= line, silently dropping later
valid servers.

Reproducer:

  DNS=192.168.77.78 192.168.77.78 192.168.77.79

Before: only 192.168.77.78 appeared in the delegate server list.

Follow-up for: 7928c0e0a1
2026-08-13 09:02:52 +08:00
dongshengyuan 060b0d2f70 resolvectl: reject tlsa without a domain
The tlsa command accepts an optional service family before the domain list.
When the only argument was "tcp", "udp", or "sctp", we consumed it as the
family and returned success without issuing any query.

Reproducer:

  build/resolvectl tlsa tcp

Before: the command printed nothing and exited with status 0.

Follow-up for: ebbc70e511
2026-08-13 09:02:52 +08:00
Armaan Sandhu 32ac7af788 strv: treat newlines as hard line breaks in strv_rebreak_lines()
A newline embedded in an input entry only reset the width counter and the
leading-whitespace state, but the text collected before it was never flushed.
If nothing but whitespace followed the newline, the end-of-line path then saw
that we were still in the leading whitespace and emitted an empty line,
dropping everything before the newline: "foo\n" turned into "".

Newlines also didn't start a new output entry, so returned entries could
contain newlines and be wider than the requested width, even though callers
expect one output entry per output line.

Flush the collected line at the newline instead, reusing the same logic as at
the end of the string, and treat a trailing newline as terminating the last
line rather than adding an empty one.
2026-08-13 07:11:49 +09:00
Armaan Sandhu 5dc41f8283 options: reject an empty long option name
An argument of the form "--=VALUE" leaves an empty option name, which
startswith() treats as a prefix of every defined option. Depending on how many
long options a namespace defines that yields either an ambiguity error listing
every option, or, with exactly one option defined, a unique partial match that
silently parses "--=VALUE" as that option.
2026-08-13 07:11:37 +09:00
Yu Watanabe 3ae53ab8f6 analyze: allow --json= for the chid, blame and identify-tpm2 verbs (#43366)
verb_chid(), verb_blame() and verb_identify_tpm2() all render their
output via table_print_with_pager() with arg_json_format_flags, so JSON
output has been implemented for them since each verb was introduced.
None of them was ever added to the verb allowlist
that gates --json=, so e.g. systemd-analyze chid --json=pretty failed
with:

Option --json= is only supported for security, inspect-elf,
dlopen-metadata, ...

This adds them to the allowlist and the error message. After a sweep of
src/analyze/ for arg_json_format_flags, these are the only remaining
verbs that render through it but were not allowlisted.

has-tpm2 is deliberately not included: verb_has_tpm2() defers to
verb_has_tpm2_generic(), which writes plain text via printf() and has no
JSON support, so accepting --json= there would silently ignore it. The
table_print_with_pager() call in analyze-has-tpm2.c
belongs to verb_identify_tpm2(), which is what got allowlisted instead.

The chid gap went unnoticed because its TEST-65-ANALYZE coverage is
guarded behind a check for SMBIOS board_vendor and a non-container
environment, so it only runs on bare-metal/VM runners.
2026-08-13 00:06:07 +09:00